From 689ff54e86509875618d1c194114a560c327434e Mon Sep 17 00:00:00 2001 From: Lev Proleev Date: Thu, 17 Sep 2020 13:47:54 +0000 Subject: [PATCH] Revert "Ringtone uri should add type query" This reverts commit 3b25df9ad3f44f30ebdbfd84143ddb78c90f8db1. Reason for revert: potential culprit for test breakage: b/168789394 Change-Id: Ie042b91c189c026079b040f6609df4c22c70f2cf --- media/java/android/media/RingtoneManager.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java index 20041a8cfc18b..8deb0c4451eac 100644 --- a/media/java/android/media/RingtoneManager.java +++ b/media/java/android/media/RingtoneManager.java @@ -1129,14 +1129,12 @@ public class RingtoneManager { } // Try finding the scanned ringtone - final String whichAudio = getQueryStringForType(type); final String filename = getDefaultRingtoneFilename(type); - final String where = MediaColumns.DISPLAY_NAME + "=?," + whichAudio + "=?"; final Uri baseUri = MediaStore.Audio.Media.INTERNAL_CONTENT_URI; try (Cursor cursor = context.getContentResolver().query(baseUri, new String[] { MediaColumns._ID }, - where, - new String[] { filename , "1"}, null)) { + MediaColumns.DISPLAY_NAME + "=?", + new String[] { filename }, null)) { if (cursor.moveToFirst()) { final Uri ringtoneUri = context.getContentResolver().canonicalizeOrElse( ContentUris.withAppendedId(baseUri, cursor.getLong(0))); @@ -1164,13 +1162,4 @@ public class RingtoneManager { default: throw new IllegalArgumentException(); } } - - private static String getQueryStringForType(int type) { - switch (type) { - case TYPE_RINGTONE: return MediaStore.Audio.AudioColumns.IS_RINGTONE; - case TYPE_NOTIFICATION: return MediaStore.Audio.AudioColumns.IS_NOTIFICATION; - case TYPE_ALARM: return MediaStore.Audio.AudioColumns.IS_ALARM; - default: throw new IllegalArgumentException(); - } - } }