Android HID device (keyboard, remote control, etc.) function implementation process and key-value mapping relationship

 HID (Human Interface Device) is a commonly used device type in USB devices . It is a USB device that directly interacts with humans, such as keyboard, remote control, mouse, and joystick. Among USB devices, HID devices cost less.

    The previous article  Android Keyboard (Remote Control) Key Value Definitions  compiled the definitions of various function keys in Android. So what is the process from keyboard keys to Android device control taking effect?

Keyboard operation implementation process on Android devices:

  1. EventHub The raw events are read from  evdev the driver and the Linux key codes (sometimes called scan codes) are mapped into Android key codes using the keyboard's key layout mapping.

  2. InputReader The original event will be consumed and the meta key state will be updated. For example, if you press or release the left Shift key, the reader sets or resets the  META_SHIFT_LEFT_ON bits  accordingly META_SHIFT_ON .

  3. InputReaderInputDispatcher Notifications related to key events  will be sent to  .

  4. InputDispatcherWindowManagerPolicy.interceptKeyBeforeQueueing Ask  WindowManagerPolicy how to handle key events  by calling  . This method (responsible for waking the device when certain keys are pressed) is part of the critical path. In effect, EventHub the wake lock is held on this critical path, ensuring that it runs to completion.

  5. If it is currently in use  InputFilterInputDispatcher it will be given the opportunity to consume or convert keystrokes. InputFilter Can be used to implement low-level, system-wide accessibility policies.

  6. InputDispatcher Keystrokes can be queued for processing on the dispatch thread.

  7. When  InputDispatcher a key is removed from the queue, it gives   another chance to intercept the key event WindowManagerPolicy.interceptKeyBeforeDispatching by  calling WindowManagerPolicyThis method can be used to handle system shortcuts and other features.

  8. Then, InputDispatcher the key event target (the focused window) is identified and waits for the key event target to be ready. Next, InputDispatcher the key event is sent to the app.

  9. Within the app, key events are passed down the view hierarchy to the focused view for IME key preassignment.

  10. If the key event is not processed in the IME key pre-assignment phase and an IME is in use, the key event will be sent to the IME.

  11. If the key event is not consumed by the IME, the key event is passed down the view hierarchy to the focused view, allowing standard key assignment.

  12. The application in turn reports back to  InputDispatcher the application whether the key event was used. If the event is not used, InputDispatcher it is called  WindowManagerPolicy.dispatchUnhandledKey to apply "fallback" behavior. Depending on the rollback operation, the key event distribution cycle can be restarted with a different key code. For example, if the app doesn't handle it  KEYCODE_ESCAPE, the system might instead treat the key event as  KEYCODE_BACK a reassignment.

HID usage is represented by two code values, which represent the key type and key value respectively. For example, 0x07 represents the key type as a function key , and 0x0001 represents the key value. Take USB remote control as an example :

Common key categories are as follows:

  1. Control Key:

    • Code value 0x01: Ctrl key
  2. Modifier Key:

    • Code value 0x02: Shift key
    • Code value 0x03: Alt key
    • Code value 0x04: GUI key (for example, Windows key or Command key)
    • Code value 0x05: Caps Lock key
    • Code value 0x06: Num Lock key
  3. Navigation Key:

    • Code value 0x08: up arrow
    • Code value 0x09: down arrow
    • Code value 0x0A: right arrow
    • Code value 0x0B: left arrow
    • Code value 0x0C: Home key
    • Code value 0x0D: end key
    • Code value 0x0E: key on page
    • Code value 0x0F: page down button
  4. Function Key:

    • Code value 0x07: usually represents a function key, but there can also be code values ​​for other custom function keys.
HID usage, Linux keycodes, and Android keycodes

The LKC column specifies Linux key codes in hexadecimal format.

The AKC column specifies Android key codes in hexadecimal format.

