diff options
author | Andrew Lee <anwlee@google.com> | 2014-11-24 15:42:47 -0800 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-11-24 16:49:35 -0800 |
commit | c11bd1b0ac01d0bd3497d1e47e70e53792036e5a (patch) | |
tree | d3ad247afb0d9a245d2a1761fd2c5eb0bdfa3425 /src/com/android | |
parent | 0830cf646293665e2e28ae1159b7c1ac2a286396 (diff) | |
download | packages_apps_PhoneCommon-c11bd1b0ac01d0bd3497d1e47e70e53792036e5a.tar.gz packages_apps_PhoneCommon-c11bd1b0ac01d0bd3497d1e47e70e53792036e5a.tar.bz2 packages_apps_PhoneCommon-c11bd1b0ac01d0bd3497d1e47e70e53792036e5a.zip |
Use string SharedPreferences key for update ringtone.
Instead of using the preference, deal directly with the key.
I changed the logic so that it will return null/silent as the
ringtone uri if the key is null. Because, technically, one could
call the function with a "type" expecting a valid return type,
but not provide a key.
Bug: 18232725
Change-Id: Ifb3d517ef8b0a5ddba388f2e0d471874f7b4b235
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/phone/common/util/SettingsUtil.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/com/android/phone/common/util/SettingsUtil.java b/src/com/android/phone/common/util/SettingsUtil.java index 6a5bd1c..859c1a5 100644 --- a/src/com/android/phone/common/util/SettingsUtil.java +++ b/src/com/android/phone/common/util/SettingsUtil.java @@ -58,15 +58,11 @@ public class SettingsUtil { * @param context The application context. * @param handler The handler, which takes the name of the ringtone as a String as a parameter. * @param type The type of sound. - * @param preference The preference being updated. + * @param key The key to the shared preferences entry being updated. * @param msg An integer identifying the message sent to the handler. */ public static void updateRingtoneName( - Context context, Handler handler, int type, Preference preference, int msg) { - if (preference == null) { - return; - } - + Context context, Handler handler, int type, String key, int msg) { final Uri ringtoneUri; boolean defaultRingtone = false; if (type == RingtoneManager.TYPE_RINGTONE) { @@ -76,7 +72,7 @@ public class SettingsUtil { } else { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); // For voicemail notifications, we use the value saved in Phone's shared preferences. - String uriString = prefs.getString(preference.getKey(), null); + String uriString = prefs.getString(key, null); if (TextUtils.isEmpty(uriString)) { // silent ringtone ringtoneUri = null; |