am 0cab1c58: am 95508fd5: am e2788366: Merge "Fix SecurityException when trying to retrieve ringtone title" into mnc-dev

* commit '0cab1c58941a4064140c94efb7888b06db78e664':
  Fix SecurityException when trying to retrieve ringtone title
diff --git a/src/com/android/phone/common/util/SettingsUtil.java b/src/com/android/phone/common/util/SettingsUtil.java
index e473947..c297e1e 100644
--- a/src/com/android/phone/common/util/SettingsUtil.java
+++ b/src/com/android/phone/common/util/SettingsUtil.java
@@ -20,6 +20,7 @@
 import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteException;
+import android.media.Ringtone;
 import android.media.RingtoneManager;
 import android.net.Uri;
 import android.os.Handler;
@@ -82,17 +83,16 @@
             summary = context.getString(R.string.ringtone_silent);
         } else {
             // Fetch the ringtone title from the media provider
-            try {
-                Cursor cursor = context.getContentResolver().query(ringtoneUri,
-                        new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
-                if (cursor != null) {
-                    if (cursor.moveToFirst()) {
-                        summary = cursor.getString(0);
+            final Ringtone ringtone = RingtoneManager.getRingtone(context, ringtoneUri);
+            if (ringtone != null) {
+                try {
+                    final String title = ringtone.getTitle(context);
+                    if (!TextUtils.isEmpty(title)) {
+                        summary = title;
                     }
-                    cursor.close();
+                } catch (SQLiteException sqle) {
+                    // Unknown title for the ringtone
                 }
-            } catch (SQLiteException sqle) {
-                // Unknown title for the ringtone
             }
         }
         if (defaultRingtone) {