Canonicalize default ringtones.

Bug: 130445562
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Ia4dee2f5596147ac50b2393fccb8516cc43b0102
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 00f1e43..5f34f1b 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -981,6 +981,12 @@
         }
     }
 
+    /** {@hide} */
+    public final @NonNull Uri canonicalizeOrElse(@NonNull Uri uri) {
+        final Uri res = canonicalize(uri);
+        return (res != null) ? res : uri;
+    }
+
     /**
      * Transform the given <var>url</var> to a canonical representation of
      * its referenced resource, which can be used across devices, persisted,
diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java
index e207721..77f756b 100644
--- a/media/java/android/media/RingtoneManager.java
+++ b/media/java/android/media/RingtoneManager.java
@@ -502,8 +502,7 @@
     private static Uri getUriFromCursor(Context context, Cursor cursor) {
         final Uri uri = ContentUris.withAppendedId(Uri.parse(cursor.getString(URI_COLUMN_INDEX)),
                 cursor.getLong(ID_COLUMN_INDEX));
-        final Uri canonicalized = context.getContentResolver().canonicalize(uri);
-        return (canonicalized != null) ? canonicalized : uri;
+        return context.getContentResolver().canonicalizeOrElse(uri);
     }
 
     /**