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

Commit 7d958f08 authored by Max Zhang's avatar Max Zhang
Browse files

[2/4] Add user customizable keys (4) for RCU in frameworks/base

Define 4 new keys, update the "last key" test case, and assign
values in Generic.kl.
Project details can be found at
go/dipper-custom-button

Bug: 269742724
Test: local build

Change-Id: If0b12be56fea1a39192da068abdacde8d3e0948f
parent fb7e58c5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -49507,6 +49507,10 @@ package android.view {
    field public static final int KEYCODE_LAST_CHANNEL = 229; // 0xe5
    field public static final int KEYCODE_LEFT_BRACKET = 71; // 0x47
    field public static final int KEYCODE_M = 41; // 0x29
    field public static final int KEYCODE_MACRO_1 = 313; // 0x139
    field public static final int KEYCODE_MACRO_2 = 314; // 0x13a
    field public static final int KEYCODE_MACRO_3 = 315; // 0x13b
    field public static final int KEYCODE_MACRO_4 = 316; // 0x13c
    field public static final int KEYCODE_MANNER_MODE = 205; // 0xcd
    field public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222; // 0xde
    field public static final int KEYCODE_MEDIA_CLOSE = 128; // 0x80
+1 −1
Original line number Diff line number Diff line
@@ -2959,7 +2959,7 @@ package android.view {
    method public static String actionToString(int);
    method public final void setDisplayId(int);
    field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
    field public static final int LAST_KEYCODE = 312; // 0x138
    field public static final int LAST_KEYCODE = 316; // 0x13c
  }

  public final class KeyboardShortcutGroup implements android.os.Parcelable {
+26 −1
Original line number Diff line number Diff line
@@ -897,13 +897,38 @@ public class KeyEvent extends InputEvent implements Parcelable {
     * This key is handled by the framework and is never delivered to applications.
     */
    public static final int KEYCODE_RECENT_APPS = 312;
    /**
     * Key code constant: A button whose usage can be customized by the user through
     *                    the system.
     * User customizable key #1.
     */
    public static final int KEYCODE_MACRO_1 = 313;
    /**
     * Key code constant: A button whose usage can be customized by the user through
     *                    the system.
     * User customizable key #2.
     */
    public static final int KEYCODE_MACRO_2 = 314;
    /**
     * Key code constant: A button whose usage can be customized by the user through
     *                    the system.
     * User customizable key #3.
     */
    public static final int KEYCODE_MACRO_3 = 315;
    /**
     * Key code constant: A button whose usage can be customized by the user through
     *                    the system.
     * User customizable key #4.
     */
    public static final int KEYCODE_MACRO_4 = 316;


   /**
     * Integer value of the last KEYCODE. Increases as new keycodes are added to KeyEvent.
     * @hide
     */
    @TestApi
    public static final int LAST_KEYCODE = KEYCODE_RECENT_APPS;
    public static final int LAST_KEYCODE = KEYCODE_MACRO_4;

    // NOTE: If you add a new keycode here you must also add it to:
    //  isSystem()
+4 −0
Original line number Diff line number Diff line
@@ -423,6 +423,10 @@ key 580 APP_SWITCH
key 582   VOICE_ASSIST
# Linux KEY_ASSISTANT
key 583   ASSIST
key 656   MACRO_1
key 657   MACRO_2
key 658   MACRO_3
key 659   MACRO_4

# Keys defined by HID usages
key usage 0x0c0067 WINDOW
+13 −0
Original line number Diff line number Diff line
@@ -3188,6 +3188,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                Slog.wtf(TAG, "KEYCODE_STYLUS_BUTTON_* should be handled in"
                        + " interceptKeyBeforeQueueing");
                return key_consumed;
            case KeyEvent.KEYCODE_MACRO_1:
            case KeyEvent.KEYCODE_MACRO_2:
            case KeyEvent.KEYCODE_MACRO_3:
            case KeyEvent.KEYCODE_MACRO_4:
                Slog.wtf(TAG, "KEYCODE_MACRO_x should be handled in interceptKeyBeforeQueueing");
                return key_consumed;
        }

        if (isValidGlobalKey(keyCode)
@@ -4310,6 +4316,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                result &= ~ACTION_PASS_TO_USER;
                break;
            }
            case KeyEvent.KEYCODE_MACRO_1:
            case KeyEvent.KEYCODE_MACRO_2:
            case KeyEvent.KEYCODE_MACRO_3:
            case KeyEvent.KEYCODE_MACRO_4:
                // TODO(b/266098478): Add logic to handle KEYCODE_MACROx feature
                result &= ~ACTION_PASS_TO_USER;
                break;
        }

        if (useHapticFeedback) {