Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a8c38c1 authored by Hongguang Chen's avatar Hongguang Chen
Browse files

RingtoneManager: allow the default ringtone uri is null.

It couldn't be null before. ag/20652041 changed the API behavior.
On TV device, the default ringtone uri is null.

Fix: 263710967
Fix: 263616941
Test: atest android.media.audio.cts.RingtoneManagerTest on TV
Test: atest android.appsecurity.cts.ExternalStorageHostTest on TV
Change-Id: Idb3fe4e695ce36452b176307ecba6c333aabfd3b
parent 1d7957fa
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -827,6 +827,7 @@ public class RingtoneManager {
            ringtoneUri = ContentProvider.maybeAddUserId(ringtoneUri, context.getUserId());
        }

        if (ringtoneUri != null) {
            final String mimeType = resolver.getType(ringtoneUri);
            if (mimeType == null) {
                Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
@@ -838,6 +839,7 @@ public class RingtoneManager {
                        + " ignored: associated mimeType:" + mimeType + " is not an audio type");
                return;
            }
        }

        Settings.System.putStringForUser(resolver, setting,
                ringtoneUri != null ? ringtoneUri.toString() : null, context.getUserId());