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

Commit dda868cd authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Keyguard sound needs to hold wake lock."

parents d30f7372 e47e8520
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -204,6 +204,21 @@ public class Ringtone {
        openMediaPlayer();
    }

    /** @hide */
    public void setWakeMode(Context context, int mode) {
        if (mAudio == null) {
            try {
                openMediaPlayer();
            } catch (Exception ex) {
                Log.e(TAG, "setWakeMode() caught ", ex);
                mAudio = null;
            }
        }
        if (mAudio != null) {
            mAudio.setWakeMode(context, mode);
        }
    }

    /**
     * Plays the ringtone.
     */
+1 −0
Original line number Diff line number Diff line
@@ -1054,6 +1054,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
                    final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
                    if (sfx != null) {
                        sfx.setStreamType(AudioManager.STREAM_SYSTEM);
                        sfx.setWakeMode(mContext, PowerManager.PARTIAL_WAKE_LOCK);
                        sfx.play();
                    } else {
                        if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: "