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

Commit 3d1353aa authored by Hyundo Moon's avatar Hyundo Moon
Browse files

AML: Unhide KeyEvent.isMediaSessionKey()

Bug: 119789707
Test: make update-api
Change-Id: I60f3271b205348ed64241851304fe7213a535c8e
parent c49b4131
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47835,6 +47835,7 @@ package android.view {
    method public final boolean isFunctionPressed();
    method public static final boolean isGamepadButton(int);
    method public final boolean isLongPress();
    method public static final boolean isMediaSessionKey(int);
    method public final boolean isMetaPressed();
    method public static boolean isModifierKey(int);
    method public final boolean isNumLockOn();
+22 −25
Original line number Diff line number Diff line
@@ -1802,6 +1802,28 @@ public class KeyEvent extends InputEvent implements Parcelable {
        return isWakeKey(mKeyCode);
    }

    /**
     * Returns whether this key will be sent to the
     * {@link android.media.session.MediaSession.Callback} if not handled.
     */
    public static final boolean isMediaSessionKey(int keyCode) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
            case KeyEvent.KEYCODE_MUTE:
            case KeyEvent.KEYCODE_HEADSETHOOK:
            case KeyEvent.KEYCODE_MEDIA_STOP:
            case KeyEvent.KEYCODE_MEDIA_NEXT:
            case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
            case KeyEvent.KEYCODE_MEDIA_REWIND:
            case KeyEvent.KEYCODE_MEDIA_RECORD:
            case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
                return true;
        }
        return false;
    }

    /**
     * Returns true if the specified keycode is a gamepad button.
     * @return True if the keycode is a gamepad button, such as {@link #KEYCODE_BUTTON_A}.
@@ -1861,31 +1883,6 @@ public class KeyEvent extends InputEvent implements Parcelable {
        }
    }

    /**
     * Returns whether this key can be handled by
     * {@link android.media.session.MediaSession.Callback}.
     *
     * @hide
     */
    public static final boolean isMediaSessionKey(int keyCode) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
            case KeyEvent.KEYCODE_MUTE:
            case KeyEvent.KEYCODE_HEADSETHOOK:
            case KeyEvent.KEYCODE_MEDIA_STOP:
            case KeyEvent.KEYCODE_MEDIA_NEXT:
            case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
            case KeyEvent.KEYCODE_MEDIA_REWIND:
            case KeyEvent.KEYCODE_MEDIA_RECORD:
            case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
                return true;
        }
        return false;
    }


    /** Is this a system key? System keys can not be used for menu shortcuts.
     * @hide
     */