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
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 @@
      * @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 @@
         } 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;