HID usage HID usage name LKC Linux key code name Version AKC Android key code name Remark
0x07 0x0001 Keyboard bugs, anti-ghosting
0x07 0x0002 Keyboard POST failed
0x07 0x0003 keyboard error undefined
0x07 0x0004 Keyboard a and A keys 0x001e KEY_A 1.6 0x001d KEYCODE_A 1
0x07 0x0005 Keyboard b and B keys 0x0030 KEY_B 1.6 0x001e KEYCODE_B 1
0x07 0x0006 Keyboard c and C keys 0x002e KEY_C 1.6 0x001f KEYCODE_C 1
0x07 0x0007 Keyboard d and D keys 0x0020 KEY_D 1.6 0x0020 KEYCODE_D 1
0x07 0x0008 Keyboard e and E keys 0x0012 KEY_E 1.6 0x0021 KEYCODE_E 1
0x07 0x0009 Keyboard f and F keys 0x0021 KEY_F 1.6 0x0022 KEYCODE_F 1
0x07 0x000a Keyboard g and G keys 0x0022 KEY_G 1.6 0x0023 KEYCODE_G 1
0x07 0x000b Keyboard h and H keys 0x0023 KEY_H 1.6 0x0024 KEYCODE_H 1
0x07 0x000c Keyboard i and I keys 0x0017 KEY_I 1.6 0x0025 KEYCODE_I 1
0x07 0x000d Keyboard j and J keys 0x0024 KEY_J 1.6 0x0026 KEYCODE_J 1
0x07 0x000e Keyboard k and K keys 0x0025 KEY_K 1.6 0x0027 KEYCODE_K 1
0x07 0x000f Keyboard l and L keys 0x0026 KEY_L 1.6 0x0028 KEYCODE_L 1
0x07 0x0010 Keyboard m and M keys 0x0032 KEY_M 1.6 0x0029 KEYCODE_M 1
0x07 0x0011 Keyboard n and N keys 0x0031 KEY_N 1.6 0x002a KEYCODE_N 1
0x07 0x0012 Keyboard o and O keys 0x0018 KEY_O 1.6 0x002b KEYCODE_O 1
0x07 0x0013 Keyboard p and P keys 0x0019 KEY_P 1.6 0x002c KEYCODE_P 1
0x07 0x0014 Keyboard q and Q keys 0x0010 KEY_Q 1.6 0x002d KEYCODE_Q 1
0x07 0x0015 Keyboard r and R keys 0x0013 KEY_R 1.6 0x002e KEYCODE_R 1
0x07 0x0016 Keyboard s and S keys 0x001f KEY_S 1.6 0x002f KEYCODE_S 1
0x07 0x0017 Keyboard t and T keys 0x0014 KEY_T 1.6 0x0030 KEYCODE_T 1
0x07 0x0018 Keyboard u and U keys 0x0016 KEY_U 1.6 0x0031 KEYCODE_U 1
0x07 0x0019 Keyboard v and V keys 0x002f KEY_V 1.6 0x0032 KEYCODE_V 1
0x07 0x001a Keyboard w and W keys 0x0011 KEY_W 1.6 0x0033 KEYCODE_W 1
0x07 0x001b Keyboard x and X keys 0x002d KEY_X 1.6 0x0034 KEYCODE_X 1
0x07 0x001c 键盘 y 和 Y 键 0x0015 KEY_Y 1.6 0x0035 KEYCODE_Y 1
0x07 0x001d 键盘 z 和 Z 键 0x002c KEY_Z 1.6 0x0036 KEYCODE_Z 1
0x07 0x001e 键盘 1 和 ! 键 0x0002 KEY_1 1.6 0x0008 KEYCODE_1 1
0x07 0x001f 键盘 2 和 @ 键 0x0003 KEY_2 1.6 0x0009 KEYCODE_2 1
0x07 0x0020 键盘 3 和 # 键 0x0004 KEY_3 1.6 0x000a KEYCODE_3 1
0x07 0x0021 键盘 4 和 $ 键 0x0005 KEY_4 1.6 0x000b KEYCODE_4 1
0x07 0x0022 键盘 5 和 % 键 0x0006 KEY_5 1.6 0x000c KEYCODE_5 1
0x07 0x0023 键盘 6 和 ^ 键 0x0007 KEY_6 1.6 0x000d KEYCODE_6 1
0x07 0x0024 键盘 7 和 & 键 0x0008 KEY_7 1.6 0x000e KEYCODE_7 1
0x07 0x0025 键盘 8 和 * 键 0x0009 KEY_8 1.6 0x000f KEYCODE_8 1
0x07 0x0026 键盘 9 和 ( 键 0x000a KEY_9 1.6 0x0010 KEYCODE_9 1
0x07 0x0027 键盘 0 和 ) 键 0x000b KEY_0 1.6 0x0007 KEYCODE_0 1
0x07 0x0028 键盘返回 (Enter) 键 0x001c KEY_ENTER 1.6 0x0042 KEYCODE_ENTER 1
0x07 0x0029 键盘 Esc 键 0x0001 KEY_ESC 3.0 0x006f KEYCODE_ESCAPE
"" "" "" "" 2.3 0x0004 KEYCODE_BACK
0x07 0x002a 键盘删除 (Backspace) 键 0x000e KEY_BACKSPACE 1.6 0x0043 KEYCODE_DEL
0x07 0x002b 键盘 Tab 键 0x000f KEY_TAB 1.6 0x003d KEYCODE_TAB
0x07 0x002c 键盘空格键 0x0039 KEY_SPACE 1.6 0x003e KEYCODE_SPACE
0x07 0x002d 键盘 - 和 _ 键 0x000c KEY_MINUS 1.6 0x0045 KEYCODE_MINUS 1
0x07 0x002e 键盘 = 和 + 键 0x000d KEY_EQUAL 1.6 0x0046 KEYCODE_EQUALS 1
0x07 0x002f 键盘 [ 和 { 键 0x001a KEY_LEFTBRACE 1.6 0x0047 KEYCODE_LEFT_BRACKET 1
0x07 0x0030 键盘 ] 和 } 键 0x001b KEY_RIGHTBRACE 1.6 0x0048 KEYCODE_RIGHT_BRACKET 1
0x07 0x0031 键盘 \ 和 | 键 0x002b KEY_BACKSLASH 1.6 0x0049 KEYCODE_BACKSLASH 1
0x07 0x0032 键盘非美式 # 和 ~ 键 0x002b KEY_BACKSLASH 1.6 0x0049 KEYCODE_BACKSLASH 1
0x07 0x0033 键盘 ; 和 : 键 0x0027 KEY_SEMICOLON 1.6 0x004a KEYCODE_SEMICOLON 1
0x07 0x0034 键盘 ' 和 " 键 0x0028 KEY_APOSTROPHE 1.6 0x004b KEYCODE_APOSTROPHE 1
0x07 0x0035 键盘 ` 和 ~ 键 0x0029 KEY_GRAVE 3.0 0x0044 KEYCODE_GRAVE 1
0x07 0x0036 键盘 , 和 < 键 0x0033 KEY_COMMA 1.6 0x0037 KEYCODE_COMMA 1
0x07 0x0037 键盘 . 和 > 键 0x0034 KEY_DOT 1.6 0x0038 KEYCODE_PERIOD 1
0x07 0x0038 键盘 / 和 ? 键 0x0035 KEY_SLASH 1.6 0x004c KEYCODE_SLASH 1
0x07 0x0039 键盘 Caps Lock 键 0x003a KEY_CAPSLOCK 3.0 0x0073 KEYCODE_CAPS_LOCK
0x07 0x003a 键盘 F1 键 0x003b KEY_F1 3.0 0x0083 KEYCODE_F1
"" "" "" "" 1.6 0x0052 KEYCODE_MENU
0x07 0x003b 键盘 F2 键 0x003c KEY_F2 3.0 0x0084 KEYCODE_F2
"" "" "" "" 1.6 0x0002 KEYCODE_SOFT_RIGHT
0x07 0x003c 键盘 F3 键 0x003d KEY_F3 3.0 0x0085 KEYCODE_F3
"" "" "" "" 1.6 0x0005 KEYCODE_CALL
0x07 0x003d 键盘 F4 键 0x003e KEY_F4 3.0 0x0086 KEYCODE_F4
"" "" "" "" 1.6 0x0006 KEYCODE_ENDCALL
0x07 0x003e 键盘 F5 键 0x003f KEY_F5 3.0 0x0087 KEYCODE_F5
0x07 0x003f 键盘 F6 键 0x0040 KEY_F6 3.0 0x0088 KEYCODE_F6
0x07 0x0040 键盘 F7 键 0x0041 KEY_F7 3.0 0x0089 KEYCODE_F7
0x07 0x0041 键盘 F8 键 0x0042 KEY_F8 3.0 0x008a KEYCODE_F8
0x07 0x0042 键盘 F9 键 0x0043 KEY_F9 3.0 0x008b KEYCODE_F9
0x07 0x0043 键盘 F10 键 0x0044 KEY_F10 3.0 0x008c KEYCODE_F10
"" "" "" "" 2.3 0x0052 KEYCODE_MENU
0x07 0x0044 键盘 F11 键 0x0057 KEY_F11 3.0 0x008d KEYCODE_F11
0x07 0x0045 键盘 F12 键 0x0058 KEY_F12 3.0 0x008e KEYCODE_F12
0x07 0x0046 键盘 Print Screen 键 0x0063 KEY_SYSRQ 3.0 0x0078 KEYCODE_SYSRQ
0x07 0x0047 键盘 Scroll Lock 键 0x0046 KEY_SCROLLLOCK 3.0 0x0074 KEYCODE_SCROLL_LOCK
0x07 0x0048 键盘 Pause 键 0x0077 KEY_PAUSE 3.0 0x0079 KEYCODE_BREAK
0x07 0x0049 键盘 Insert 键 0x006e KEY_INSERT 3.0 0x007c KEYCODE_INSERT
0x07 0x004a 键盘 Home 键 0x0066 KEY_HOME 3.0 0x007a KEYCODE_MOVE_HOME
"" "" "" "" 1.6 0x0003 KEYCODE_HOME
0x07 0x004b 键盘 Page Up 键 0x0068 KEY_PAGEUP 3.0 0x005c KEYCODE_PAGE_UP
0x07 0x004c 键盘 Delete Forward 键 0x006f KEY_DELETE 3.0 0x0070 KEYCODE_FORWARD_DEL
0x07 0x004d 键盘 End 键 0x006b KEY_END 3.0 0x007b KEYCODE_MOVE_END
"" "" "" "" 1.6 0x0006 KEYCODE_ENDCALL
0x07 0x004e 键盘 Page Down 键 0x006d KEY_PAGEDOWN 3.0 0x005d KEYCODE_PAGE_DOWN
0x07 0x004f 键盘向右箭头键 0x006a KEY_RIGHT 1.6 0x0016 KEYCODE_DPAD_RIGHT
0x07 0x0050 键盘向左箭头键 0x0069 KEY_LEFT 1.6 0x0015 KEYCODE_DPAD_LEFT
0x07 0x0051 键盘向下箭头键 0x006c KEY_DOWN 1.6 0x0014 KEYCODE_DPAD_DOWN
0x07 0x0052 键盘向上箭头键 0x0067 KEY_UP 1.6 0x0013 KEYCODE_DPAD_UP
0x07 0x0053 键盘 Num Lock 和 Clear 键 0x0045 KEY_NUMLOCK 3.0 0x008f KEYCODE_NUM_LOCK
0x07 0x0054 小键盘 / 键 0x0062 KEY_KPSLASH 3.0 0x009a KEYCODE_NUMPAD_DIVIDE
0x07 0x0055 小键盘 * 键 0x0037 KEY_KPASTERISK 3.0 0x009b KEYCODE_NUMPAD_MULTIPLY
0x07 0x0056 小键盘 - 键 0x004a KEY_KPMINUS 3.0 0x009c KEYCODE_NUMPAD_SUBTRACT
0x07 0x0057 小键盘 + 键 0x004e KEY_KPPLUS 3.0 0x009d KEYCODE_NUMPAD_ADD
0x07 0x0058 小键盘 Enter 键 0x0060 KEY_KPENTER 3.0 0x00a0 KEYCODE_NUMPAD_ENTER
0x07 0x0059 小键盘 1 和 End 键 0x004f KEY_KP1 3.0 0x0091 KEYCODE_NUMPAD_1
0x07 0x005a 小键盘 2 和向下箭头键 0x0050 KEY_KP2 3.0 0x0092 KEYCODE_NUMPAD_2
0x07 0x005b 小键盘 3 和 PageDn 键 0x0051 KEY_KP3 3.0 0x0093 KEYCODE_NUMPAD_3
0x07 0x005c 小键盘 4 和向左箭头键 0x004b KEY_KP4 3.0 0x0094 KEYCODE_NUMPAD_4
0x07 0x005d 小键盘 5 键 0x004c KEY_KP5 3.0 0x0095 KEYCODE_NUMPAD_5
0x07 0x005e 小键盘 6 和向右箭头键 0x004d KEY_KP6 3.0 0x0096 KEYCODE_NUMPAD_6
0x07 0x005f 小键盘 7 和 Home 键 0x0047 KEY_KP7 3.0 0x0097 KEYCODE_NUMPAD_7
0x07 0x0060 小键盘 8 和向上箭头键 0x0048 KEY_KP8 3.0 0x0098 KEYCODE_NUMPAD_8
0x07 0x0061 小键盘 9 和 Page Up 键 0x0049 KEY_KP9 3.0 0x0099 KEYCODE_NUMPAD_9
0x07 0x0062 小键盘 0 和 Insert 键 0x0052 KEY_KP0 3.0 0x0090 KEYCODE_NUMPAD_0
0x07 0x0063 小键盘 . 键(删除键) 0x0053 KEY_KPDOT 3.0 0x009e KEYCODE_NUMPAD_DOT
0x07 0x0064 键盘 Non-US \ 和 | 键 0x0056 KEY_102ND 4.0 0x0049 KEYCODE_BACKSLASH 1
0x07 0x0065 键盘应用键 0x007f KEY_COMPOSE 3.0 0x0052 KEYCODE_MENU
"" "" "" "" 1.6 0x0054 KEYCODE_SEARCH
0x07 0x0066 键盘 Power 键 0x0074 KEY_POWER 1.6 0x001a KEYCODE_POWER
0x07 0x0067 小键盘 = 键 0x0075 KEY_KPEQUAL 3.0 0x00a1 KEYCODE_NUMPAD_EQUALS
0x07 0x0068 键盘 F13 键 0x00b7 KEY_F13
0x07 0x0069 键盘 F14 键 0x00b8 KEY_F14
0x07 0x006a 键盘 F15 键 0x00b9 KEY_F15
0x07 0x006b 键盘 F16 键 0x00ba KEY_F16
0x07 0x006c 键盘 F17 键 0x00bb KEY_F17
0x07 0x006d 键盘 F18 键 0x00bc KEY_F18
0x07 0x006e 键盘 F19 键 0x00bd KEY_F19
0x07 0x006f 键盘 F20 键 0x00be KEY_F20
0x07 0x0070 键盘 F21 键 0x00bf KEY_F21
0x07 0x0071 键盘 F22 键 0x00c0 KEY_F22
0x07 0x0072 键盘 F23 键 0x00c1 KEY_F23
0x07 0x0073 键盘 F24 键 0x00c2 KEY_F24
0x07 0x0074 键盘 Execute 键 0x0086 KEY_OPEN
0x07 0x0075 键盘帮助键 0x008a KEY_HELP
0x07 0x0076 键盘菜单键 0x0082 KEY_PROPS
0x07 0x0077 键盘 Select 键 0x0084 KEY_FRONT
0x07 0x0078 键盘 Stop 键 0x0080 KEY_STOP 3.0 0x0056 KEYCODE_MEDIA_STOP
0x07 0x0079 键盘 Again 键 0x0081 KEY_AGAIN
0x07 0x007a 键盘 Undo 键 0x0083 KEY_UNDO
0x07 0x007b 键盘 Cut 键 0x0089 KEY_CUT
0x07 0x007c 键盘 Copy 键 0x0085 KEY_COPY
0x07 0x007d 键盘 Paste 键 0x0087 KEY_PASTE
0x07 0x007e 键盘 Find 键 0x0088 KEY_FIND
0x07 0x007f 键盘 Mute 键 0x0071 KEY_MUTE 3.0 0x00a4 KEYCODE_VOLUME_MUTE
0x07 0x0080 键盘音量调高键 0x0073 KEY_VOLUMEUP 1.6 0x0018 KEYCODE_VOLUME_UP
0x07 0x0081 键盘音量调低键 0x0072 KEY_VOLUMEDOWN 1.6 0x0019 KEYCODE_VOLUME_DOWN
0x07 0x0082 键盘锁定 Caps Lock 键
0x07 0x0083 键盘锁定 Num Lock 键
0x07 0x0084 键盘锁定 Scroll Lock 键
0x07 0x0085 小键盘逗号键 0x0079 KEY_KPCOMMA 3.0 0x009f KEYCODE_NUMPAD_COMMA
0x07 0x0086 小键盘等号键
0x07 0x0087 键盘 International1 0x0059 KEY_RO
0x07 0x0088 键盘 International2 0x005d KEY_KATAKANAHIRAGANA
0x07 0x0089 键盘 International3 0x007c KEY_YEN
0x07 0x008a 键盘 International4 0x005c KEY_HENKAN
0x07 0x008b 键盘 International5 0x005e KEY_MUHENKAN
0x07 0x008c 键盘 International6 0x005f KEY_KPJPCOMMA
0x07 0x008d 键盘 International7
0x07 0x008e 键盘 International8
0x07 0x008f 键盘 International9
0x07 0x0090 键盘 LANG1 0x007a KEY_HANGEUL
0x07 0x0091 键盘 LANG2 0x007b KEY_HANJA
0x07 0x0092 键盘 LANG3 0x005a KEY_KATAKANA
0x07 0x0093 键盘 LANG4 0x005b KEY_HIRAGANA
0x07 0x0094 键盘 LANG5 0x0055 KEY_ZENKAKUHANKAKU
0x07 0x0095 键盘 LANG6
0x07 0x0096 键盘 LANG7
0x07 0x0097 键盘 LANG8
0x07 0x0098 键盘 LANG9
0x07 0x0099 键盘 Alternate Erase 键
0x07 0x009a Keyboard SysReq/Attention key
0x07 0x009b Keyboard Cancel key
0x07 0x009c Keyboard Clear key
0x07 0x009d Keyboard Prior key
0x07 0x009e Keyboard Return key
0x07 0x009f Keyboard Separator key
0x07 0x00a0 Keyboard Out key
0x07 0x00a1 Keyboard Opera key
0x07 0x00a2 Keyboard Clear/Again key
0x07 0x00a3 Keyboard CrSel/Props keys
0x07 0x00a4 Keyboard ExSel keys
0x07 0x00b0 Numpad 00
0x07 0x00b1 Numpad 000
0x07 0x00b2 thousands separator
0x07 0x00b3 decimal separator
0x07 0x00b4 Currency Unit
0x07 0x00b5 currency subunit
0x07 0x00b6 numpad (key 0x00b3 KEY_KPLEFTPAREN 3.0 0x00a2 KEYCODE_NUMPAD_LEFT_PAREN
0x07 0x00b7 numpad) keys 0x00b4 KEY_KPRIGHTPAREN 3.0 0x00a3 KEYCODE_NUMPAD_RIGHT_PAREN
0x07 0x00b8 numpad {keys
0x07 0x00b9 Keypad} key
0x07 0x00ba Keyboard Tab key
0x07 0x00bb Numpad Backspace key
0x07 0x00bc Keypad A key
0x07 0x00bd Numpad B key
0x07 0x00be Numpad C key
0x07 0x00bf D key on the small keyboard
0x07 0x00c0 Keypad E key
0x07 0x00c1 Numpad F key
0x07 0x00c2 Numpad XOR key
0x07 0x00c3 Numpad ^ key
0x07 0x00c4 Numpad % key
0x07 0x00c5 Numpad< key
0x07 0x00c6 Keypad > Keys
0x07 0x00c7 Keypad & Keys
0x07 0x00c8 Numpad && keys
0x07 0x00c9 keypad | key
0x07 0x00ca Keyboard|| key
0x07 0x00cb Numpad: keys
0x07 0x00cc Keypad # key
0x07 0x00cd Small keyboard space bar
0x07 0x00ce Numpad @ key
0x07 0x00cf Numpad! key
0x07 0x00d0 Numpad Memory Store key
0x07 0x00d1 Numpad Memory Recall key
0x07 0x00d2 Keypad Memory Clear key
0x07 0x00d3 Numpad Memory Add key
0x07 0x00d4 Numpad Memory Subtract key
0x07 0x00d5 Keypad Memory Multiply key
0x07 0x00d6 Numpad Memory Divide key
0x07 0x00d7 Numpad +/- keys
0x07 0x00d8 Keyboard Clear key
0x07 0x00d9 Keyboard Clear Entry key
0x07 0x00da Keypad binary numbers
0x07 0x00db Keypad octal number
0x07 0x00dc Keypad decimal numbers
0x07 0x00dd Keypad hexadecimal numbers
0x07 0x00e0 Keyboard left Ctrl key 0x001d KEY_LEFTCTRL 3.0 0x0071 KEYCODE_CTRL_LEFT
0x07 0x00e1 Keyboard left shift key 0x002a KEY_LEFTSHIFT 1.6 0x003b KEYCODE_SHIFT_LEFT
0x07 0x00e2 Keyboard left Alt key 0x0038 KEY_LEFTALT 1.6 0x0039 KEYCODE_ALT_LEFT
0x07 0x00e3 Keyboard left GUI key 0x007d KEY_LEFTMETA 3.0 0x0075 KEYCODE_META_LEFT
0x07 0x00e4 Keyboard right Ctrl key 0x0061 KEY_RIGHTCTRL 3.0 0x0072 KEYCODE_CTRL_RIGHT
0x07 0x00e5 Keyboard right Shift key 0x0036 KEY_RIGHTSHIFT 1.6 0x003c KEYCODE_SHIFT_RIGHT
0x07 0x00e6 Keyboard right Alt key 0x0064 KEY_RIGHTALT 1.6 0x003a KEYCODE_ALT_RIGHT
0x07 0x00e7 Keyboard right GUI key 0x007e KEY_RIGHTMETA 3.0 0x0076 KEYCODE_META_RIGHT
0x07 0x00e8 0x00a4 KEY_PLAYPAUSE 3.0 0x0055 KEYCODE_MEDIA_PLAY_PAUSE
0x07 0x00e9 0x00a6 KEY_STOPCD 3.0 0x0056 KEYCODE_MEDIA_STOP
0x07 0x00ea 0x00a5 KEY_PREVIOUSSONG 3.0 0x0058 KEYCODE_MEDIA_PREVIOUS
0x07 0x00eb 0x00a3 KEY_NEXTSONG 3.0 0x0057 KEYCODE_MEDIA_NEXT
0x07 0x00ec 0x00a1 KEY_EJECTCD 3.0 0x0081 KEYCODE_MEDIA_EJECT
0x07 0x00ed 0x0073 KEY_VOLUMEUP 1.6 0x0018 KEYCODE_VOLUME_UP
0x07 0x00ee 0x0072 KEY_VOLUMEDOWN 1.6 0x0019 KEYCODE_VOLUME_DOWN
0x07 0x00ef 0x0071 KEY_MUTE 3.0 0x00a4 KEYCODE_VOLUME_MUTE
0x07 0x00f0 0x0096 KEY_WWW 1.6 0x0040 KEYCODE_EXPLORER
0x07 0x00f1 0x009e KEY_BACK 1.6 0x0004 KEYCODE_BACK
0x07 0x00f2 0x009f KEY_FORWARD 3.0 0x007d KEYCODE_FORWARD
0x07 0x00f3 0x0080 KEY_STOP 3.0 0x0056 KEYCODE_MEDIA_STOP
0x07 0x00f4 0x0088 KEY_FIND
0x07 0x00f5 0x00b1 KEY_SCROLLUP 3.0 0x005c KEYCODE_PAGE_UP
0x07 0x00f6 0x00b2 KEY_SCROLLDOWN 3.0 0x005d

KEYCODE_PAGE_DOWN

Here is a link to Google’s official instructions: 

Keyboard device | Android Open Source Project | Android Open Source Project

Guess you like

Origin blog.csdn.net/HuanWen_Cheng/article/details/132752354