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

Commit a6face4d authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Plumb KEYCODE_MEDIA_PAUSE and KEYCODE_MEDIA_PLAY up through the framework.

b/2764237

Change-Id: I9a20974fa0b7527230258f7d0bf829a031673a9d
parent 23f22430
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -142,6 +142,8 @@ public abstract class KeyguardViewBase extends FrameLayout {
        final int keyCode = event.getKeyCode();
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_MEDIA_PLAY:
                case KeyEvent.KEYCODE_MEDIA_PAUSE:
                case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
                    /* Suppress PLAYPAUSE toggle when phone is ringing or
                     * in-call to avoid music playback */
+2 −0
Original line number Diff line number Diff line
@@ -788,6 +788,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
            case KeyEvent.KEYCODE_VOLUME_DOWN:
            case KeyEvent.KEYCODE_MUTE:
            case KeyEvent.KEYCODE_HEADSETHOOK:
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_STOP:
            case KeyEvent.KEYCODE_MEDIA_NEXT:
+4 −0
Original line number Diff line number Diff line
@@ -1256,6 +1256,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            }


            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
                /* Suppress PLAYPAUSE toggle when phone is ringing or in-call
                 * to avoid music playback */
@@ -1453,6 +1455,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            }

            case KeyEvent.KEYCODE_HEADSETHOOK:
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_STOP:
            case KeyEvent.KEYCODE_MEDIA_NEXT:
+2 −0
Original line number Diff line number Diff line
@@ -1845,6 +1845,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    
    static boolean isMediaKey(int code) {
        if (code == KeyEvent.KEYCODE_HEADSETHOOK || 
                code == KeyEvent.KEYCODE_MEDIA_PLAY ||
                code == KeyEvent.KEYCODE_MEDIA_PAUSE ||
                code == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE ||
                code == KeyEvent.KEYCODE_MEDIA_STOP || 
                code == KeyEvent.KEYCODE_MEDIA_NEXT ||