private static void peek(@NonNull Context context, @NonNull Uri uri) { if (Settings.AUTHORITY.equals(uri.getAuthority())) { final int type = RingtoneManager.getDefaultType(uri); // This can throw a SecurityException. final Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(context, type); if (actualUri != null) { // Actual Uri may be null on Android 4 emulators, where there are no ringtones. // Plus silent default ringtone sounds like a valid case. peek(context, actualUri); } return; } // This can throw a SecurityException. final ContentResolver res = context.getContentResolver(); final Cursor cursor = res.query(uri, COLUMNS, null, null, null); if (cursor != null) { cursor.close(); } }
&& Settings.AUTHORITY.equals(uri.getAuthority())) { uri = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
&& Settings.AUTHORITY.equals(uri.getAuthority())) { uri = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");
RingtoneManager.getDefaultType(uri)); if (uri == null) { throw new FileNotFoundException("Failed to resolve default ringtone");