Add new KEYCODE_RECENT_APPS

Also, block the keycode from passing over to apps since this is
a system only key

Test: manual
Bug: 261621522
Change-Id: Iedf88a7d8f72b6b5f20758e8b928efc5d547521b
This commit is contained in:
Vaibhav Devmurari
2022-12-06 22:06:24 +00:00
committed by Tracy Zhou
parent e56846d9fc
commit 24ab103663
5 changed files with 13 additions and 3 deletions

View File

@@ -49492,6 +49492,7 @@ package android.view {
field public static final int KEYCODE_PROG_YELLOW = 185; // 0xb9
field public static final int KEYCODE_Q = 45; // 0x2d
field public static final int KEYCODE_R = 46; // 0x2e
field public static final int KEYCODE_RECENT_APPS = 312; // 0x138
field public static final int KEYCODE_REFRESH = 285; // 0x11d
field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48
field public static final int KEYCODE_RO = 217; // 0xd9

View File

@@ -2927,7 +2927,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 = 311; // 0x137
field public static final int LAST_KEYCODE = 312; // 0x138
}
public final class KeyboardShortcutGroup implements android.os.Parcelable {

View File

@@ -892,13 +892,18 @@ public class KeyEvent extends InputEvent implements Parcelable {
* The use of this button does not usually correspond to the function of an eraser.
*/
public static final int KEYCODE_STYLUS_BUTTON_TAIL = 311;
/**
* Key code constant: To open recent apps view (a.k.a. Overview).
* This key is handled by the framework and is never delivered to applications.
*/
public static final int KEYCODE_RECENT_APPS = 312;
/**
* Integer value of the last KEYCODE. Increases as new keycodes are added to KeyEvent.
* @hide
*/
@TestApi
public static final int LAST_KEYCODE = KEYCODE_STYLUS_BUTTON_TAIL;
public static final int LAST_KEYCODE = KEYCODE_RECENT_APPS;
// NOTE: If you add a new keycode here you must also add it to:
// isSystem()
@@ -2021,6 +2026,7 @@ public class KeyEvent extends InputEvent implements Parcelable {
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_SOFT_RIGHT:
case KeyEvent.KEYCODE_HOME:
case KeyEvent.KEYCODE_RECENT_APPS:
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_CALL:
case KeyEvent.KEYCODE_ENDCALL:

View File

@@ -139,7 +139,7 @@ key 116 POWER
key 117 NUMPAD_EQUALS
# key 118 "KEY_KPPLUSMINUS"
key 119 BREAK
# key 120 (undefined)
key 120 RECENT_APPS
key 121 NUMPAD_COMMA
key 122 KANA
key 123 EISU

View File

@@ -2887,6 +2887,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
break;
case KeyEvent.KEYCODE_RECENT_APPS:
// TODO(b/261621522): Handle recents key presses
return key_consumed;
case KeyEvent.KEYCODE_APP_SWITCH:
if (!keyguardOn) {
if (down && repeatCount == 0) {