Merge "Add direct keys to launch applications."

This commit is contained in:
Treehugger Robot
2021-11-11 20:15:37 +00:00
committed by Gerrit Code Review
5 changed files with 105 additions and 3 deletions

View File

@@ -47544,6 +47544,10 @@ package android.view {
field public static final int KEYCODE_CUT = 277; // 0x115 field public static final int KEYCODE_CUT = 277; // 0x115
field public static final int KEYCODE_D = 32; // 0x20 field public static final int KEYCODE_D = 32; // 0x20
field public static final int KEYCODE_DEL = 67; // 0x43 field public static final int KEYCODE_DEL = 67; // 0x43
field public static final int KEYCODE_DEMO_APP_1 = 301; // 0x12d
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 public static final int KEYCODE_DPAD_CENTER = 23; // 0x17 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 = 20; // 0x14
field public static final int KEYCODE_DPAD_DOWN_LEFT = 269; // 0x10d field public static final int KEYCODE_DPAD_DOWN_LEFT = 269; // 0x10d
@@ -47575,6 +47579,10 @@ package android.view {
field public static final int KEYCODE_F7 = 137; // 0x89 field public static final int KEYCODE_F7 = 137; // 0x89
field public static final int KEYCODE_F8 = 138; // 0x8a field public static final int KEYCODE_F8 = 138; // 0x8a
field public static final int KEYCODE_F9 = 139; // 0x8b field public static final int KEYCODE_F9 = 139; // 0x8b
field public static final int KEYCODE_FEATURED_APP_1 = 297; // 0x129
field public static final int KEYCODE_FEATURED_APP_2 = 298; // 0x12a
field public static final int KEYCODE_FEATURED_APP_3 = 299; // 0x12b
field public static final int KEYCODE_FEATURED_APP_4 = 300; // 0x12c
field public static final int KEYCODE_FOCUS = 80; // 0x50 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 = 125; // 0x7d
field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70 field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70
@@ -47740,6 +47748,14 @@ package android.view {
field public static final int KEYCODE_U = 49; // 0x31 field public static final int KEYCODE_U = 49; // 0x31
field public static final int KEYCODE_UNKNOWN = 0; // 0x0 field public static final int KEYCODE_UNKNOWN = 0; // 0x0
field public static final int KEYCODE_V = 50; // 0x32 field public static final int KEYCODE_V = 50; // 0x32
field public static final int KEYCODE_VIDEO_APP_1 = 289; // 0x121
field public static final int KEYCODE_VIDEO_APP_2 = 290; // 0x122
field public static final int KEYCODE_VIDEO_APP_3 = 291; // 0x123
field public static final int KEYCODE_VIDEO_APP_4 = 292; // 0x124
field public static final int KEYCODE_VIDEO_APP_5 = 293; // 0x125
field public static final int KEYCODE_VIDEO_APP_6 = 294; // 0x126
field public static final int KEYCODE_VIDEO_APP_7 = 295; // 0x127
field public static final int KEYCODE_VIDEO_APP_8 = 296; // 0x128
field public static final int KEYCODE_VOICE_ASSIST = 231; // 0xe7 field public static final int KEYCODE_VOICE_ASSIST = 231; // 0xe7
field public static final int KEYCODE_VOLUME_DOWN = 25; // 0x19 field public static final int KEYCODE_VOLUME_DOWN = 25; // 0x19
field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4 field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4

View File

@@ -2748,7 +2748,7 @@ package android.view {
method public static String actionToString(int); method public static String actionToString(int);
method public final void setDisplayId(int); method public final void setDisplayId(int);
field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800 field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
field public static final int LAST_KEYCODE = 288; // 0x120 field public static final int LAST_KEYCODE = 304; // 0x130
} }
public final class KeyboardShortcutGroup implements android.os.Parcelable { public final class KeyboardShortcutGroup implements android.os.Parcelable {

View File

@@ -830,13 +830,45 @@ public class KeyEvent extends InputEvent implements Parcelable {
* consuming content. May be consumed by system to set account globally. * consuming content. May be consumed by system to set account globally.
*/ */
public static final int KEYCODE_PROFILE_SWITCH = 288; public static final int KEYCODE_PROFILE_SWITCH = 288;
/** Key code constant: Video Application key #1. */
public static final int KEYCODE_VIDEO_APP_1 = 289;
/** Key code constant: Video Application key #2. */
public static final int KEYCODE_VIDEO_APP_2 = 290;
/** Key code constant: Video Application key #3. */
public static final int KEYCODE_VIDEO_APP_3 = 291;
/** Key code constant: Video Application key #4. */
public static final int KEYCODE_VIDEO_APP_4 = 292;
/** Key code constant: Video Application key #5. */
public static final int KEYCODE_VIDEO_APP_5 = 293;
/** Key code constant: Video Application key #6. */
public static final int KEYCODE_VIDEO_APP_6 = 294;
/** Key code constant: Video Application key #7. */
public static final int KEYCODE_VIDEO_APP_7 = 295;
/** Key code constant: Video Application key #8. */
public static final int KEYCODE_VIDEO_APP_8 = 296;
/** Key code constant: Featured Application key #1. */
public static final int KEYCODE_FEATURED_APP_1 = 297;
/** Key code constant: Featured Application key #2. */
public static final int KEYCODE_FEATURED_APP_2 = 298;
/** Key code constant: Featured Application key #3. */
public static final int KEYCODE_FEATURED_APP_3 = 299;
/** Key code constant: Featured Application key #4. */
public static final int KEYCODE_FEATURED_APP_4 = 300;
/** Key code constant: Demo Application key #1. */
public static final int KEYCODE_DEMO_APP_1 = 301;
/** Key code constant: Demo Application key #2. */
public static final int KEYCODE_DEMO_APP_2 = 302;
/** Key code constant: Demo Application key #3. */
public static final int KEYCODE_DEMO_APP_3 = 303;
/** Key code constant: Demo Application key #4. */
public static final int KEYCODE_DEMO_APP_4 = 304;
/** /**
* Integer value of the last KEYCODE. Increases as new keycodes are added to KeyEvent. * Integer value of the last KEYCODE. Increases as new keycodes are added to KeyEvent.
* @hide * @hide
*/ */
@TestApi @TestApi
public static final int LAST_KEYCODE = KEYCODE_PROFILE_SWITCH; public static final int LAST_KEYCODE = KEYCODE_DEMO_APP_4;
// NOTE: If you add a new keycode here you must also add it to: // NOTE: If you add a new keycode here you must also add it to:
// isSystem() // isSystem()

View File

@@ -1984,6 +1984,22 @@
<enum name="KEYCODE_THUMBS_UP" value="286" /> <enum name="KEYCODE_THUMBS_UP" value="286" />
<enum name="KEYCODE_THUMBS_DOWN" value="287" /> <enum name="KEYCODE_THUMBS_DOWN" value="287" />
<enum name="KEYCODE_PROFILE_SWITCH" value="288" /> <enum name="KEYCODE_PROFILE_SWITCH" value="288" />
<enum name="KEYCODE_VIDEO_APP_1" value="289" />
<enum name="KEYCODE_VIDEO_APP_2" value="290" />
<enum name="KEYCODE_VIDEO_APP_3" value="291" />
<enum name="KEYCODE_VIDEO_APP_4" value="292" />
<enum name="KEYCODE_VIDEO_APP_5" value="293" />
<enum name="KEYCODE_VIDEO_APP_6" value="294" />
<enum name="KEYCODE_VIDEO_APP_7" value="295" />
<enum name="KEYCODE_VIDEO_APP_8" value="296" />
<enum name="KEYCODE_FEATURED_APP_1" value="297" />
<enum name="KEYCODE_FEATURED_APP_2" value="298" />
<enum name="KEYCODE_FEATURED_APP_3" value="299" />
<enum name="KEYCODE_FEATURED_APP_4" value="300" />
<enum name="KEYCODE_DEMO_APP_1" value="301" />
<enum name="KEYCODE_DEMO_APP_2" value="302" />
<enum name="KEYCODE_DEMO_APP_3" value="303" />
<enum name="KEYCODE_DEMO_APP_4" value="304" />
</attr> </attr>
<!-- ***************************************************************** --> <!-- ***************************************************************** -->

View File

@@ -2666,6 +2666,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
Slog.wtf(TAG, "KEYCODE_VOICE_ASSIST should be handled in" Slog.wtf(TAG, "KEYCODE_VOICE_ASSIST should be handled in"
+ " interceptKeyBeforeQueueing"); + " interceptKeyBeforeQueueing");
return key_consumed; return key_consumed;
case KeyEvent.KEYCODE_VIDEO_APP_1:
case KeyEvent.KEYCODE_VIDEO_APP_2:
case KeyEvent.KEYCODE_VIDEO_APP_3:
case KeyEvent.KEYCODE_VIDEO_APP_4:
case KeyEvent.KEYCODE_VIDEO_APP_5:
case KeyEvent.KEYCODE_VIDEO_APP_6:
case KeyEvent.KEYCODE_VIDEO_APP_7:
case KeyEvent.KEYCODE_VIDEO_APP_8:
case KeyEvent.KEYCODE_FEATURED_APP_1:
case KeyEvent.KEYCODE_FEATURED_APP_2:
case KeyEvent.KEYCODE_FEATURED_APP_3:
case KeyEvent.KEYCODE_FEATURED_APP_4:
case KeyEvent.KEYCODE_DEMO_APP_1:
case KeyEvent.KEYCODE_DEMO_APP_2:
case KeyEvent.KEYCODE_DEMO_APP_3:
case KeyEvent.KEYCODE_DEMO_APP_4:
Slog.wtf(TAG, "KEYCODE_APP_X should be handled in interceptKeyBeforeQueueing");
return key_consumed;
case KeyEvent.KEYCODE_SYSRQ: case KeyEvent.KEYCODE_SYSRQ:
if (down && repeatCount == 0) { if (down && repeatCount == 0) {
mScreenshotRunnable.setScreenshotType(TAKE_SCREENSHOT_FULLSCREEN); mScreenshotRunnable.setScreenshotType(TAKE_SCREENSHOT_FULLSCREEN);
@@ -3773,6 +3791,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} }
break; break;
} }
case KeyEvent.KEYCODE_VIDEO_APP_1:
case KeyEvent.KEYCODE_VIDEO_APP_2:
case KeyEvent.KEYCODE_VIDEO_APP_3:
case KeyEvent.KEYCODE_VIDEO_APP_4:
case KeyEvent.KEYCODE_VIDEO_APP_5:
case KeyEvent.KEYCODE_VIDEO_APP_6:
case KeyEvent.KEYCODE_VIDEO_APP_7:
case KeyEvent.KEYCODE_VIDEO_APP_8:
case KeyEvent.KEYCODE_FEATURED_APP_1:
case KeyEvent.KEYCODE_FEATURED_APP_2:
case KeyEvent.KEYCODE_FEATURED_APP_3:
case KeyEvent.KEYCODE_FEATURED_APP_4:
case KeyEvent.KEYCODE_DEMO_APP_1:
case KeyEvent.KEYCODE_DEMO_APP_2:
case KeyEvent.KEYCODE_DEMO_APP_3:
case KeyEvent.KEYCODE_DEMO_APP_4: {
// Just drop if keys are not intercepted for direct key.
result &= ~ACTION_PASS_TO_USER;
break;
}
} }
// Intercept the Accessibility keychord (CTRL + ALT + Z) for keyboard users. // Intercept the Accessibility keychord (CTRL + ALT + Z) for keyboard users.