Merge "Add an extra in AssistContent for providing contextual app functions data." into main
diff --git a/api/Android.bp b/api/Android.bp
index 0ac85e2..6a01677 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -127,27 +127,54 @@
}),
}
+// Create a single file containing the latest released version of the whole
+// Android public API.
+java_genrule {
+ name: "android.api.merged.public.latest",
+ srcs: [
+ ":android.api.combined.public.latest",
+ ],
+ out: ["public-latest.txt"],
+ tools: ["metalava"],
+ cmd: metalava_cmd + " merge-signatures --format=2.0 $(in) --out $(out)",
+}
+
+// Make sure that the Android public API is compatible with the
+// previously released public API.
java_genrule {
name: "frameworks-base-api-current-compat",
srcs: [
- ":android.api.public.latest",
+ ":android.api.merged.public.latest",
":android-incompatibilities.api.public.latest",
":frameworks-base-api-current.txt",
],
out: ["updated-baseline.txt"],
tools: ["metalava"],
cmd: metalava_cmd +
- "--check-compatibility:api:released $(location :android.api.public.latest) " +
+ "--check-compatibility:api:released $(location :android.api.merged.public.latest) " +
"--baseline:compatibility:released $(location :android-incompatibilities.api.public.latest) " +
"--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
"$(location :frameworks-base-api-current.txt)",
}
+// Create a single file containing the latest released version of the whole
+// Android system API.
+java_genrule {
+ name: "android.api.merged.system.latest",
+ srcs: [
+ ":android.api.combined.system.latest",
+ ],
+ out: ["system-latest.txt"],
+ tools: ["metalava"],
+ cmd: metalava_cmd + " merge-signatures --format=2.0 $(in) --out $(out)",
+}
+
+// Make sure that the Android system API is compatible with the
+// previously released system API.
java_genrule {
name: "frameworks-base-api-system-current-compat",
srcs: [
- ":android.api.public.latest",
- ":android.api.system.latest",
+ ":android.api.merged.system.latest",
":android-incompatibilities.api.system.latest",
":frameworks-base-api-current.txt",
":frameworks-base-api-system-current.txt",
@@ -155,20 +182,31 @@
out: ["updated-baseline.txt"],
tools: ["metalava"],
cmd: metalava_cmd +
- "--check-compatibility:api:released $(location :android.api.public.latest) " +
- "--check-compatibility:api:released $(location :android.api.system.latest) " +
+ "--check-compatibility:api:released $(location :android.api.merged.system.latest) " +
"--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " +
"--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
"$(location :frameworks-base-api-current.txt) " +
"$(location :frameworks-base-api-system-current.txt)",
}
+// Create a single file containing the latest released version of the whole
+// Android module-lib API.
+java_genrule {
+ name: "android.api.merged.module-lib.latest",
+ srcs: [
+ ":android.api.combined.module-lib.latest",
+ ],
+ out: ["module-lib-latest.txt"],
+ tools: ["metalava"],
+ cmd: metalava_cmd + " merge-signatures --format=2.0 $(in) --out $(out)",
+}
+
+// Make sure that the Android module-lib API is compatible with the
+// previously released module-lib API.
java_genrule {
name: "frameworks-base-api-module-lib-current-compat",
srcs: [
- ":android.api.public.latest",
- ":android.api.system.latest",
- ":android.api.module-lib.latest",
+ ":android.api.merged.module-lib.latest",
":android-incompatibilities.api.module-lib.latest",
":frameworks-base-api-current.txt",
":frameworks-base-api-system-current.txt",
@@ -177,9 +215,7 @@
out: ["updated-baseline.txt"],
tools: ["metalava"],
cmd: metalava_cmd +
- "--check-compatibility:api:released $(location :android.api.public.latest) " +
- "--check-compatibility:api:released $(location :android.api.system.latest) " +
- "--check-compatibility:api:released $(location :android.api.module-lib.latest) " +
+ "--check-compatibility:api:released $(location :android.api.merged.module-lib.latest) " +
"--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " +
"--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
"$(location :frameworks-base-api-current.txt) " +
diff --git a/core/api/current.txt b/core/api/current.txt
index 4c005b0..f03ef8c 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -52004,6 +52004,7 @@
field public static final int KEYCODE_CHANNEL_DOWN = 167; // 0xa7
field public static final int KEYCODE_CHANNEL_UP = 166; // 0xa6
field public static final int KEYCODE_CLEAR = 28; // 0x1c
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_CLOSE = 321; // 0x141
field public static final int KEYCODE_COMMA = 55; // 0x37
field public static final int KEYCODE_CONTACTS = 207; // 0xcf
field public static final int KEYCODE_COPY = 278; // 0x116
@@ -52016,6 +52017,8 @@
field public static final int KEYCODE_DEMO_APP_2 = 302; // 0x12e
field public static final int KEYCODE_DEMO_APP_3 = 303; // 0x12f
field public static final int KEYCODE_DEMO_APP_4 = 304; // 0x130
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_DICTATE = 319; // 0x13f
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_DO_NOT_DISTURB = 322; // 0x142
field public static final int KEYCODE_DPAD_CENTER = 23; // 0x17
field public static final int KEYCODE_DPAD_DOWN = 20; // 0x14
field public static final int KEYCODE_DPAD_DOWN_LEFT = 269; // 0x10d
@@ -52028,7 +52031,7 @@
field public static final int KEYCODE_DVR = 173; // 0xad
field public static final int KEYCODE_E = 33; // 0x21
field public static final int KEYCODE_EISU = 212; // 0xd4
- field @FlaggedApi("com.android.hardware.input.emoji_and_screenshot_keycodes_available") public static final int KEYCODE_EMOJI_PICKER = 317; // 0x13d
+ field public static final int KEYCODE_EMOJI_PICKER = 317; // 0x13d
field public static final int KEYCODE_ENDCALL = 6; // 0x6
field public static final int KEYCODE_ENTER = 66; // 0x42
field public static final int KEYCODE_ENVELOPE = 65; // 0x41
@@ -52040,7 +52043,19 @@
field public static final int KEYCODE_F10 = 140; // 0x8c
field public static final int KEYCODE_F11 = 141; // 0x8d
field public static final int KEYCODE_F12 = 142; // 0x8e
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F13 = 326; // 0x146
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F14 = 327; // 0x147
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F15 = 328; // 0x148
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F16 = 329; // 0x149
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F17 = 330; // 0x14a
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F18 = 331; // 0x14b
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F19 = 332; // 0x14c
field public static final int KEYCODE_F2 = 132; // 0x84
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F20 = 333; // 0x14d
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F21 = 334; // 0x14e
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F22 = 335; // 0x14f
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F23 = 336; // 0x150
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_F24 = 337; // 0x151
field public static final int KEYCODE_F3 = 133; // 0x85
field public static final int KEYCODE_F4 = 134; // 0x86
field public static final int KEYCODE_F5 = 135; // 0x87
@@ -52055,6 +52070,7 @@
field public static final int KEYCODE_FOCUS = 80; // 0x50
field public static final int KEYCODE_FORWARD = 125; // 0x7d
field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_FULLSCREEN = 325; // 0x145
field public static final int KEYCODE_FUNCTION = 119; // 0x77
field public static final int KEYCODE_G = 35; // 0x23
field public static final int KEYCODE_GRAVE = 68; // 0x44
@@ -52078,6 +52094,7 @@
field public static final int KEYCODE_LANGUAGE_SWITCH = 204; // 0xcc
field public static final int KEYCODE_LAST_CHANNEL = 229; // 0xe5
field public static final int KEYCODE_LEFT_BRACKET = 71; // 0x47
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_LOCK = 324; // 0x144
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
@@ -52115,6 +52132,7 @@
field public static final int KEYCODE_NAVIGATE_NEXT = 261; // 0x105
field public static final int KEYCODE_NAVIGATE_OUT = 263; // 0x107
field public static final int KEYCODE_NAVIGATE_PREVIOUS = 260; // 0x104
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_NEW = 320; // 0x140
field public static final int KEYCODE_NOTIFICATION = 83; // 0x53
field public static final int KEYCODE_NUM = 78; // 0x4e
field public static final int KEYCODE_NUMPAD_0 = 144; // 0x90
@@ -52149,6 +52167,7 @@
field public static final int KEYCODE_PLUS = 81; // 0x51
field public static final int KEYCODE_POUND = 18; // 0x12
field public static final int KEYCODE_POWER = 26; // 0x1a
+ field @FlaggedApi("com.android.hardware.input.enable_new_25q2_keycodes") public static final int KEYCODE_PRINT = 323; // 0x143
field public static final int KEYCODE_PROFILE_SWITCH = 288; // 0x120
field public static final int KEYCODE_PROG_BLUE = 186; // 0xba
field public static final int KEYCODE_PROG_GREEN = 184; // 0xb8
@@ -52161,7 +52180,7 @@
field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48
field public static final int KEYCODE_RO = 217; // 0xd9
field public static final int KEYCODE_S = 47; // 0x2f
- field @FlaggedApi("com.android.hardware.input.emoji_and_screenshot_keycodes_available") public static final int KEYCODE_SCREENSHOT = 318; // 0x13e
+ field public static final int KEYCODE_SCREENSHOT = 318; // 0x13e
field public static final int KEYCODE_SCROLL_LOCK = 116; // 0x74
field public static final int KEYCODE_SEARCH = 84; // 0x54
field public static final int KEYCODE_SEMICOLON = 74; // 0x4a
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 1173519..8dd12172 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -3729,7 +3729,7 @@
method public final int getDisplayId();
method public final void setDisplayId(int);
field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
- field public static final int LAST_KEYCODE = 318; // 0x13e
+ field public static final int LAST_KEYCODE = 337; // 0x151
}
public final class KeyboardShortcutGroup implements android.os.Parcelable {
diff --git a/core/java/android/hardware/input/input_framework.aconfig b/core/java/android/hardware/input/input_framework.aconfig
index 38e32c6..a8eb11d 100644
--- a/core/java/android/hardware/input/input_framework.aconfig
+++ b/core/java/android/hardware/input/input_framework.aconfig
@@ -30,14 +30,6 @@
flag {
namespace: "input_native"
- name: "emoji_and_screenshot_keycodes_available"
- is_exported: true
- description: "Add new KeyEvent keycodes for opening Emoji Picker and Taking Screenshots"
- bug: "315307777"
-}
-
-flag {
- namespace: "input_native"
name: "keyboard_a11y_slow_keys_flag"
description: "Controls if the slow keys accessibility feature for physical keyboard is available to the user"
bug: "294546335"
@@ -153,6 +145,13 @@
}
flag {
+ name: "enable_new_25q2_keycodes"
+ namespace: "input"
+ description: "Enables new 25Q2 keycodes"
+ bug: "365920375"
+}
+
+flag {
name: "override_power_key_behavior_in_focused_window"
namespace: "input_native"
description: "Allows privileged focused windows to capture power key events."
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index dddc408..38e4e27 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -935,7 +935,6 @@
*/
public static final int KEYCODE_MACRO_4 = 316;
/** Key code constant: To open emoji picker */
- @FlaggedApi(Flags.FLAG_EMOJI_AND_SCREENSHOT_KEYCODES_AVAILABLE)
public static final int KEYCODE_EMOJI_PICKER = 317;
/**
* Key code constant: To take a screenshot
@@ -944,15 +943,80 @@
* unlike {@code KEYCODE_SYSRQ} which is sent to the app first and only if the app
* doesn't handle it, the framework handles it (to take a screenshot).
*/
- @FlaggedApi(Flags.FLAG_EMOJI_AND_SCREENSHOT_KEYCODES_AVAILABLE)
public static final int KEYCODE_SCREENSHOT = 318;
+ /** Key code constant: To start dictate to an input field */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_DICTATE = 319;
+ /**
+ * Key code constant: AC New
+ *
+ * e.g. To create a new instance of a window, open a new tab, etc.
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_NEW = 320;
+ /**
+ * Key code constant: AC Close
+ *
+ * e.g. To close current instance of the application window, close the current tab, etc.
+ */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_CLOSE = 321;
+ /** Key code constant: To toggle 'Do Not Disturb' mode */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_DO_NOT_DISTURB = 322;
+ /** Key code constant: To Print */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_PRINT = 323;
+ /** Key code constant: To Lock the screen */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_LOCK = 324;
+ /** Key code constant: To toggle fullscreen mode (on the current application) */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_FULLSCREEN = 325;
+ /** Key code constant: F13 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F13 = 326;
+ /** Key code constant: F14 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F14 = 327;
+ /** Key code constant: F15 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F15 = 328;
+ /** Key code constant: F16 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F16 = 329;
+ /** Key code constant: F17 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F17 = 330;
+ /** Key code constant: F18 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F18 = 331;
+ /** Key code constant: F19 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F19 = 332;
+ /** Key code constant: F20 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F20 = 333;
+ /** Key code constant: F21 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F21 = 334;
+ /** Key code constant: F22 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F22 = 335;
+ /** Key code constant: F23 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F23 = 336;
+ /** Key code constant: F24 key. */
+ @FlaggedApi(Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
+ public static final int KEYCODE_F24 = 337;
/**
* Integer value of the last KEYCODE. Increases as new keycodes are added to KeyEvent.
* @hide
*/
@TestApi
- public static final int LAST_KEYCODE = KEYCODE_SCREENSHOT;
+ @SuppressWarnings("FlaggedApi")
+ public static final int LAST_KEYCODE = KEYCODE_F24;
/** @hide */
@IntDef(prefix = {"KEYCODE_"}, value = {
@@ -1275,6 +1339,25 @@
KEYCODE_MACRO_4,
KEYCODE_EMOJI_PICKER,
KEYCODE_SCREENSHOT,
+ KEYCODE_DICTATE,
+ KEYCODE_NEW,
+ KEYCODE_CLOSE,
+ KEYCODE_DO_NOT_DISTURB,
+ KEYCODE_PRINT,
+ KEYCODE_LOCK,
+ KEYCODE_FULLSCREEN,
+ KEYCODE_F13,
+ KEYCODE_F14,
+ KEYCODE_F15,
+ KEYCODE_F16,
+ KEYCODE_F17,
+ KEYCODE_F18,
+ KEYCODE_F19,
+ KEYCODE_F20,
+ KEYCODE_F21,
+ KEYCODE_F22,
+ KEYCODE_F23,
+ KEYCODE_F24,
})
@Retention(RetentionPolicy.SOURCE)
@interface KeyCode {}
diff --git a/data/keyboards/Generic.kl b/data/keyboards/Generic.kl
index f8d3bff..2b0802b 100644
--- a/data/keyboards/Generic.kl
+++ b/data/keyboards/Generic.kl
@@ -171,7 +171,7 @@
# key 149 "KEY_PROG2"
key 150 EXPLORER
# key 151 "KEY_MSDOS"
-key 152 POWER
+key 152 LOCK
# key 153 "KEY_DIRECTION"
# key 154 "KEY_CYCLEWINDOWS"
key 155 ENVELOPE
@@ -200,20 +200,20 @@
key 178 PAGE_DOWN
key 179 NUMPAD_LEFT_PAREN
key 180 NUMPAD_RIGHT_PAREN
-# key 181 "KEY_NEW"
+key 181 NEW
# key 182 "KEY_REDO"
-# key 183 F13
-# key 184 F14
-# key 185 F15
-# key 186 F16
-# key 187 F17
-# key 188 F18
-# key 189 F19
-# key 190 F20
-# key 191 F21
-# key 192 F22
-# key 193 F23
-# key 194 F24
+key 183 F13
+key 184 F14
+key 185 F15
+key 186 F16
+key 187 F17
+key 188 F18
+key 189 F19
+key 190 F20
+key 191 F21
+key 192 F22
+key 193 F23
+key 194 F24
# key 195 (undefined)
# key 196 (undefined)
# key 197 (undefined)
@@ -225,11 +225,11 @@
# key 203 "KEY_PROG4"
key 204 NOTIFICATION
# key 205 "KEY_SUSPEND"
-# key 206 "KEY_CLOSE"
+key 206 CLOSE
key 207 MEDIA_PLAY
key 208 MEDIA_FAST_FORWARD
# key 209 "KEY_BASSBOOST"
-# key 210 "KEY_PRINT"
+key 210 PRINT
# key 211 "KEY_HP"
key 212 CAMERA
key 213 MUSIC
@@ -328,7 +328,7 @@
# key 369 "KEY_TITLE"
key 370 CAPTIONS
# key 371 "KEY_ANGLE"
-# key 372 "KEY_ZOOM"
+key 372 FULLSCREEN
# key 373 "KEY_MODE"
# key 374 "KEY_KEYBOARD"
# key 375 "KEY_SCREEN"
@@ -425,12 +425,15 @@
# Linux KEY_ASSISTANT
key 583 ASSIST
key 585 EMOJI_PICKER
+key 586 DICTATE
key 656 MACRO_1
key 657 MACRO_2
key 658 MACRO_3
key 659 MACRO_4
# Keys defined by HID usages
+key usage 0x010082 LOCK FALLBACK_USAGE_MAPPING
+key usage 0x01009B DO_NOT_DISTURB FALLBACK_USAGE_MAPPING
key usage 0x0c0065 SCREENSHOT FALLBACK_USAGE_MAPPING
key usage 0x0c0067 WINDOW FALLBACK_USAGE_MAPPING
key usage 0x0c006F BRIGHTNESS_UP FALLBACK_USAGE_MAPPING
@@ -438,12 +441,17 @@
key usage 0x0c0079 KEYBOARD_BACKLIGHT_UP FALLBACK_USAGE_MAPPING
key usage 0x0c007A KEYBOARD_BACKLIGHT_DOWN FALLBACK_USAGE_MAPPING
key usage 0x0c007C KEYBOARD_BACKLIGHT_TOGGLE FALLBACK_USAGE_MAPPING
+key usage 0x0c00D8 DICTATE FALLBACK_USAGE_MAPPING
key usage 0x0c00D9 EMOJI_PICKER FALLBACK_USAGE_MAPPING
key usage 0x0c0173 MEDIA_AUDIO_TRACK FALLBACK_USAGE_MAPPING
key usage 0x0c019C PROFILE_SWITCH FALLBACK_USAGE_MAPPING
key usage 0x0c019F SETTINGS FALLBACK_USAGE_MAPPING
key usage 0x0c01A2 ALL_APPS FALLBACK_USAGE_MAPPING
+key usage 0x0c0201 NEW FALLBACK_USAGE_MAPPING
+key usage 0x0c0203 CLOSE FALLBACK_USAGE_MAPPING
+key usage 0x0c0208 PRINT FALLBACK_USAGE_MAPPING
key usage 0x0c0227 REFRESH FALLBACK_USAGE_MAPPING
+key usage 0x0c0232 FULLSCREEN FALLBACK_USAGE_MAPPING
key usage 0x0c029D LANGUAGE_SWITCH FALLBACK_USAGE_MAPPING
key usage 0x0c029F RECENT_APPS FALLBACK_USAGE_MAPPING
key usage 0x0c02A2 ALL_APPS FALLBACK_USAGE_MAPPING
diff --git a/services/core/java/com/android/server/input/KeyGestureController.java b/services/core/java/com/android/server/input/KeyGestureController.java
index 155ffe8..0124e25 100644
--- a/services/core/java/com/android/server/input/KeyGestureController.java
+++ b/services/core/java/com/android/server/input/KeyGestureController.java
@@ -20,6 +20,7 @@
import static android.content.pm.PackageManager.FEATURE_WATCH;
import static android.view.WindowManagerPolicyConstants.FLAG_INTERACTIVE;
+import static com.android.hardware.input.Flags.enableNew25q2Keycodes;
import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
import static com.android.hardware.input.Flags.useKeyGestureEventHandlerMultiPressGestures;
@@ -750,6 +751,28 @@
}
}
break;
+ case KeyEvent.KEYCODE_LOCK:
+ if (enableNew25q2Keycodes()) {
+ if (firstDown) {
+ handleKeyGesture(deviceId, new int[]{KeyEvent.KEYCODE_LOCK},
+ /* modifierState = */0,
+ KeyGestureEvent.KEY_GESTURE_TYPE_LOCK_SCREEN,
+ KeyGestureEvent.ACTION_GESTURE_COMPLETE, displayId, focusedToken,
+ /* flags = */0, /* appLaunchData = */null);
+ }
+ }
+ return true;
+ case KeyEvent.KEYCODE_FULLSCREEN:
+ if (enableNew25q2Keycodes()) {
+ if (firstDown) {
+ handleKeyGesture(deviceId, new int[]{KeyEvent.KEYCODE_FULLSCREEN},
+ /* modifierState = */0,
+ KeyGestureEvent.KEY_GESTURE_TYPE_MAXIMIZE_FREEFORM_WINDOW,
+ KeyGestureEvent.ACTION_GESTURE_COMPLETE, displayId, focusedToken,
+ /* flags = */0, /* appLaunchData = */null);
+ }
+ }
+ return true;
case KeyEvent.KEYCODE_ASSIST:
Slog.wtf(TAG, "KEYCODE_ASSIST should be handled in interceptKeyBeforeQueueing");
return true;
@@ -764,6 +787,9 @@
Slog.wtf(TAG, "KEYCODE_STYLUS_BUTTON_* should be handled in"
+ " interceptKeyBeforeQueueing");
return true;
+ case KeyEvent.KEYCODE_DO_NOT_DISTURB:
+ // TODO(b/365920375): Implement 25Q2 keycode implementation in system
+ return true;
}
// Handle custom shortcuts
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 19406b4..845798f 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -83,7 +83,7 @@
import static android.view.WindowManagerGlobal.ADD_PERMISSION_DENIED;
import static android.view.contentprotection.flags.Flags.createAccessibilityOverlayAppOpEnabled;
-import static com.android.hardware.input.Flags.emojiAndScreenshotKeycodesAvailable;
+import static com.android.hardware.input.Flags.enableNew25q2Keycodes;
import static com.android.hardware.input.Flags.enableTalkbackAndMagnifierKeyGestures;
import static com.android.hardware.input.Flags.keyboardA11yShortcutControl;
import static com.android.hardware.input.Flags.modifierShortcutDump;
@@ -3993,10 +3993,14 @@
return true;
}
case KeyEvent.KEYCODE_SCREENSHOT:
- if (emojiAndScreenshotKeycodesAvailable() && down && repeatCount == 0) {
+ if (firstDown) {
interceptScreenshotChord(SCREENSHOT_KEY_OTHER, 0 /*pressDelay*/);
}
return true;
+ case KeyEvent.KEYCODE_DO_NOT_DISTURB:
+ case KeyEvent.KEYCODE_LOCK:
+ case KeyEvent.KEYCODE_FULLSCREEN:
+ return true;
}
if (isValidGlobalKey(keyCode)
&& mGlobalKeyManager.handleGlobalKey(mContext, keyCode, event)) {
@@ -5666,9 +5670,23 @@
case KeyEvent.KEYCODE_MACRO_4:
result &= ~ACTION_PASS_TO_USER;
break;
- case KeyEvent.KEYCODE_EMOJI_PICKER:
- if (!emojiAndScreenshotKeycodesAvailable()) {
- // Don't allow EMOJI_PICKER key to be dispatched until flag is released.
+ case KeyEvent.KEYCODE_DICTATE:
+ case KeyEvent.KEYCODE_NEW:
+ case KeyEvent.KEYCODE_CLOSE:
+ case KeyEvent.KEYCODE_PRINT:
+ case KeyEvent.KEYCODE_F13:
+ case KeyEvent.KEYCODE_F14:
+ case KeyEvent.KEYCODE_F15:
+ case KeyEvent.KEYCODE_F16:
+ case KeyEvent.KEYCODE_F17:
+ case KeyEvent.KEYCODE_F18:
+ case KeyEvent.KEYCODE_F19:
+ case KeyEvent.KEYCODE_F20:
+ case KeyEvent.KEYCODE_F21:
+ case KeyEvent.KEYCODE_F22:
+ case KeyEvent.KEYCODE_F23:
+ case KeyEvent.KEYCODE_F24:
+ if (!enableNew25q2Keycodes()) {
result &= ~ACTION_PASS_TO_USER;
}
break;
diff --git a/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java b/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java
index 28ae271..cf5323e 100644
--- a/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java
+++ b/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java
@@ -288,7 +288,6 @@
* Sends a KEYCODE_SCREENSHOT and validates screenshot is taken if flag is enabled
*/
@Test
- @EnableFlags(com.android.hardware.input.Flags.FLAG_EMOJI_AND_SCREENSHOT_KEYCODES_AVAILABLE)
@DisableFlags(com.android.hardware.input.Flags.FLAG_USE_KEY_GESTURE_EVENT_HANDLER)
public void testTakeScreenshot_flagEnabled() {
sendKeyCombination(new int[]{KEYCODE_SCREENSHOT}, 0);
@@ -296,17 +295,6 @@
}
/**
- * Sends a KEYCODE_SCREENSHOT and validates screenshot is not taken if flag is disabled
- */
- @Test
- @DisableFlags({com.android.hardware.input.Flags.FLAG_EMOJI_AND_SCREENSHOT_KEYCODES_AVAILABLE,
- com.android.hardware.input.Flags.FLAG_USE_KEY_GESTURE_EVENT_HANDLER})
- public void testTakeScreenshot_flagDisabled() {
- sendKeyCombination(new int[]{KEYCODE_SCREENSHOT}, 0);
- mPhoneWindowManager.assertTakeScreenshotNotCalled();
- }
-
- /**
* META+CTRL+BACKSPACE for taking a bugreport when the flag is enabled.
*/
@Test
diff --git a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
index 1574d1b..f317939c 100644
--- a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
+++ b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
@@ -995,11 +995,28 @@
intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE),
AppLaunchData.createLaunchDataForCategory(Intent.CATEGORY_APP_CALCULATOR)
),
+ TestData(
+ "LOCK -> Lock Screen",
+ intArrayOf(KeyEvent.KEYCODE_LOCK),
+ KeyGestureEvent.KEY_GESTURE_TYPE_LOCK_SCREEN,
+ intArrayOf(KeyEvent.KEYCODE_LOCK),
+ 0,
+ intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
+ ),
+ TestData(
+ "FULLSCREEN -> Maximizes a task to fit the screen",
+ intArrayOf(KeyEvent.KEYCODE_FULLSCREEN),
+ KeyGestureEvent.KEY_GESTURE_TYPE_MAXIMIZE_FREEFORM_WINDOW,
+ intArrayOf(KeyEvent.KEYCODE_FULLSCREEN),
+ 0,
+ intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
+ ),
)
}
@Test
@Parameters(method = "systemKeysTestArguments")
+ @EnableFlags(com.android.hardware.input.Flags.FLAG_ENABLE_NEW_25Q2_KEYCODES)
fun testSystemKeys(test: TestData) {
setupKeyGestureController()
testKeyGestureInternal(test)
@@ -1029,6 +1046,9 @@
KeyEvent.KEYCODE_STYLUS_BUTTON_SECONDARY,
KeyEvent.KEYCODE_STYLUS_BUTTON_TERTIARY,
KeyEvent.KEYCODE_STYLUS_BUTTON_TAIL,
+ KeyEvent.KEYCODE_DO_NOT_DISTURB,
+ KeyEvent.KEYCODE_LOCK,
+ KeyEvent.KEYCODE_FULLSCREEN
)
val handler = KeyGestureHandler { _, _ -> false }