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

Commit 0f8b4f38 authored by Raj Yengisetty's avatar Raj Yengisetty
Browse files

DeskClock: Fix behavior when setting external media file for alarm tone

Repro:
1) Set an alarm
2) Click on sound
3) Select Ringtone then select Music and press OK
4) In DocumentsUI picker, go to overflow menu and select "Show internal storage"
5) Open drawer and select Internal storage
6) Navigate to and select a music file e.g. "/Downloads/test.mp3"

Observe that when the alarm rings, the music file selected isn't played, instead
alarm falls back to fallback ringtone

Change-Id: I6bf19c0e94fc5fe6415de9c291aa938f6043e380
parent 94925a55
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1433,7 +1433,8 @@ public class AlarmClockFragment extends DeskClockFragment implements
                } else {
                    if (Utils.isRingToneUriValid(mContext, uri)) {
                        if (uri.getAuthority().equals(Utils.DOC_AUTHORITY)
                                || uri.getAuthority().equals(Utils.DOC_DOWNLOAD)) {
                                || uri.getAuthority().equals(Utils.DOC_DOWNLOAD)
                                || uri.getAuthority().equals(Utils.DOC_EXTERNAL)) {
                            title = getDisplayNameFromDatabase(mContext,uri);
                        } else if (uri.isPathPrefixMatch(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI)) {
                            Cursor c = getActivity().getContentResolver().query(uri, new String[] {MediaStore.Audio.Playlists.NAME}, null, null, null);
+2 −1
Original line number Diff line number Diff line
@@ -270,7 +270,8 @@ public class AlarmMultiPlayer implements MediaPlayer.OnCompletionListener {
            mRandom = true;
            return;
        } else if (uri.getAuthority().equals(Utils.DOC_DOWNLOAD)
                || uri.getAuthority().equals(Utils.DOC_AUTHORITY)) {
                || uri.getAuthority().equals(Utils.DOC_AUTHORITY)
                || uri.getAuthority().equals(Utils.DOC_EXTERNAL)) {
            mUriTrack = uri;
            mSingle = true;
            return;
+5 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.os.Build;
import android.os.Handler;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.provider.DocumentsContract.Document;
import android.provider.MediaStore;
import android.text.Spannable;
import android.text.SpannableString;
@@ -97,6 +98,7 @@ public class Utils {
    /** Content provider paths that could be passed back from documents ui **/
    public static final String DOC_AUTHORITY = "com.android.providers.media.documents";
    public static final String DOC_DOWNLOAD = "com.android.providers.downloads.documents";
    public static final String DOC_EXTERNAL = "com.android.externalstorage.documents";

    /** Types that may be used for clock displays. **/
    public static final String CLOCK_TYPE_DIGITAL = "digital";
@@ -670,6 +672,9 @@ public class Utils {
        if (uri.isPathPrefixMatch(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI)) {
            return MediaStore.Audio.Playlists.NAME;
        }
        if (DOC_EXTERNAL.equals(uri.getAuthority())) {
            return Document.COLUMN_DISPLAY_NAME;
        }
        return MediaStore.Audio.Media.TITLE;
    }