From 750bb8549cf521d3dc602603a3c2ff47857ba300 Mon Sep 17 00:00:00 2001 From: Wenyi Wang Date: Tue, 15 Sep 2015 16:46:29 -0700 Subject: [PATCH] Modified getCallerInfo to handle silent ringtone (comment added) Bug: 12800232 Change-Id: Ib382acdffe39ec063825ae79f80352a5e5636bc4 --- .../com/android/internal/telephony/CallerInfo.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java index be7e7029115b0..59a8a67f85a2d 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfo.java +++ b/telephony/java/com/android/internal/telephony/CallerInfo.java @@ -249,9 +249,17 @@ public class CallerInfo { // look for the custom ringtone, create from the string stored // in the database. + // An empty string ("") in the database indicates a silent ringtone, + // and we set contactRingtoneUri = Uri.EMPTY, so that no ringtone will be played. + // {null} in the database indicates the default ringtone, + // and we set contactRingtoneUri = null, so that default ringtone will be played. columnIndex = cursor.getColumnIndex(PhoneLookup.CUSTOM_RINGTONE); if ((columnIndex != -1) && (cursor.getString(columnIndex) != null)) { - info.contactRingtoneUri = Uri.parse(cursor.getString(columnIndex)); + if (TextUtils.isEmpty(cursor.getString(columnIndex))) { + info.contactRingtoneUri = Uri.EMPTY; + } else { + info.contactRingtoneUri = Uri.parse(cursor.getString(columnIndex)); + } } else { info.contactRingtoneUri = null; }