Merge "[2/4] Add user customizable keys (4) for RCU in frameworks/base" into udc-dev

This commit is contained in:
Max Zhang
2023-03-28 20:10:52 +00:00
committed by Android (Google) Code Review
5 changed files with 48 additions and 2 deletions

View File

@@ -50903,6 +50903,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

View File

@@ -3332,7 +3332,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 {

View File

@@ -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()

View File

@@ -424,6 +424,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

View File

@@ -3259,6 +3259,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)
@@ -4396,6 +4402,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) {