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

Commit a92a8cf9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[RingtoneManager] Remove user id from internal Uri"

parents 58da9178 760d2714
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -727,7 +727,9 @@ public class RingtoneManager {

        String setting = getSettingForType(type);
        if (setting == null) return;
        if(!isInternalRingtoneUri(ringtoneUri)) {
            ringtoneUri = ContentProvider.maybeAddUserId(ringtoneUri, context.getUserId());
        }
        Settings.System.putStringForUser(resolver, setting,
                ringtoneUri != null ? ringtoneUri.toString() : null, context.getUserId());

@@ -744,6 +746,12 @@ public class RingtoneManager {
        }
    }

    private static boolean isInternalRingtoneUri(Uri uri) {
        Uri uriWithoutUserId = ContentProvider.getUriWithoutUserId(uri);
        return uriWithoutUserId == null ? false : uriWithoutUserId.toString()
                        .startsWith(MediaStore.Audio.Media.INTERNAL_CONTENT_URI.toString());
    }

    /**
     * Try opening the given ringtone locally first, but failover to
     * {@link IRingtonePlayer} if we can't access it directly. Typically happens