diff options
| author | 2021-11-11 20:15:37 +0000 | |
|---|---|---|
| committer | 2021-11-11 20:15:37 +0000 | |
| commit | d76da0b633cac2e714e5e3abccdfcf445c2263a9 (patch) | |
| tree | 1c21d8b4267aff7e38a20c5df0387a32d27cf8d6 | |
| parent | f064ef4e1760ee28197be0c06d5eb2c5b1069981 (diff) | |
| parent | 11e61ab1fd1f868ee8ddd6fc86662f4f09df1a6a (diff) | |
Merge "Add direct keys to launch applications."
| -rw-r--r-- | core/api/current.txt | 16 | ||||
| -rw-r--r-- | core/api/test-current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/view/KeyEvent.java | 38 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 16 | ||||
| -rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 38 |
5 files changed, 106 insertions, 4 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index de4694a086f0..f21518c7f83d 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -47544,6 +47544,10 @@ package android.view { field public static final int KEYCODE_CUT = 277; // 0x115 field public static final int KEYCODE_D = 32; // 0x20 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_DOWN = 20; // 0x14 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_F8 = 138; // 0x8a 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_FORWARD = 125; // 0x7d 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_UNKNOWN = 0; // 0x0 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_VOLUME_DOWN = 25; // 0x19 field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4 diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 6ccdf9185517..d0e659bf36e9 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -2748,7 +2748,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 = 288; // 0x120 + field public static final int LAST_KEYCODE = 304; // 0x130 } public final class KeyboardShortcutGroup implements android.os.Parcelable { diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index cda9b233576c..ba6f4eb7e598 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -830,13 +830,45 @@ public class KeyEvent extends InputEvent implements Parcelable { * consuming content. May be consumed by system to set account globally. */ 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. * @hide */ @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: // isSystem() diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a5f505176d5d..dc92e10abf0d 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1984,6 +1984,22 @@ <enum name="KEYCODE_THUMBS_UP" value="286" /> <enum name="KEYCODE_THUMBS_DOWN" value="287" /> <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> <!-- ***************************************************************** --> diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index e40882268e67..4a9772093bb7 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2666,6 +2666,24 @@ public class PhoneWindowManager implements WindowManagerPolicy { Slog.wtf(TAG, "KEYCODE_VOICE_ASSIST should be handled in" + " interceptKeyBeforeQueueing"); 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: if (down && repeatCount == 0) { mScreenshotRunnable.setScreenshotType(TAKE_SCREENSHOT_FULLSCREEN); @@ -3773,6 +3791,26 @@ public class PhoneWindowManager implements WindowManagerPolicy { } 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. |