Loading media/java/android/media/MediaPlayer.java +5 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.res.AssetFileDescriptor; Loading Loading @@ -982,13 +983,16 @@ public class MediaPlayer extends PlayerBase public void setDataSource(@NonNull Context context, @NonNull Uri uri, @Nullable Map<String, String> headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { // The context and URI usually belong to the calling user. Get a resolver for that user // and strip out the userId from the URI if present. final ContentResolver resolver = context.getContentResolver(); final String scheme = uri.getScheme(); final String authority = ContentProvider.getAuthorityWithoutUserId(uri.getAuthority()); if (ContentResolver.SCHEME_FILE.equals(scheme)) { setDataSource(uri.getPath()); return; } else if (ContentResolver.SCHEME_CONTENT.equals(scheme) && Settings.AUTHORITY.equals(uri.getAuthority())) { && Settings.AUTHORITY.equals(authority)) { // Try cached ringtone first since the actual provider may not be // encryption aware, or it may be stored on CE media storage final int type = RingtoneManager.getDefaultType(uri); Loading media/java/android/media/RingtoneManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -816,6 +816,7 @@ public class RingtoneManager { * @return The type of the defaultRingtoneUri, or -1. */ public static int getDefaultType(Uri defaultRingtoneUri) { defaultRingtoneUri = ContentProvider.getUriWithoutUserId(defaultRingtoneUri); if (defaultRingtoneUri == null) { return -1; } else if (defaultRingtoneUri.equals(Settings.System.DEFAULT_RINGTONE_URI)) { Loading Loading
media/java/android/media/MediaPlayer.java +5 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.res.AssetFileDescriptor; Loading Loading @@ -982,13 +983,16 @@ public class MediaPlayer extends PlayerBase public void setDataSource(@NonNull Context context, @NonNull Uri uri, @Nullable Map<String, String> headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { // The context and URI usually belong to the calling user. Get a resolver for that user // and strip out the userId from the URI if present. final ContentResolver resolver = context.getContentResolver(); final String scheme = uri.getScheme(); final String authority = ContentProvider.getAuthorityWithoutUserId(uri.getAuthority()); if (ContentResolver.SCHEME_FILE.equals(scheme)) { setDataSource(uri.getPath()); return; } else if (ContentResolver.SCHEME_CONTENT.equals(scheme) && Settings.AUTHORITY.equals(uri.getAuthority())) { && Settings.AUTHORITY.equals(authority)) { // Try cached ringtone first since the actual provider may not be // encryption aware, or it may be stored on CE media storage final int type = RingtoneManager.getDefaultType(uri); Loading
media/java/android/media/RingtoneManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -816,6 +816,7 @@ public class RingtoneManager { * @return The type of the defaultRingtoneUri, or -1. */ public static int getDefaultType(Uri defaultRingtoneUri) { defaultRingtoneUri = ContentProvider.getUriWithoutUserId(defaultRingtoneUri); if (defaultRingtoneUri == null) { return -1; } else if (defaultRingtoneUri.equals(Settings.System.DEFAULT_RINGTONE_URI)) { Loading