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

Commit 1f3d3931 authored by gismo2004's avatar gismo2004 Committed by Dan Pasanen
Browse files

DeskClock: fix ringtones stored on /sdcard/Alarms

we don't need permissions to play alarms from external sdcard.

Change-Id: Ia8d0a814144f95809d7964efef4a35c9788eba0c
parent ef9fb84e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -133,6 +133,12 @@ public class AlarmUtils {
            return true;
        }

        // If using ringtones from RingtoneManager stored on external sd-card return true
        // even if their uri points to "content://media/external/*"
        if (ringtoneUri.getAuthority().equals(Utils.DOC_MEDIA)){
            return true;
        }

        // If the ringtone is internal, return true;
        // external ringtones require the permission to see their title
        return ringtoneUri.toString().startsWith("content://media/internal/");
+7 −0
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ public class Utils {
    public static final String DOC_DOWNLOAD = "com.android.providers.downloads.documents";
    public static final String DOC_EXTERNAL = "com.android.externalstorage.documents";
    public static final String DOWNLOAD_CONTENT = "content://downloads/public_downloads";
    /** passed back from RingtoneManager **/
    public static final String DOC_MEDIA = "media";
    public static final String COLON = ":";
    public static final int ID_INDEX = 1;

@@ -785,6 +787,11 @@ public class Utils {
            }
        } else if (uri.getScheme().contentEquals("content")) {
            if (AlarmUtils.hasPermissionToDisplayRingtoneTitle(context, uri)) {
                // If the uri is provided by RingtoneManager return true --> if file is not
                // available RingtoneManager will play a default tone.
                if (uri.getAuthority().equals(Utils.DOC_MEDIA)){
                    return true;
                }
                //convert the following uri to the correct, otherwise raise permission exception
                if (uri.getAuthority().equals(Utils.DOC_DOWNLOAD)) {
                    final String id = DocumentsContract.getDocumentId(uri);