1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "key_event.h" 17 18#include "mmi_log.h" 19 20#undef MMI_LOG_TAG 21#define MMI_LOG_TAG "KeyEvent" 22 23using namespace OHOS::HiviewDFX; 24namespace OHOS { 25namespace MMI { 26namespace { 27const std::map <int32_t, std::string> KEYCODE_TO_STRING = { 28 {KeyEvent::KEYCODE_FN, "KEYCODE_FN"}, 29 {KeyEvent::KEYCODE_UNKNOWN, "KEYCODE_UNKNOWN"}, 30 {KeyEvent::KEYCODE_HOME, "KEYCODE_HOME"}, 31 {KeyEvent::KEYCODE_BACK, "KEYCODE_BACK"}, 32 {KeyEvent::KEYCODE_CALL, "KEYCODE_CALL"}, 33 {KeyEvent::KEYCODE_ENDCALL, "KEYCODE_ENDCALL"}, 34 {KeyEvent::KEYCODE_CLEAR, "KEYCODE_CLEAR"}, 35 {KeyEvent::KEYCODE_HEADSETHOOK, "KEYCODE_HEADSETHOOK"}, 36 {KeyEvent::KEYCODE_FOCUS, "KEYCODE_FOCUS"}, 37 {KeyEvent::KEYCODE_NOTIFICATION, "KEYCODE_NOTIFICATION"}, 38 {KeyEvent::KEYCODE_SEARCH, "KEYCODE_SEARCH"}, 39 {KeyEvent::KEYCODE_MEDIA_PLAY_PAUSE, "KEYCODE_MEDIA_PLAY_PAUSE"}, 40 {KeyEvent::KEYCODE_MEDIA_STOP, "KEYCODE_MEDIA_STOP"}, 41 {KeyEvent::KEYCODE_MEDIA_NEXT, "KEYCODE_MEDIA_NEXT"}, 42 {KeyEvent::KEYCODE_MEDIA_PREVIOUS, "KEYCODE_MEDIA_PREVIOUS"}, 43 {KeyEvent::KEYCODE_MEDIA_REWIND, "KEYCODE_MEDIA_REWIND"}, 44 {KeyEvent::KEYCODE_MEDIA_FAST_FORWARD, "KEYCODE_MEDIA_FAST_FORWARD"}, 45 {KeyEvent::KEYCODE_VOLUME_UP, "KEYCODE_VOLUME_UP"}, 46 {KeyEvent::KEYCODE_VOLUME_DOWN, "KEYCODE_VOLUME_DOWN"}, 47 {KeyEvent::KEYCODE_POWER, "KEYCODE_POWER"}, 48 {KeyEvent::KEYCODE_CAMERA, "KEYCODE_CAMERA"}, 49 {KeyEvent::KEYCODE_VOICE_ASSISTANT, "KEYCODE_VOICE_ASSISTANT"}, 50 {KeyEvent::KEYCODE_CUSTOM1, "KEYCODE_CUSTOM1"}, 51 {KeyEvent::KEYCODE_VOLUME_MUTE, "KEYCODE_VOLUME_MUTE"}, 52 {KeyEvent::KEYCODE_MUTE, "KEYCODE_MUTE"}, 53 {KeyEvent::KEYCODE_BRIGHTNESS_UP, "KEYCODE_BRIGHTNESS_UP"}, 54 {KeyEvent::KEYCODE_BRIGHTNESS_DOWN, "KEYCODE_BRIGHTNESS_DOWN"}, 55 {KeyEvent::KEYCODE_WEAR_1, "KEYCODE_WEAR_1"}, 56 {KeyEvent::KEYCODE_0, "KEYCODE_0"}, 57 {KeyEvent::KEYCODE_1, "KEYCODE_1"}, 58 {KeyEvent::KEYCODE_2, "KEYCODE_2"}, 59 {KeyEvent::KEYCODE_3, "KEYCODE_3"}, 60 {KeyEvent::KEYCODE_4, "KEYCODE_4"}, 61 {KeyEvent::KEYCODE_5, "KEYCODE_5"}, 62 {KeyEvent::KEYCODE_6, "KEYCODE_6"}, 63 {KeyEvent::KEYCODE_7, "KEYCODE_7"}, 64 {KeyEvent::KEYCODE_8, "KEYCODE_8"}, 65 {KeyEvent::KEYCODE_9, "KEYCODE_9"}, 66 {KeyEvent::KEYCODE_STAR, "KEYCODE_STAR"}, 67 {KeyEvent::KEYCODE_POUND, "KEYCODE_POUND"}, 68 {KeyEvent::KEYCODE_DPAD_UP, "KEYCODE_DPAD_UP"}, 69 {KeyEvent::KEYCODE_DPAD_DOWN, "KEYCODE_DPAD_DOWN"}, 70 {KeyEvent::KEYCODE_DPAD_LEFT, "KEYCODE_DPAD_LEFT"}, 71 {KeyEvent::KEYCODE_DPAD_RIGHT, "KEYCODE_DPAD_RIGHT"}, 72 {KeyEvent::KEYCODE_DPAD_CENTER, "KEYCODE_DPAD_CENTER"}, 73 {KeyEvent::KEYCODE_A, "KEYCODE_A"}, 74 {KeyEvent::KEYCODE_B, "KEYCODE_B"}, 75 {KeyEvent::KEYCODE_C, "KEYCODE_C"}, 76 {KeyEvent::KEYCODE_D, "KEYCODE_D"}, 77 {KeyEvent::KEYCODE_E, "KEYCODE_E"}, 78 {KeyEvent::KEYCODE_F, "KEYCODE_F"}, 79 {KeyEvent::KEYCODE_G, "KEYCODE_G"}, 80 {KeyEvent::KEYCODE_H, "KEYCODE_H"}, 81 {KeyEvent::KEYCODE_I, "KEYCODE_I"}, 82 {KeyEvent::KEYCODE_J, "KEYCODE_J"}, 83 {KeyEvent::KEYCODE_K, "KEYCODE_K"}, 84 {KeyEvent::KEYCODE_L, "KEYCODE_L"}, 85 {KeyEvent::KEYCODE_M, "KEYCODE_M"}, 86 {KeyEvent::KEYCODE_N, "KEYCODE_N"}, 87 {KeyEvent::KEYCODE_O, "KEYCODE_O"}, 88 {KeyEvent::KEYCODE_P, "KEYCODE_P"}, 89 {KeyEvent::KEYCODE_Q, "KEYCODE_Q"}, 90 {KeyEvent::KEYCODE_R, "KEYCODE_R"}, 91 {KeyEvent::KEYCODE_S, "KEYCODE_S"}, 92 {KeyEvent::KEYCODE_T, "KEYCODE_T"}, 93 {KeyEvent::KEYCODE_U, "KEYCODE_U"}, 94 {KeyEvent::KEYCODE_V, "KEYCODE_V"}, 95 {KeyEvent::KEYCODE_W, "KEYCODE_W"}, 96 {KeyEvent::KEYCODE_X, "KEYCODE_X"}, 97 {KeyEvent::KEYCODE_Y, "KEYCODE_Y"}, 98 {KeyEvent::KEYCODE_Z, "KEYCODE_Z"}, 99 {KeyEvent::KEYCODE_COMMA, "KEYCODE_COMMA"}, 100 {KeyEvent::KEYCODE_PERIOD, "KEYCODE_PERIOD"}, 101 {KeyEvent::KEYCODE_ALT_LEFT, "KEYCODE_ALT_LEFT"}, 102 {KeyEvent::KEYCODE_ALT_RIGHT, "KEYCODE_ALT_RIGHT"}, 103 {KeyEvent::KEYCODE_SHIFT_LEFT, "KEYCODE_SHIFT_LEFT"}, 104 {KeyEvent::KEYCODE_SHIFT_RIGHT, "KEYCODE_SHIFT_RIGHT"}, 105 {KeyEvent::KEYCODE_TAB, "KEYCODE_TAB"}, 106 {KeyEvent::KEYCODE_SPACE, "KEYCODE_SPACE"}, 107 {KeyEvent::KEYCODE_SYM, "KEYCODE_SYM"}, 108 {KeyEvent::KEYCODE_EXPLORER, "KEYCODE_EXPLORER"}, 109 {KeyEvent::KEYCODE_ENVELOPE, "KEYCODE_ENVELOPE"}, 110 {KeyEvent::KEYCODE_ENTER, "KEYCODE_ENTER"}, 111 {KeyEvent::KEYCODE_DEL, "KEYCODE_DEL"}, 112 {KeyEvent::KEYCODE_GRAVE, "KEYCODE_GRAVE"}, 113 {KeyEvent::KEYCODE_MINUS, "KEYCODE_MINUS"}, 114 {KeyEvent::KEYCODE_EQUALS, "KEYCODE_EQUALS"}, 115 {KeyEvent::KEYCODE_LEFT_BRACKET, "KEYCODE_LEFT_BRACKET"}, 116 {KeyEvent::KEYCODE_RIGHT_BRACKET, "KEYCODE_RIGHT_BRACKET"}, 117 {KeyEvent::KEYCODE_BACKSLASH, "KEYCODE_BACKSLASH"}, 118 {KeyEvent::KEYCODE_SEMICOLON, "KEYCODE_SEMICOLON"}, 119 {KeyEvent::KEYCODE_APOSTROPHE, "KEYCODE_APOSTROPHE"}, 120 {KeyEvent::KEYCODE_SLASH, "KEYCODE_SLASH"}, 121 {KeyEvent::KEYCODE_AT, "KEYCODE_AT"}, 122 {KeyEvent::KEYCODE_PLUS, "KEYCODE_PLUS"}, 123 {KeyEvent::KEYCODE_MENU, "KEYCODE_MENU"}, 124 {KeyEvent::KEYCODE_PAGE_UP, "KEYCODE_PAGE_UP"}, 125 {KeyEvent::KEYCODE_PAGE_DOWN, "KEYCODE_PAGE_DOWN"}, 126 {KeyEvent::KEYCODE_ESCAPE, "KEYCODE_ESCAPE"}, 127 {KeyEvent::KEYCODE_FORWARD_DEL, "KEYCODE_FORWARD_DEL"}, 128 {KeyEvent::KEYCODE_CTRL_LEFT, "KEYCODE_CTRL_LEFT"}, 129 {KeyEvent::KEYCODE_CTRL_RIGHT, "KEYCODE_CTRL_RIGHT"}, 130 {KeyEvent::KEYCODE_CAPS_LOCK, "KEYCODE_CAPS_LOCK"}, 131 {KeyEvent::KEYCODE_SCROLL_LOCK, "KEYCODE_SCROLL_LOCK"}, 132 {KeyEvent::KEYCODE_META_LEFT, "KEYCODE_META_LEFT"}, 133 {KeyEvent::KEYCODE_META_RIGHT, "KEYCODE_META_RIGHT"}, 134 {KeyEvent::KEYCODE_FUNCTION, "KEYCODE_FUNCTION"}, 135 {KeyEvent::KEYCODE_SYSRQ, "KEYCODE_SYSRQ"}, 136 {KeyEvent::KEYCODE_BREAK, "KEYCODE_BREAK"}, 137 {KeyEvent::KEYCODE_MOVE_HOME, "KEYCODE_MOVE_HOME"}, 138 {KeyEvent::KEYCODE_MOVE_END, "KEYCODE_MOVE_END"}, 139 {KeyEvent::KEYCODE_INSERT, "KEYCODE_INSERT"}, 140 {KeyEvent::KEYCODE_FORWARD, "KEYCODE_FORWARD"}, 141 {KeyEvent::KEYCODE_MEDIA_PLAY, "KEYCODE_MEDIA_PLAY"}, 142 {KeyEvent::KEYCODE_MEDIA_PAUSE, "KEYCODE_MEDIA_PAUSE"}, 143 {KeyEvent::KEYCODE_MEDIA_CLOSE, "KEYCODE_MEDIA_CLOSE"}, 144 {KeyEvent::KEYCODE_MEDIA_EJECT, "KEYCODE_MEDIA_EJECT"}, 145 {KeyEvent::KEYCODE_MEDIA_RECORD, "KEYCODE_MEDIA_RECORD"}, 146 {KeyEvent::KEYCODE_F1, "KEYCODE_F1"}, 147 {KeyEvent::KEYCODE_F2, "KEYCODE_F2"}, 148 {KeyEvent::KEYCODE_F3, "KEYCODE_F3"}, 149 {KeyEvent::KEYCODE_F4, "KEYCODE_F4"}, 150 {KeyEvent::KEYCODE_F5, "KEYCODE_F5"}, 151 {KeyEvent::KEYCODE_F6, "KEYCODE_F6"}, 152 {KeyEvent::KEYCODE_F7, "KEYCODE_F7"}, 153 {KeyEvent::KEYCODE_F8, "KEYCODE_F8"}, 154 {KeyEvent::KEYCODE_F9, "KEYCODE_F9"}, 155 {KeyEvent::KEYCODE_F10, "KEYCODE_F10"}, 156 {KeyEvent::KEYCODE_F11, "KEYCODE_F11"}, 157 {KeyEvent::KEYCODE_F12, "KEYCODE_F12"}, 158 {KeyEvent::KEYCODE_NUM_LOCK, "KEYCODE_NUM_LOCK"}, 159 {KeyEvent::KEYCODE_NUMPAD_0, "KEYCODE_NUMPAD_0"}, 160 {KeyEvent::KEYCODE_NUMPAD_1, "KEYCODE_NUMPAD_1"}, 161 {KeyEvent::KEYCODE_NUMPAD_2, "KEYCODE_NUMPAD_2"}, 162 {KeyEvent::KEYCODE_NUMPAD_3, "KEYCODE_NUMPAD_3"}, 163 {KeyEvent::KEYCODE_NUMPAD_4, "KEYCODE_NUMPAD_4"}, 164 {KeyEvent::KEYCODE_NUMPAD_5, "KEYCODE_NUMPAD_5"}, 165 {KeyEvent::KEYCODE_NUMPAD_6, "KEYCODE_NUMPAD_6"}, 166 {KeyEvent::KEYCODE_NUMPAD_7, "KEYCODE_NUMPAD_7"}, 167 {KeyEvent::KEYCODE_NUMPAD_8, "KEYCODE_NUMPAD_8"}, 168 {KeyEvent::KEYCODE_NUMPAD_9, "KEYCODE_NUMPAD_9"}, 169 {KeyEvent::KEYCODE_NUMPAD_DIVIDE, "KEYCODE_NUMPAD_DIVIDE"}, 170 {KeyEvent::KEYCODE_NUMPAD_MULTIPLY, "KEYCODE_NUMPAD_MULTIPLY"}, 171 {KeyEvent::KEYCODE_NUMPAD_SUBTRACT, "KEYCODE_NUMPAD_SUBTRACT"}, 172 {KeyEvent::KEYCODE_NUMPAD_ADD, "KEYCODE_NUMPAD_ADD"}, 173 {KeyEvent::KEYCODE_NUMPAD_DOT, "KEYCODE_NUMPAD_DOT"}, 174 {KeyEvent::KEYCODE_NUMPAD_COMMA, "KEYCODE_NUMPAD_COMMA"}, 175 {KeyEvent::KEYCODE_NUMPAD_ENTER, "KEYCODE_NUMPAD_ENTER"}, 176 {KeyEvent::KEYCODE_NUMPAD_EQUALS, "KEYCODE_NUMPAD_EQUALS"}, 177 {KeyEvent::KEYCODE_NUMPAD_LEFT_PAREN, "KEYCODE_NUMPAD_LEFT_PAREN"}, 178 {KeyEvent::KEYCODE_NUMPAD_RIGHT_PAREN, "KEYCODE_NUMPAD_RIGHT_PAREN"}, 179 {KeyEvent::KEYCODE_VIRTUAL_MULTITASK, "KEYCODE_VIRTUAL_MULTITASK"}, 180 {KeyEvent::KEYCODE_BUTTON_A, "KEYCODE_BUTTON_A"}, 181 {KeyEvent::KEYCODE_BUTTON_B, "KEYCODE_BUTTON_B"}, 182 {KeyEvent::KEYCODE_BUTTON_C, "KEYCODE_BUTTON_C"}, 183 {KeyEvent::KEYCODE_BUTTON_X, "KEYCODE_BUTTON_X"}, 184 {KeyEvent::KEYCODE_BUTTON_Y, "KEYCODE_BUTTON_Y"}, 185 {KeyEvent::KEYCODE_BUTTON_Z, "KEYCODE_BUTTON_Z"}, 186 {KeyEvent::KEYCODE_BUTTON_L1, "KEYCODE_BUTTON_L1"}, 187 {KeyEvent::KEYCODE_BUTTON_R1, "KEYCODE_BUTTON_R1"}, 188 {KeyEvent::KEYCODE_BUTTON_L2, "KEYCODE_BUTTON_L2"}, 189 {KeyEvent::KEYCODE_BUTTON_R2, "KEYCODE_BUTTON_R2"}, 190 {KeyEvent::KEYCODE_BUTTON_SELECT, "KEYCODE_BUTTON_SELECT"}, 191 {KeyEvent::KEYCODE_BUTTON_START, "KEYCODE_BUTTON_START"}, 192 {KeyEvent::KEYCODE_BUTTON_MODE, "KEYCODE_BUTTON_MODE"}, 193 {KeyEvent::KEYCODE_BUTTON_THUMBL, "KEYCODE_BUTTON_THUMBL"}, 194 {KeyEvent::KEYCODE_BUTTON_THUMBR, "KEYCODE_BUTTON_THUMBR"}, 195 {KeyEvent::KEYCODE_BUTTON_TRIGGER, "KEYCODE_BUTTON_TRIGGER"}, 196 {KeyEvent::KEYCODE_BUTTON_THUMB, "KEYCODE_BUTTON_THUMB"}, 197 {KeyEvent::KEYCODE_BUTTON_THUMB2, "KEYCODE_BUTTON_THUMB2"}, 198 {KeyEvent::KEYCODE_BUTTON_TOP, "KEYCODE_BUTTON_TOP"}, 199 {KeyEvent::KEYCODE_BUTTON_TOP2, "KEYCODE_BUTTON_TOP2"}, 200 {KeyEvent::KEYCODE_BUTTON_PINKIE, "KEYCODE_BUTTON_PINKIE"}, 201 {KeyEvent::KEYCODE_BUTTON_BASE1, "KEYCODE_BUTTON_BASE1"}, 202 {KeyEvent::KEYCODE_BUTTON_BASE2, "KEYCODE_BUTTON_BASE2"}, 203 {KeyEvent::KEYCODE_BUTTON_BASE3, "KEYCODE_BUTTON_BASE3"}, 204 {KeyEvent::KEYCODE_BUTTON_BASE4, "KEYCODE_BUTTON_BASE4"}, 205 {KeyEvent::KEYCODE_BUTTON_BASE5, "KEYCODE_BUTTON_BASE5"}, 206 {KeyEvent::KEYCODE_BUTTON_BASE6, "KEYCODE_BUTTON_BASE6"}, 207 {KeyEvent::KEYCODE_BUTTON_BASE7, "KEYCODE_BUTTON_BASE7"}, 208 {KeyEvent::KEYCODE_BUTTON_BASE8, "KEYCODE_BUTTON_BASE8"}, 209 {KeyEvent::KEYCODE_BUTTON_BASE9, "KEYCODE_BUTTON_BASE9"}, 210 {KeyEvent::KEYCODE_BUTTON_DEAD, "KEYCODE_BUTTON_DEAD"}, 211 {KeyEvent::KEYCODE_SLEEP, "KEYCODE_SLEEP"}, 212 {KeyEvent::KEYCODE_ZENKAKU_HANKAKU, "KEYCODE_ZENKAKU_HANKAKU"}, 213 {KeyEvent::KEYCODE_102ND, "KEYCODE_102ND"}, 214 {KeyEvent::KEYCODE_RO, "KEYCODE_RO"}, 215 {KeyEvent::KEYCODE_KATAKANA, "KEYCODE_KATAKANA"}, 216 {KeyEvent::KEYCODE_HIRAGANA, "KEYCODE_HIRAGANA"}, 217 {KeyEvent::KEYCODE_HENKAN, "KEYCODE_HENKAN"}, 218 {KeyEvent::KEYCODE_KATAKANA_HIRAGANA, "KEYCODE_KATAKANA_HIRAGANA"}, 219 {KeyEvent::KEYCODE_MUHENKAN, "KEYCODE_MUHENKAN"}, 220 {KeyEvent::KEYCODE_LINEFEED, "KEYCODE_LINEFEED"}, 221 {KeyEvent::KEYCODE_MACRO, "KEYCODE_MACRO"}, 222 {KeyEvent::KEYCODE_NUMPAD_PLUSMINUS, "KEYCODE_NUMPAD_PLUSMINUS"}, 223 {KeyEvent::KEYCODE_SCALE, "KEYCODE_SCALE"}, 224 {KeyEvent::KEYCODE_HANGUEL, "KEYCODE_HANGUEL"}, 225 {KeyEvent::KEYCODE_HANJA, "KEYCODE_HANJA"}, 226 {KeyEvent::KEYCODE_YEN, "KEYCODE_YEN"}, 227 {KeyEvent::KEYCODE_STOP, "KEYCODE_STOP"}, 228 {KeyEvent::KEYCODE_AGAIN, "KEYCODE_AGAIN"}, 229 {KeyEvent::KEYCODE_PROPS, "KEYCODE_PROPS"}, 230 {KeyEvent::KEYCODE_UNDO, "KEYCODE_UNDO"}, 231 {KeyEvent::KEYCODE_COPY, "KEYCODE_COPY"}, 232 {KeyEvent::KEYCODE_OPEN, "KEYCODE_OPEN"}, 233 {KeyEvent::KEYCODE_PASTE, "KEYCODE_PASTE"}, 234 {KeyEvent::KEYCODE_FIND, "KEYCODE_FIND"}, 235 {KeyEvent::KEYCODE_CUT, "KEYCODE_CUT"}, 236 {KeyEvent::KEYCODE_HELP, "KEYCODE_HELP"}, 237 {KeyEvent::KEYCODE_CALC, "KEYCODE_CALC"}, 238 {KeyEvent::KEYCODE_FILE, "KEYCODE_FILE"}, 239 {KeyEvent::KEYCODE_BOOKMARKS, "KEYCODE_BOOKMARKS"}, 240 {KeyEvent::KEYCODE_NEXT, "KEYCODE_NEXT"}, 241 {KeyEvent::KEYCODE_PLAYPAUSE, "KEYCODE_PLAYPAUSE"}, 242 {KeyEvent::KEYCODE_PREVIOUS, "KEYCODE_PREVIOUS"}, 243 {KeyEvent::KEYCODE_STOPCD, "KEYCODE_STOPCD"}, 244 {KeyEvent::KEYCODE_CONFIG, "KEYCODE_CONFIG"}, 245 {KeyEvent::KEYCODE_REFRESH, "KEYCODE_REFRESH"}, 246 {KeyEvent::KEYCODE_EXIT, "KEYCODE_EXIT"}, 247 {KeyEvent::KEYCODE_EDIT, "KEYCODE_EDIT"}, 248 {KeyEvent::KEYCODE_SCROLLUP, "KEYCODE_SCROLLUP"}, 249 {KeyEvent::KEYCODE_SCROLLDOWN, "KEYCODE_SCROLLDOWN"}, 250 {KeyEvent::KEYCODE_NEW, "KEYCODE_NEW"}, 251 {KeyEvent::KEYCODE_REDO, "KEYCODE_REDO"}, 252 {KeyEvent::KEYCODE_CLOSE, "KEYCODE_CLOSE"}, 253 {KeyEvent::KEYCODE_PLAY, "KEYCODE_PLAY"}, 254 {KeyEvent::KEYCODE_BASSBOOST, "KEYCODE_BASSBOOST"}, 255 {KeyEvent::KEYCODE_PRINT, "KEYCODE_PRINT"}, 256 {KeyEvent::KEYCODE_CHAT, "KEYCODE_CHAT"}, 257 {KeyEvent::KEYCODE_FINANCE, "KEYCODE_FINANCE"}, 258 {KeyEvent::KEYCODE_CANCEL, "KEYCODE_CANCEL"}, 259 {KeyEvent::KEYCODE_KBDILLUM_TOGGLE, "KEYCODE_KBDILLUM_TOGGLE"}, 260 {KeyEvent::KEYCODE_KBDILLUM_DOWN, "KEYCODE_KBDILLUM_DOWN"}, 261 {KeyEvent::KEYCODE_KBDILLUM_UP, "KEYCODE_KBDILLUM_UP"}, 262 {KeyEvent::KEYCODE_SEND, "KEYCODE_SEND"}, 263 {KeyEvent::KEYCODE_REPLY, "KEYCODE_REPLY"}, 264 {KeyEvent::KEYCODE_FORWARDMAIL, "KEYCODE_FORWARDMAIL"}, 265 {KeyEvent::KEYCODE_SAVE, "KEYCODE_SAVE"}, 266 {KeyEvent::KEYCODE_DOCUMENTS, "KEYCODE_DOCUMENTS"}, 267 {KeyEvent::KEYCODE_VIDEO_NEXT, "KEYCODE_VIDEO_NEXT"}, 268 {KeyEvent::KEYCODE_VIDEO_PREV, "KEYCODE_VIDEO_PREV"}, 269 {KeyEvent::KEYCODE_BRIGHTNESS_CYCLE, "KEYCODE_BRIGHTNESS_CYCLE"}, 270 {KeyEvent::KEYCODE_BRIGHTNESS_ZERO, "KEYCODE_BRIGHTNESS_ZERO"}, 271 {KeyEvent::KEYCODE_DISPLAY_OFF, "KEYCODE_DISPLAY_OFF"}, 272 {KeyEvent::KEYCODE_BTN_MISC, "KEYCODE_BTN_MISC"}, 273 {KeyEvent::KEYCODE_GOTO, "KEYCODE_GOTO"}, 274 {KeyEvent::KEYCODE_INFO, "KEYCODE_INFO"}, 275 {KeyEvent::KEYCODE_PROGRAM, "KEYCODE_PROGRAM"}, 276 {KeyEvent::KEYCODE_PVR, "KEYCODE_PVR"}, 277 {KeyEvent::KEYCODE_SUBTITLE, "KEYCODE_SUBTITLE"}, 278 {KeyEvent::KEYCODE_FULL_SCREEN, "KEYCODE_FULL_SCREEN"}, 279 {KeyEvent::KEYCODE_KEYBOARD, "KEYCODE_KEYBOARD"}, 280 {KeyEvent::KEYCODE_ASPECT_RATIO, "KEYCODE_ASPECT_RATIO"}, 281 {KeyEvent::KEYCODE_PC, "KEYCODE_PC"}, 282 {KeyEvent::KEYCODE_TV, "KEYCODE_TV"}, 283 {KeyEvent::KEYCODE_TV2, "KEYCODE_TV2"}, 284 {KeyEvent::KEYCODE_VCR, "KEYCODE_VCR"}, 285 {KeyEvent::KEYCODE_VCR2, "KEYCODE_VCR2"}, 286 {KeyEvent::KEYCODE_SAT, "KEYCODE_SAT"}, 287 {KeyEvent::KEYCODE_CD, "KEYCODE_CD"}, 288 {KeyEvent::KEYCODE_TAPE, "KEYCODE_TAPE"}, 289 {KeyEvent::KEYCODE_TUNER, "KEYCODE_TUNER"}, 290 {KeyEvent::KEYCODE_PLAYER, "KEYCODE_PLAYER"}, 291 {KeyEvent::KEYCODE_DVD, "KEYCODE_DVD"}, 292 {KeyEvent::KEYCODE_AUDIO, "KEYCODE_AUDIO"}, 293 {KeyEvent::KEYCODE_VIDEO, "KEYCODE_VIDEO"}, 294 {KeyEvent::KEYCODE_MEMO, "KEYCODE_MEMO"}, 295 {KeyEvent::KEYCODE_CALENDAR, "KEYCODE_CALENDAR"}, 296 {KeyEvent::KEYCODE_RED, "KEYCODE_RED"}, 297 {KeyEvent::KEYCODE_GREEN, "KEYCODE_GREEN"}, 298 {KeyEvent::KEYCODE_YELLOW, "KEYCODE_YELLOW"}, 299 {KeyEvent::KEYCODE_BLUE, "KEYCODE_BLUE"}, 300 {KeyEvent::KEYCODE_CHANNELUP, "KEYCODE_CHANNELUP"}, 301 {KeyEvent::KEYCODE_CHANNELDOWN, "KEYCODE_CHANNELDOWN"}, 302 {KeyEvent::KEYCODE_LAST, "KEYCODE_LAST"}, 303 {KeyEvent::KEYCODE_RESTART, "KEYCODE_RESTART"}, 304 {KeyEvent::KEYCODE_SLOW, "KEYCODE_SLOW"}, 305 {KeyEvent::KEYCODE_SHUFFLE, "KEYCODE_SHUFFLE"}, 306 {KeyEvent::KEYCODE_VIDEOPHONE, "KEYCODE_VIDEOPHONE"}, 307 {KeyEvent::KEYCODE_GAMES, "KEYCODE_GAMES"}, 308 {KeyEvent::KEYCODE_ZOOMIN, "KEYCODE_ZOOMIN"}, 309 {KeyEvent::KEYCODE_ZOOMOUT, "KEYCODE_ZOOMOUT"}, 310 {KeyEvent::KEYCODE_ZOOMRESET, "KEYCODE_ZOOMRESET"}, 311 {KeyEvent::KEYCODE_WORDPROCESSOR, "KEYCODE_WORDPROCESSOR"}, 312 {KeyEvent::KEYCODE_EDITOR, "KEYCODE_EDITOR"}, 313 {KeyEvent::KEYCODE_SPREADSHEET, "KEYCODE_SPREADSHEET"}, 314 {KeyEvent::KEYCODE_GRAPHICSEDITOR, "KEYCODE_GRAPHICSEDITOR"}, 315 {KeyEvent::KEYCODE_PRESENTATION, "KEYCODE_PRESENTATION"}, 316 {KeyEvent::KEYCODE_DATABASE, "KEYCODE_DATABASE"}, 317 {KeyEvent::KEYCODE_NEWS, "KEYCODE_NEWS"}, 318 {KeyEvent::KEYCODE_VOICEMAIL, "KEYCODE_VOICEMAIL"}, 319 {KeyEvent::KEYCODE_ADDRESSBOOK, "KEYCODE_ADDRESSBOOK"}, 320 {KeyEvent::KEYCODE_MESSENGER, "KEYCODE_MESSENGER"}, 321 {KeyEvent::KEYCODE_BRIGHTNESS_TOGGLE, "KEYCODE_BRIGHTNESS_TOGGLE"}, 322 {KeyEvent::KEYCODE_SPELLCHECK, "KEYCODE_SPELLCHECK"}, 323 {KeyEvent::KEYCODE_COFFEE, "KEYCODE_COFFEE"}, 324 {KeyEvent::KEYCODE_MEDIA_REPEAT, "KEYCODE_MEDIA_REPEAT"}, 325 {KeyEvent::KEYCODE_IMAGES, "KEYCODE_IMAGES"}, 326 {KeyEvent::KEYCODE_BUTTONCONFIG, "KEYCODE_BUTTONCONFIG"}, 327 {KeyEvent::KEYCODE_TASKMANAGER, "KEYCODE_TASKMANAGER"}, 328 {KeyEvent::KEYCODE_JOURNAL, "KEYCODE_JOURNAL"}, 329 {KeyEvent::KEYCODE_CONTROLPANEL, "KEYCODE_CONTROLPANEL"}, 330 {KeyEvent::KEYCODE_APPSELECT, "KEYCODE_APPSELECT"}, 331 {KeyEvent::KEYCODE_SCREENSAVER, "KEYCODE_SCREENSAVER"}, 332 {KeyEvent::KEYCODE_ASSISTANT, "KEYCODE_ASSISTANT"}, 333 {KeyEvent::KEYCODE_KBD_LAYOUT_NEXT, "KEYCODE_KBD_LAYOUT_NEXT"}, 334 {KeyEvent::KEYCODE_BRIGHTNESS_MIN, "KEYCODE_BRIGHTNESS_MIN"}, 335 {KeyEvent::KEYCODE_BRIGHTNESS_MAX, "KEYCODE_BRIGHTNESS_MAX"}, 336 {KeyEvent::KEYCODE_KBDINPUTASSIST_PREV, "KEYCODE_KBDINPUTASSIST_PREV"}, 337 {KeyEvent::KEYCODE_KBDINPUTASSIST_NEXT, "KEYCODE_KBDINPUTASSIST_NEXT"}, 338 {KeyEvent::KEYCODE_KBDINPUTASSIST_PREVGROUP, "KEYCODE_KBDINPUTASSIST_PREVGROUP"}, 339 {KeyEvent::KEYCODE_KBDINPUTASSIST_NEXTGROUP, "KEYCODE_KBDINPUTASSIST_NEXTGROUP"}, 340 {KeyEvent::KEYCODE_KBDINPUTASSIST_ACCEPT, "KEYCODE_KBDINPUTASSIST_ACCEPT"}, 341 {KeyEvent::KEYCODE_KBDINPUTASSIST_CANCEL, "KEYCODE_KBDINPUTASSIST_CANCEL"}, 342 {KeyEvent::KEYCODE_FRONT, "KEYCODE_FRONT"}, 343 {KeyEvent::KEYCODE_SETUP, "KEYCODE_SETUP"}, 344 {KeyEvent::KEYCODE_WAKEUP, "KEYCODE_WAKEUP"}, 345 {KeyEvent::KEYCODE_SENDFILE, "KEYCODE_SENDFILE"}, 346 {KeyEvent::KEYCODE_DELETEFILE, "KEYCODE_DELETEFILE"}, 347 {KeyEvent::KEYCODE_XFER, "KEYCODE_XFER"}, 348 {KeyEvent::KEYCODE_PROG1, "KEYCODE_PROG1"}, 349 {KeyEvent::KEYCODE_PROG2, "KEYCODE_PROG2"}, 350 {KeyEvent::KEYCODE_MSDOS, "KEYCODE_MSDOS"}, 351 {KeyEvent::KEYCODE_SCREENLOCK, "KEYCODE_SCREENLOCK"}, 352 {KeyEvent::KEYCODE_DIRECTION_ROTATE_DISPLAY, "KEYCODE_DIRECTION_ROTATE_DISPLAY"}, 353 {KeyEvent::KEYCODE_CYCLEWINDOWS, "KEYCODE_CYCLEWINDOWS"}, 354 {KeyEvent::KEYCODE_COMPUTER, "KEYCODE_COMPUTER"}, 355 {KeyEvent::KEYCODE_EJECTCLOSECD, "KEYCODE_EJECTCLOSECD"}, 356 {KeyEvent::KEYCODE_ISO, "KEYCODE_ISO"}, 357 {KeyEvent::KEYCODE_MOVE, "KEYCODE_MOVE"}, 358 {KeyEvent::KEYCODE_F13, "KEYCODE_F13"}, 359 {KeyEvent::KEYCODE_F14, "KEYCODE_F14"}, 360 {KeyEvent::KEYCODE_F15, "KEYCODE_F15"}, 361 {KeyEvent::KEYCODE_F16, "KEYCODE_F16"}, 362 {KeyEvent::KEYCODE_F17, "KEYCODE_F17"}, 363 {KeyEvent::KEYCODE_F18, "KEYCODE_F18"}, 364 {KeyEvent::KEYCODE_F19, "KEYCODE_F19"}, 365 {KeyEvent::KEYCODE_F20, "KEYCODE_F20"}, 366 {KeyEvent::KEYCODE_F21, "KEYCODE_F21"}, 367 {KeyEvent::KEYCODE_F22, "KEYCODE_F22"}, 368 {KeyEvent::KEYCODE_F23, "KEYCODE_F23"}, 369 {KeyEvent::KEYCODE_F24, "KEYCODE_F24"}, 370 {KeyEvent::KEYCODE_PROG3, "KEYCODE_PROG3"}, 371 {KeyEvent::KEYCODE_PROG4, "KEYCODE_PROG4"}, 372 {KeyEvent::KEYCODE_DASHBOARD, "KEYCODE_DASHBOARD"}, 373 {KeyEvent::KEYCODE_SUSPEND, "KEYCODE_SUSPEND"}, 374 {KeyEvent::KEYCODE_HP, "KEYCODE_HP"}, 375 {KeyEvent::KEYCODE_SOUND, "KEYCODE_SOUND"}, 376 {KeyEvent::KEYCODE_QUESTION, "KEYCODE_QUESTION"}, 377 {KeyEvent::KEYCODE_CONNECT, "KEYCODE_CONNECT"}, 378 {KeyEvent::KEYCODE_SPORT, "KEYCODE_SPORT"}, 379 {KeyEvent::KEYCODE_SHOP, "KEYCODE_SHOP"}, 380 {KeyEvent::KEYCODE_ALTERASE, "KEYCODE_ALTERASE"}, 381 {KeyEvent::KEYCODE_SWITCHVIDEOMODE, "KEYCODE_SWITCHVIDEOMODE"}, 382 {KeyEvent::KEYCODE_BATTERY, "KEYCODE_BATTERY"}, 383 {KeyEvent::KEYCODE_BLUETOOTH, "KEYCODE_BLUETOOTH"}, 384 {KeyEvent::KEYCODE_WLAN, "KEYCODE_WLAN"}, 385 {KeyEvent::KEYCODE_UWB, "KEYCODE_UWB"}, 386 {KeyEvent::KEYCODE_WWAN_WIMAX, "KEYCODE_WWAN_WIMAX"}, 387 {KeyEvent::KEYCODE_RFKILL, "KEYCODE_RFKILL"}, 388 {KeyEvent::KEYCODE_CHANNEL, "KEYCODE_CHANNEL"}, 389 {KeyEvent::KEYCODE_BTN_0, "KEYCODE_BTN_0"}, 390 {KeyEvent::KEYCODE_BTN_1, "KEYCODE_BTN_1"}, 391 {KeyEvent::KEYCODE_BTN_2, "KEYCODE_BTN_2"}, 392 {KeyEvent::KEYCODE_BTN_3, "KEYCODE_BTN_3"}, 393 {KeyEvent::KEYCODE_BTN_4, "KEYCODE_BTN_4"}, 394 {KeyEvent::KEYCODE_BTN_5, "KEYCODE_BTN_5"}, 395 {KeyEvent::KEYCODE_BTN_6, "KEYCODE_BTN_6"}, 396 {KeyEvent::KEYCODE_BTN_7, "KEYCODE_BTN_7"}, 397 {KeyEvent::KEYCODE_BTN_8, "KEYCODE_BTN_8"}, 398 {KeyEvent::KEYCODE_BTN_9, "KEYCODE_BTN_9"}, 399 {KeyEvent::KEYCODE_BRL_DOT1, "KEYCODE_BRL_DOT1"}, 400 {KeyEvent::KEYCODE_BRL_DOT2, "KEYCODE_BRL_DOT2"}, 401 {KeyEvent::KEYCODE_BRL_DOT3, "KEYCODE_BRL_DOT3"}, 402 {KeyEvent::KEYCODE_BRL_DOT4, "KEYCODE_BRL_DOT4"}, 403 {KeyEvent::KEYCODE_BRL_DOT5, "KEYCODE_BRL_DOT5"}, 404 {KeyEvent::KEYCODE_BRL_DOT6, "KEYCODE_BRL_DOT6"}, 405 {KeyEvent::KEYCODE_BRL_DOT7, "KEYCODE_BRL_DOT7"}, 406 {KeyEvent::KEYCODE_BRL_DOT8, "KEYCODE_BRL_DOT8"}, 407 {KeyEvent::KEYCODE_BRL_DOT9, "KEYCODE_BRL_DOT9"}, 408 {KeyEvent::KEYCODE_BRL_DOT10, "KEYCODE_BRL_DOT10"}, 409 {KeyEvent::KEYCODE_LEFT_KNOB_ROLL_UP, "KEYCODE_LEFT_KNOB_ROLL_UP"}, 410 {KeyEvent::KEYCODE_LEFT_KNOB_ROLL_DOWN, "KEYCODE_LEFT_KNOB_ROLL_DOWN"}, 411 {KeyEvent::KEYCODE_LEFT_KNOB, "KEYCODE_LEFT_KNOB"}, 412 {KeyEvent::KEYCODE_RIGHT_KNOB_ROLL_UP, "KEYCODE_RIGHT_KNOB_ROLL_UP"}, 413 {KeyEvent::KEYCODE_RIGHT_KNOB_ROLL_DOWN, "KEYCODE_RIGHT_KNOB_ROLL_DOWN"}, 414 {KeyEvent::KEYCODE_RIGHT_KNOB, "KEYCODE_RIGHT_KNOB"}, 415 {KeyEvent::KEYCODE_VOICE_SOURCE_SWITCH, "KEYCODE_VOICE_SOURCE_SWITCH"}, 416 {KeyEvent::KEYCODE_LAUNCHER_MENU, "KEYCODE_LAUNCHER_MENU"}, 417 {KeyEvent::KEYCODE_CALL_NOTIFICATION_CENTER, "KEYCODE_CALL_NOTIFICATION_CENTER"}, 418 {KeyEvent::KEYCODE_CALL_CONTROL_CENTER, "KEYCODE_CALL_CONTROL_CENTER"}, 419}; 420} // namespace 421const int32_t KeyEvent::UNKNOWN_FUNCTION_KEY = -1; 422const int32_t KeyEvent::NUM_LOCK_FUNCTION_KEY = 0; 423const int32_t KeyEvent::CAPS_LOCK_FUNCTION_KEY = 1; 424const int32_t KeyEvent::SCROLL_LOCK_FUNCTION_KEY = 2; 425const int32_t KeyEvent::KEYCODE_FN = 0; 426const int32_t KeyEvent::KEYCODE_UNKNOWN = -1; 427const int32_t KeyEvent::KEYCODE_HOME = 1; 428const int32_t KeyEvent::KEYCODE_BACK = 2; 429const int32_t KeyEvent::KEYCODE_CALL = 3; 430const int32_t KeyEvent::KEYCODE_ENDCALL = 4; 431const int32_t KeyEvent::KEYCODE_CLEAR = 5; 432const int32_t KeyEvent::KEYCODE_HEADSETHOOK = 6; 433const int32_t KeyEvent::KEYCODE_FOCUS = 7; 434const int32_t KeyEvent::KEYCODE_NOTIFICATION = 8; 435const int32_t KeyEvent::KEYCODE_SEARCH = 9; 436const int32_t KeyEvent::KEYCODE_MEDIA_PLAY_PAUSE = 10; 437const int32_t KeyEvent::KEYCODE_MEDIA_STOP = 11; 438const int32_t KeyEvent::KEYCODE_MEDIA_NEXT = 12; 439const int32_t KeyEvent::KEYCODE_MEDIA_PREVIOUS = 13; 440const int32_t KeyEvent::KEYCODE_MEDIA_REWIND = 14; 441const int32_t KeyEvent::KEYCODE_MEDIA_FAST_FORWARD = 15; 442const int32_t KeyEvent::KEYCODE_VOLUME_UP = 16; 443const int32_t KeyEvent::KEYCODE_VOLUME_DOWN = 17; 444const int32_t KeyEvent::KEYCODE_POWER = 18; 445const int32_t KeyEvent::KEYCODE_CAMERA = 19; 446const int32_t KeyEvent::KEYCODE_VOICE_ASSISTANT = 20; 447const int32_t KeyEvent::KEYCODE_CUSTOM1 = 21; 448const int32_t KeyEvent::KEYCODE_VOLUME_MUTE = 22; 449const int32_t KeyEvent::KEYCODE_MUTE = 23; 450const int32_t KeyEvent::KEYCODE_BRIGHTNESS_UP = 40; 451const int32_t KeyEvent::KEYCODE_BRIGHTNESS_DOWN = 41; 452const int32_t KeyEvent::KEYCODE_WEAR_1 = 1001; 453const int32_t KeyEvent::KEYCODE_0 = 2000; 454const int32_t KeyEvent::KEYCODE_1 = 2001; 455const int32_t KeyEvent::KEYCODE_2 = 2002; 456const int32_t KeyEvent::KEYCODE_3 = 2003; 457const int32_t KeyEvent::KEYCODE_4 = 2004; 458const int32_t KeyEvent::KEYCODE_5 = 2005; 459const int32_t KeyEvent::KEYCODE_6 = 2006; 460const int32_t KeyEvent::KEYCODE_7 = 2007; 461const int32_t KeyEvent::KEYCODE_8 = 2008; 462const int32_t KeyEvent::KEYCODE_9 = 2009; 463const int32_t KeyEvent::KEYCODE_STAR = 2010; 464const int32_t KeyEvent::KEYCODE_POUND = 2011; 465const int32_t KeyEvent::KEYCODE_DPAD_UP = 2012; 466const int32_t KeyEvent::KEYCODE_DPAD_DOWN = 2013; 467const int32_t KeyEvent::KEYCODE_DPAD_LEFT = 2014; 468const int32_t KeyEvent::KEYCODE_DPAD_RIGHT = 2015; 469const int32_t KeyEvent::KEYCODE_DPAD_CENTER = 2016; 470const int32_t KeyEvent::KEYCODE_A = 2017; 471const int32_t KeyEvent::KEYCODE_B = 2018; 472const int32_t KeyEvent::KEYCODE_C = 2019; 473const int32_t KeyEvent::KEYCODE_D = 2020; 474const int32_t KeyEvent::KEYCODE_E = 2021; 475const int32_t KeyEvent::KEYCODE_F = 2022; 476const int32_t KeyEvent::KEYCODE_G = 2023; 477const int32_t KeyEvent::KEYCODE_H = 2024; 478const int32_t KeyEvent::KEYCODE_I = 2025; 479const int32_t KeyEvent::KEYCODE_J = 2026; 480const int32_t KeyEvent::KEYCODE_K = 2027; 481const int32_t KeyEvent::KEYCODE_L = 2028; 482const int32_t KeyEvent::KEYCODE_M = 2029; 483const int32_t KeyEvent::KEYCODE_N = 2030; 484const int32_t KeyEvent::KEYCODE_O = 2031; 485const int32_t KeyEvent::KEYCODE_P = 2032; 486const int32_t KeyEvent::KEYCODE_Q = 2033; 487const int32_t KeyEvent::KEYCODE_R = 2034; 488const int32_t KeyEvent::KEYCODE_S = 2035; 489const int32_t KeyEvent::KEYCODE_T = 2036; 490const int32_t KeyEvent::KEYCODE_U = 2037; 491const int32_t KeyEvent::KEYCODE_V = 2038; 492const int32_t KeyEvent::KEYCODE_W = 2039; 493const int32_t KeyEvent::KEYCODE_X = 2040; 494const int32_t KeyEvent::KEYCODE_Y = 2041; 495const int32_t KeyEvent::KEYCODE_Z = 2042; 496const int32_t KeyEvent::KEYCODE_COMMA = 2043; 497const int32_t KeyEvent::KEYCODE_PERIOD = 2044; 498const int32_t KeyEvent::KEYCODE_ALT_LEFT = 2045; 499const int32_t KeyEvent::KEYCODE_ALT_RIGHT = 2046; 500const int32_t KeyEvent::KEYCODE_SHIFT_LEFT = 2047; 501const int32_t KeyEvent::KEYCODE_SHIFT_RIGHT = 2048; 502const int32_t KeyEvent::KEYCODE_TAB = 2049; 503const int32_t KeyEvent::KEYCODE_SPACE = 2050; 504const int32_t KeyEvent::KEYCODE_SYM = 2051; 505const int32_t KeyEvent::KEYCODE_EXPLORER = 2052; 506const int32_t KeyEvent::KEYCODE_ENVELOPE = 2053; 507const int32_t KeyEvent::KEYCODE_ENTER = 2054; 508const int32_t KeyEvent::KEYCODE_DEL = 2055; 509const int32_t KeyEvent::KEYCODE_GRAVE = 2056; 510const int32_t KeyEvent::KEYCODE_MINUS = 2057; 511const int32_t KeyEvent::KEYCODE_EQUALS = 2058; 512const int32_t KeyEvent::KEYCODE_LEFT_BRACKET = 2059; 513const int32_t KeyEvent::KEYCODE_RIGHT_BRACKET = 2060; 514const int32_t KeyEvent::KEYCODE_BACKSLASH = 2061; 515const int32_t KeyEvent::KEYCODE_SEMICOLON = 2062; 516const int32_t KeyEvent::KEYCODE_APOSTROPHE = 2063; 517const int32_t KeyEvent::KEYCODE_SLASH = 2064; 518const int32_t KeyEvent::KEYCODE_AT = 2065; 519const int32_t KeyEvent::KEYCODE_PLUS = 2066; 520const int32_t KeyEvent::KEYCODE_MENU = 2067; 521const int32_t KeyEvent::KEYCODE_PAGE_UP = 2068; 522const int32_t KeyEvent::KEYCODE_PAGE_DOWN = 2069; 523const int32_t KeyEvent::KEYCODE_ESCAPE = 2070; 524const int32_t KeyEvent::KEYCODE_FORWARD_DEL = 2071; 525const int32_t KeyEvent::KEYCODE_CTRL_LEFT = 2072; 526const int32_t KeyEvent::KEYCODE_CTRL_RIGHT = 2073; 527const int32_t KeyEvent::KEYCODE_CAPS_LOCK = 2074; 528const int32_t KeyEvent::KEYCODE_SCROLL_LOCK = 2075; 529const int32_t KeyEvent::KEYCODE_META_LEFT = 2076; 530const int32_t KeyEvent::KEYCODE_META_RIGHT = 2077; 531const int32_t KeyEvent::KEYCODE_FUNCTION = 2078; 532const int32_t KeyEvent::KEYCODE_SYSRQ = 2079; 533const int32_t KeyEvent::KEYCODE_BREAK = 2080; 534const int32_t KeyEvent::KEYCODE_MOVE_HOME = 2081; 535const int32_t KeyEvent::KEYCODE_MOVE_END = 2082; 536const int32_t KeyEvent::KEYCODE_INSERT = 2083; 537const int32_t KeyEvent::KEYCODE_FORWARD = 2084; 538const int32_t KeyEvent::KEYCODE_MEDIA_PLAY = 2085; 539const int32_t KeyEvent::KEYCODE_MEDIA_PAUSE = 2086; 540const int32_t KeyEvent::KEYCODE_MEDIA_CLOSE = 2087; 541const int32_t KeyEvent::KEYCODE_MEDIA_EJECT = 2088; 542const int32_t KeyEvent::KEYCODE_MEDIA_RECORD = 2089; 543const int32_t KeyEvent::KEYCODE_F1 = 2090; 544const int32_t KeyEvent::KEYCODE_F2 = 2091; 545const int32_t KeyEvent::KEYCODE_F3 = 2092; 546const int32_t KeyEvent::KEYCODE_F4 = 2093; 547const int32_t KeyEvent::KEYCODE_F5 = 2094; 548const int32_t KeyEvent::KEYCODE_F6 = 2095; 549const int32_t KeyEvent::KEYCODE_F7 = 2096; 550const int32_t KeyEvent::KEYCODE_F8 = 2097; 551const int32_t KeyEvent::KEYCODE_F9 = 2098; 552const int32_t KeyEvent::KEYCODE_F10 = 2099; 553const int32_t KeyEvent::KEYCODE_F11 = 2100; 554const int32_t KeyEvent::KEYCODE_F12 = 2101; 555const int32_t KeyEvent::KEYCODE_NUM_LOCK = 2102; 556const int32_t KeyEvent::KEYCODE_NUMPAD_0 = 2103; 557const int32_t KeyEvent::KEYCODE_NUMPAD_1 = 2104; 558const int32_t KeyEvent::KEYCODE_NUMPAD_2 = 2105; 559const int32_t KeyEvent::KEYCODE_NUMPAD_3 = 2106; 560const int32_t KeyEvent::KEYCODE_NUMPAD_4 = 2107; 561const int32_t KeyEvent::KEYCODE_NUMPAD_5 = 2108; 562const int32_t KeyEvent::KEYCODE_NUMPAD_6 = 2109; 563const int32_t KeyEvent::KEYCODE_NUMPAD_7 = 2110; 564const int32_t KeyEvent::KEYCODE_NUMPAD_8 = 2111; 565const int32_t KeyEvent::KEYCODE_NUMPAD_9 = 2112; 566const int32_t KeyEvent::KEYCODE_NUMPAD_DIVIDE = 2113; 567const int32_t KeyEvent::KEYCODE_NUMPAD_MULTIPLY = 2114; 568const int32_t KeyEvent::KEYCODE_NUMPAD_SUBTRACT = 2115; 569const int32_t KeyEvent::KEYCODE_NUMPAD_ADD = 2116; 570const int32_t KeyEvent::KEYCODE_NUMPAD_DOT = 2117; 571const int32_t KeyEvent::KEYCODE_NUMPAD_COMMA = 2118; 572const int32_t KeyEvent::KEYCODE_NUMPAD_ENTER = 2119; 573const int32_t KeyEvent::KEYCODE_NUMPAD_EQUALS = 2120; 574const int32_t KeyEvent::KEYCODE_NUMPAD_LEFT_PAREN = 2121; 575const int32_t KeyEvent::KEYCODE_NUMPAD_RIGHT_PAREN = 2122; 576const int32_t KeyEvent::KEYCODE_VIRTUAL_MULTITASK = 2210; 577const int32_t KeyEvent::KEYCODE_BUTTON_A = 2301; 578const int32_t KeyEvent::KEYCODE_BUTTON_B = 2302; 579const int32_t KeyEvent::KEYCODE_BUTTON_C = 2303; 580const int32_t KeyEvent::KEYCODE_BUTTON_X = 2304; 581const int32_t KeyEvent::KEYCODE_BUTTON_Y = 2305; 582const int32_t KeyEvent::KEYCODE_BUTTON_Z = 2306; 583const int32_t KeyEvent::KEYCODE_BUTTON_L1 = 2307; 584const int32_t KeyEvent::KEYCODE_BUTTON_R1 = 2308; 585const int32_t KeyEvent::KEYCODE_BUTTON_L2 = 2309; 586const int32_t KeyEvent::KEYCODE_BUTTON_R2 = 2310; 587const int32_t KeyEvent::KEYCODE_BUTTON_SELECT = 2311; 588const int32_t KeyEvent::KEYCODE_BUTTON_START = 2312; 589const int32_t KeyEvent::KEYCODE_BUTTON_MODE = 2313; 590const int32_t KeyEvent::KEYCODE_BUTTON_THUMBL = 2314; 591const int32_t KeyEvent::KEYCODE_BUTTON_THUMBR = 2315; 592const int32_t KeyEvent::KEYCODE_BUTTON_TRIGGER = 2401; 593const int32_t KeyEvent::KEYCODE_BUTTON_THUMB = 2402; 594const int32_t KeyEvent::KEYCODE_BUTTON_THUMB2 = 2403; 595const int32_t KeyEvent::KEYCODE_BUTTON_TOP = 2404; 596const int32_t KeyEvent::KEYCODE_BUTTON_TOP2 = 2405; 597const int32_t KeyEvent::KEYCODE_BUTTON_PINKIE = 2406; 598const int32_t KeyEvent::KEYCODE_BUTTON_BASE1 = 2407; 599const int32_t KeyEvent::KEYCODE_BUTTON_BASE2 = 2408; 600const int32_t KeyEvent::KEYCODE_BUTTON_BASE3 = 2409; 601const int32_t KeyEvent::KEYCODE_BUTTON_BASE4 = 2410; 602const int32_t KeyEvent::KEYCODE_BUTTON_BASE5 = 2411; 603const int32_t KeyEvent::KEYCODE_BUTTON_BASE6 = 2412; 604const int32_t KeyEvent::KEYCODE_BUTTON_BASE7 = 2413; 605const int32_t KeyEvent::KEYCODE_BUTTON_BASE8 = 2414; 606const int32_t KeyEvent::KEYCODE_BUTTON_BASE9 = 2415; 607const int32_t KeyEvent::KEYCODE_BUTTON_DEAD = 2416; 608const int32_t KeyEvent::KEYCODE_COMPOSE = 2466; 609const int32_t KeyEvent::KEYCODE_SLEEP = 2600; 610const int32_t KeyEvent::KEYCODE_ZENKAKU_HANKAKU = 2601; 611const int32_t KeyEvent::KEYCODE_102ND = 2602; 612const int32_t KeyEvent::KEYCODE_RO = 2603; 613const int32_t KeyEvent::KEYCODE_KATAKANA = 2604; 614const int32_t KeyEvent::KEYCODE_HIRAGANA = 2605; 615const int32_t KeyEvent::KEYCODE_HENKAN = 2606; 616const int32_t KeyEvent::KEYCODE_KATAKANA_HIRAGANA = 2607; 617const int32_t KeyEvent::KEYCODE_MUHENKAN = 2608; 618const int32_t KeyEvent::KEYCODE_LINEFEED = 2609; 619const int32_t KeyEvent::KEYCODE_MACRO = 2610; 620const int32_t KeyEvent::KEYCODE_NUMPAD_PLUSMINUS = 2611; 621const int32_t KeyEvent::KEYCODE_SCALE = 2612; 622const int32_t KeyEvent::KEYCODE_HANGUEL = 2613; 623const int32_t KeyEvent::KEYCODE_HANJA = 2614; 624const int32_t KeyEvent::KEYCODE_YEN = 2615; 625const int32_t KeyEvent::KEYCODE_STOP = 2616; 626const int32_t KeyEvent::KEYCODE_AGAIN = 2617; 627const int32_t KeyEvent::KEYCODE_PROPS = 2618; 628const int32_t KeyEvent::KEYCODE_UNDO = 2619; 629const int32_t KeyEvent::KEYCODE_COPY = 2620; 630const int32_t KeyEvent::KEYCODE_OPEN = 2621; 631const int32_t KeyEvent::KEYCODE_PASTE = 2622; 632const int32_t KeyEvent::KEYCODE_FIND = 2623; 633const int32_t KeyEvent::KEYCODE_CUT = 2624; 634const int32_t KeyEvent::KEYCODE_HELP = 2625; 635const int32_t KeyEvent::KEYCODE_CALC = 2626; 636const int32_t KeyEvent::KEYCODE_FILE = 2627; 637const int32_t KeyEvent::KEYCODE_BOOKMARKS = 2628; 638const int32_t KeyEvent::KEYCODE_NEXT = 2629; 639const int32_t KeyEvent::KEYCODE_PLAYPAUSE = 2630; 640const int32_t KeyEvent::KEYCODE_PREVIOUS = 2631; 641const int32_t KeyEvent::KEYCODE_STOPCD = 2632; 642const int32_t KeyEvent::KEYCODE_CONFIG = 2634; 643const int32_t KeyEvent::KEYCODE_REFRESH = 2635; 644const int32_t KeyEvent::KEYCODE_EXIT = 2636; 645const int32_t KeyEvent::KEYCODE_EDIT = 2637; 646const int32_t KeyEvent::KEYCODE_SCROLLUP = 2638; 647const int32_t KeyEvent::KEYCODE_SCROLLDOWN = 2639; 648const int32_t KeyEvent::KEYCODE_NEW = 2640; 649const int32_t KeyEvent::KEYCODE_REDO = 2641; 650const int32_t KeyEvent::KEYCODE_CLOSE = 2642; 651const int32_t KeyEvent::KEYCODE_PLAY = 2643; 652const int32_t KeyEvent::KEYCODE_BASSBOOST = 2644; 653const int32_t KeyEvent::KEYCODE_PRINT = 2645; 654const int32_t KeyEvent::KEYCODE_CHAT = 2646; 655const int32_t KeyEvent::KEYCODE_FINANCE = 2647; 656const int32_t KeyEvent::KEYCODE_CANCEL = 2648; 657const int32_t KeyEvent::KEYCODE_KBDILLUM_TOGGLE = 2649; 658const int32_t KeyEvent::KEYCODE_KBDILLUM_DOWN = 2650; 659const int32_t KeyEvent::KEYCODE_KBDILLUM_UP = 2651; 660const int32_t KeyEvent::KEYCODE_SEND = 2652; 661const int32_t KeyEvent::KEYCODE_REPLY = 2653; 662const int32_t KeyEvent::KEYCODE_FORWARDMAIL = 2654; 663const int32_t KeyEvent::KEYCODE_SAVE = 2655; 664const int32_t KeyEvent::KEYCODE_DOCUMENTS = 2656; 665const int32_t KeyEvent::KEYCODE_VIDEO_NEXT = 2657; 666const int32_t KeyEvent::KEYCODE_VIDEO_PREV = 2658; 667const int32_t KeyEvent::KEYCODE_BRIGHTNESS_CYCLE = 2659; 668const int32_t KeyEvent::KEYCODE_BRIGHTNESS_ZERO = 2660; 669const int32_t KeyEvent::KEYCODE_DISPLAY_OFF = 2661; 670const int32_t KeyEvent::KEYCODE_BTN_MISC = 2662; 671const int32_t KeyEvent::KEYCODE_GOTO = 2663; 672const int32_t KeyEvent::KEYCODE_INFO = 2664; 673const int32_t KeyEvent::KEYCODE_PROGRAM = 2665; 674const int32_t KeyEvent::KEYCODE_PVR = 2666; 675const int32_t KeyEvent::KEYCODE_SUBTITLE = 2667; 676const int32_t KeyEvent::KEYCODE_FULL_SCREEN = 2668; 677const int32_t KeyEvent::KEYCODE_KEYBOARD = 2669; 678const int32_t KeyEvent::KEYCODE_ASPECT_RATIO = 2670; 679const int32_t KeyEvent::KEYCODE_PC = 2671; 680const int32_t KeyEvent::KEYCODE_TV = 2672; 681const int32_t KeyEvent::KEYCODE_TV2 = 2673; 682const int32_t KeyEvent::KEYCODE_VCR = 2674; 683const int32_t KeyEvent::KEYCODE_VCR2 = 2675; 684const int32_t KeyEvent::KEYCODE_SAT = 2676; 685const int32_t KeyEvent::KEYCODE_CD = 2677; 686const int32_t KeyEvent::KEYCODE_TAPE = 2678; 687const int32_t KeyEvent::KEYCODE_TUNER = 2679; 688const int32_t KeyEvent::KEYCODE_PLAYER = 2680; 689const int32_t KeyEvent::KEYCODE_DVD = 2681; 690const int32_t KeyEvent::KEYCODE_AUDIO = 2682; 691const int32_t KeyEvent::KEYCODE_VIDEO = 2683; 692const int32_t KeyEvent::KEYCODE_MEMO = 2684; 693const int32_t KeyEvent::KEYCODE_CALENDAR = 2685; 694const int32_t KeyEvent::KEYCODE_RED = 2686; 695const int32_t KeyEvent::KEYCODE_GREEN = 2687; 696const int32_t KeyEvent::KEYCODE_YELLOW = 2688; 697const int32_t KeyEvent::KEYCODE_BLUE = 2689; 698const int32_t KeyEvent::KEYCODE_CHANNELUP = 2690; 699const int32_t KeyEvent::KEYCODE_CHANNELDOWN = 2691; 700const int32_t KeyEvent::KEYCODE_LAST = 2692; 701const int32_t KeyEvent::KEYCODE_RESTART = 2693; 702const int32_t KeyEvent::KEYCODE_SLOW = 2694; 703const int32_t KeyEvent::KEYCODE_SHUFFLE = 2695; 704const int32_t KeyEvent::KEYCODE_VIDEOPHONE = 2696; 705const int32_t KeyEvent::KEYCODE_GAMES = 2697; 706const int32_t KeyEvent::KEYCODE_ZOOMIN = 2698; 707const int32_t KeyEvent::KEYCODE_ZOOMOUT = 2699; 708const int32_t KeyEvent::KEYCODE_ZOOMRESET = 2700; 709const int32_t KeyEvent::KEYCODE_WORDPROCESSOR = 2701; 710const int32_t KeyEvent::KEYCODE_EDITOR = 2702; 711const int32_t KeyEvent::KEYCODE_SPREADSHEET = 2703; 712const int32_t KeyEvent::KEYCODE_GRAPHICSEDITOR = 2704; 713const int32_t KeyEvent::KEYCODE_PRESENTATION = 2705; 714const int32_t KeyEvent::KEYCODE_DATABASE = 2706; 715const int32_t KeyEvent::KEYCODE_NEWS = 2707; 716const int32_t KeyEvent::KEYCODE_VOICEMAIL = 2708; 717const int32_t KeyEvent::KEYCODE_ADDRESSBOOK = 2709; 718const int32_t KeyEvent::KEYCODE_MESSENGER = 2710; 719const int32_t KeyEvent::KEYCODE_BRIGHTNESS_TOGGLE = 2711; 720const int32_t KeyEvent::KEYCODE_SPELLCHECK = 2712; 721const int32_t KeyEvent::KEYCODE_COFFEE = 2713; 722const int32_t KeyEvent::KEYCODE_MEDIA_REPEAT = 2714; 723const int32_t KeyEvent::KEYCODE_IMAGES = 2715; 724const int32_t KeyEvent::KEYCODE_BUTTONCONFIG = 2716; 725const int32_t KeyEvent::KEYCODE_TASKMANAGER = 2717; 726const int32_t KeyEvent::KEYCODE_JOURNAL = 2718; 727const int32_t KeyEvent::KEYCODE_CONTROLPANEL = 2719; 728const int32_t KeyEvent::KEYCODE_APPSELECT = 2720; 729const int32_t KeyEvent::KEYCODE_SCREENSAVER = 2721; 730const int32_t KeyEvent::KEYCODE_ASSISTANT = 2722; 731const int32_t KeyEvent::KEYCODE_KBD_LAYOUT_NEXT = 2723; 732const int32_t KeyEvent::KEYCODE_BRIGHTNESS_MIN = 2724; 733const int32_t KeyEvent::KEYCODE_BRIGHTNESS_MAX = 2725; 734const int32_t KeyEvent::KEYCODE_KBDINPUTASSIST_PREV = 2726; 735const int32_t KeyEvent::KEYCODE_KBDINPUTASSIST_NEXT = 2727; 736const int32_t KeyEvent::KEYCODE_KBDINPUTASSIST_PREVGROUP = 2728; 737const int32_t KeyEvent::KEYCODE_KBDINPUTASSIST_NEXTGROUP = 2729; 738const int32_t KeyEvent::KEYCODE_KBDINPUTASSIST_ACCEPT = 2730; 739const int32_t KeyEvent::KEYCODE_KBDINPUTASSIST_CANCEL = 2731; 740const int32_t KeyEvent::KEYCODE_FRONT = 2800; 741const int32_t KeyEvent::KEYCODE_SETUP = 2801; 742const int32_t KeyEvent::KEYCODE_WAKEUP = 2802; 743const int32_t KeyEvent::KEYCODE_SENDFILE = 2803; 744const int32_t KeyEvent::KEYCODE_DELETEFILE = 2804; 745const int32_t KeyEvent::KEYCODE_XFER = 2805; 746const int32_t KeyEvent::KEYCODE_PROG1 = 2806; 747const int32_t KeyEvent::KEYCODE_PROG2 = 2807; 748const int32_t KeyEvent::KEYCODE_MSDOS = 2808; 749const int32_t KeyEvent::KEYCODE_SCREENLOCK = 2809; 750const int32_t KeyEvent::KEYCODE_DIRECTION_ROTATE_DISPLAY = 2810; 751const int32_t KeyEvent::KEYCODE_CYCLEWINDOWS = 2811; 752const int32_t KeyEvent::KEYCODE_COMPUTER = 2812; 753const int32_t KeyEvent::KEYCODE_EJECTCLOSECD = 2813; 754const int32_t KeyEvent::KEYCODE_ISO = 2814; 755const int32_t KeyEvent::KEYCODE_MOVE = 2815; 756const int32_t KeyEvent::KEYCODE_F13 = 2816; 757const int32_t KeyEvent::KEYCODE_F14 = 2817; 758const int32_t KeyEvent::KEYCODE_F15 = 2818; 759const int32_t KeyEvent::KEYCODE_F16 = 2819; 760const int32_t KeyEvent::KEYCODE_F17 = 2820; 761const int32_t KeyEvent::KEYCODE_F18 = 2821; 762const int32_t KeyEvent::KEYCODE_F19 = 2822; 763const int32_t KeyEvent::KEYCODE_F20 = 2823; 764const int32_t KeyEvent::KEYCODE_F21 = 2824; 765const int32_t KeyEvent::KEYCODE_F22 = 2825; 766const int32_t KeyEvent::KEYCODE_F23 = 2826; 767const int32_t KeyEvent::KEYCODE_F24 = 2827; 768const int32_t KeyEvent::KEYCODE_PROG3 = 2828; 769const int32_t KeyEvent::KEYCODE_PROG4 = 2829; 770const int32_t KeyEvent::KEYCODE_DASHBOARD = 2830; 771const int32_t KeyEvent::KEYCODE_SUSPEND = 2831; 772const int32_t KeyEvent::KEYCODE_HP = 2832; 773const int32_t KeyEvent::KEYCODE_SOUND = 2833; 774const int32_t KeyEvent::KEYCODE_QUESTION = 2834; 775const int32_t KeyEvent::KEYCODE_CONNECT = 2836; 776const int32_t KeyEvent::KEYCODE_SPORT = 2837; 777const int32_t KeyEvent::KEYCODE_SHOP = 2838; 778const int32_t KeyEvent::KEYCODE_ALTERASE = 2839; 779const int32_t KeyEvent::KEYCODE_SWITCHVIDEOMODE = 2841; 780const int32_t KeyEvent::KEYCODE_BATTERY = 2842; 781const int32_t KeyEvent::KEYCODE_BLUETOOTH = 2843; 782const int32_t KeyEvent::KEYCODE_WLAN = 2844; 783const int32_t KeyEvent::KEYCODE_UWB = 2845; 784const int32_t KeyEvent::KEYCODE_WWAN_WIMAX = 2846; 785const int32_t KeyEvent::KEYCODE_RFKILL = 2847; 786const int32_t KeyEvent::KEYCODE_STYLUS_SCREEN = 2849; 787const int32_t KeyEvent::KEYCODE_CHANNEL = 3001; 788const int32_t KeyEvent::KEYCODE_BTN_0 = 3100; 789const int32_t KeyEvent::KEYCODE_BTN_1 = 3101; 790const int32_t KeyEvent::KEYCODE_BTN_2 = 3102; 791const int32_t KeyEvent::KEYCODE_BTN_3 = 3103; 792const int32_t KeyEvent::KEYCODE_BTN_4 = 3104; 793const int32_t KeyEvent::KEYCODE_BTN_5 = 3105; 794const int32_t KeyEvent::KEYCODE_BTN_6 = 3106; 795const int32_t KeyEvent::KEYCODE_BTN_7 = 3107; 796const int32_t KeyEvent::KEYCODE_BTN_8 = 3108; 797const int32_t KeyEvent::KEYCODE_BTN_9 = 3109; 798const int32_t KeyEvent::KEYCODE_BRL_DOT1 = 3201; 799const int32_t KeyEvent::KEYCODE_BRL_DOT2 = 3202; 800const int32_t KeyEvent::KEYCODE_BRL_DOT3 = 3203; 801const int32_t KeyEvent::KEYCODE_BRL_DOT4 = 3204; 802const int32_t KeyEvent::KEYCODE_BRL_DOT5 = 3205; 803const int32_t KeyEvent::KEYCODE_BRL_DOT6 = 3206; 804const int32_t KeyEvent::KEYCODE_BRL_DOT7 = 3207; 805const int32_t KeyEvent::KEYCODE_BRL_DOT8 = 3208; 806const int32_t KeyEvent::KEYCODE_BRL_DOT9 = 3209; 807const int32_t KeyEvent::KEYCODE_BRL_DOT10 = 3210; 808const int32_t KeyEvent::KEYCODE_LEFT_KNOB_ROLL_UP = 10001; 809const int32_t KeyEvent::KEYCODE_LEFT_KNOB_ROLL_DOWN = 10002; 810const int32_t KeyEvent::KEYCODE_LEFT_KNOB = 10003; 811const int32_t KeyEvent::KEYCODE_RIGHT_KNOB_ROLL_UP = 10004; 812const int32_t KeyEvent::KEYCODE_RIGHT_KNOB_ROLL_DOWN = 10005; 813const int32_t KeyEvent::KEYCODE_RIGHT_KNOB = 10006; 814const int32_t KeyEvent::KEYCODE_VOICE_SOURCE_SWITCH = 10007; 815const int32_t KeyEvent::KEYCODE_LAUNCHER_MENU = 10008; 816const int32_t KeyEvent::KEYCODE_CALL_NOTIFICATION_CENTER = 10009; 817const int32_t KeyEvent::KEYCODE_CALL_CONTROL_CENTER = 10010; 818 819const int32_t KeyEvent::KEY_ACTION_UNKNOWN = 0X00000000; 820const int32_t KeyEvent::KEY_ACTION_CANCEL = 0X00000001; 821 822const int32_t KeyEvent::KEY_ACTION_DOWN = 0x00000002; 823const int32_t KeyEvent::KEY_ACTION_UP = 0X00000003; 824 825const int32_t KeyEvent::INTENTION_UNKNOWN = -1; 826const int32_t KeyEvent::INTENTION_UP = 1; 827const int32_t KeyEvent::INTENTION_DOWN = 2; 828const int32_t KeyEvent::INTENTION_LEFT = 3; 829const int32_t KeyEvent::INTENTION_RIGHT = 4; 830const int32_t KeyEvent::INTENTION_SELECT = 5; 831const int32_t KeyEvent::INTENTION_ESCAPE = 6; 832const int32_t KeyEvent::INTENTION_BACK = 7; 833const int32_t KeyEvent::INTENTION_FORWARD = 8; 834const int32_t KeyEvent::INTENTION_MENU = 9; 835const int32_t KeyEvent::INTENTION_HOME = 10; 836const int32_t KeyEvent::INTENTION_PAGE_UP = 11; 837const int32_t KeyEvent::INTENTION_PAGE_DOWN = 12; 838const int32_t KeyEvent::INTENTION_ZOOM_OUT = 13; 839const int32_t KeyEvent::INTENTION_ZOOM_IN = 14; 840 841const int32_t KeyEvent::INTENTION_MEDIA_PLAY_PAUSE = 100; 842const int32_t KeyEvent::INTENTION_MEDIA_FAST_FORWARD = 101; 843const int32_t KeyEvent::INTENTION_MEDIA_FAST_REWIND = 102; 844const int32_t KeyEvent::INTENTION_MEDIA_FAST_PLAYBACK = 103; 845const int32_t KeyEvent::INTENTION_MEDIA_NEXT = 104; 846const int32_t KeyEvent::INTENTION_MEDIA_PREVIOUS = 105; 847const int32_t KeyEvent::INTENTION_MEDIA_MUTE = 106; 848const int32_t KeyEvent::INTENTION_VOLUTE_UP = 107; 849const int32_t KeyEvent::INTENTION_VOLUTE_DOWN = 108; 850 851const int32_t KeyEvent::INTENTION_CALL = 200; 852const int32_t KeyEvent::INTENTION_ENDCALL = 201; 853const int32_t KeyEvent::INTENTION_REJECTCALL = 202; 854 855const int32_t KeyEvent::INTENTION_CAMERA = 300; 856const int32_t maxKeysSize = 1000; 857 858#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 859constexpr size_t MAX_N_ENHANCE_DATA_SIZE { 64 }; 860#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 861 862KeyEvent::KeyItem::KeyItem() {} 863 864KeyEvent::KeyItem::~KeyItem() {} 865 866int32_t KeyEvent::KeyItem::GetKeyCode() const 867{ 868 return keyCode_; 869} 870 871void KeyEvent::KeyItem::SetKeyCode(int32_t keyCode) 872{ 873 keyCode_ = keyCode; 874} 875 876int64_t KeyEvent::KeyItem::GetDownTime() const 877{ 878 return downTime_; 879} 880 881void KeyEvent::KeyItem::SetDownTime(int64_t downTime) 882{ 883 downTime_ = downTime; 884} 885 886int32_t KeyEvent::KeyItem::GetDeviceId() const 887{ 888 return deviceId_; 889} 890 891void KeyEvent::KeyItem::SetDeviceId(int32_t deviceId) 892{ 893 deviceId_ = deviceId; 894} 895 896bool KeyEvent::KeyItem::IsPressed() const 897{ 898 return pressed_; 899} 900 901void KeyEvent::KeyItem::SetPressed(bool pressed) 902{ 903 pressed_ = pressed; 904} 905 906void KeyEvent::KeyItem::SetUnicode(uint32_t unicode) 907{ 908 unicode_ = unicode; 909} 910 911uint32_t KeyEvent::KeyItem::GetUnicode() const 912{ 913 return unicode_; 914} 915 916bool KeyEvent::KeyItem::WriteToParcel(Parcel &out) const 917{ 918 WRITEBOOL(out, pressed_); 919 WRITEINT64(out, downTime_); 920 WRITEINT32(out, deviceId_); 921 WRITEINT32(out, keyCode_); 922 923 return true; 924} 925 926bool KeyEvent::KeyItem::ReadFromParcel(Parcel &in) 927{ 928 READBOOL(in, pressed_); 929 READINT64(in, downTime_); 930 READINT32(in, deviceId_); 931 READINT32(in, keyCode_); 932 933 return true; 934} 935 936std::shared_ptr<KeyEvent> KeyEvent::from(std::shared_ptr<InputEvent> inputEvent) 937{ 938 return nullptr; 939} 940 941KeyEvent::KeyEvent(int32_t eventType) : InputEvent(eventType) {} 942 943KeyEvent::KeyEvent(const KeyEvent& other) 944 : InputEvent(other), 945 keyCode_(other.keyCode_), 946 keys_(other.keys_), 947 keyAction_(other.keyAction_), 948 keyIntention_(other.keyIntention_), 949 numLock_(other.numLock_), 950 capsLock_(other.capsLock_), 951 scrollLock_(other.scrollLock_), 952#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 953 enhanceData_(other.enhanceData_), 954#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 955#ifdef OHOS_BUILD_ENABLE_VKEYBOARD 956 vkeyboardAction_(other.vkeyboardAction_), 957 keyName_(other.keyName_), 958#endif // OHOS_BUILD_ENABLE_VKEYBOARD 959 repeat_(other.repeat_), 960 repeatKey_(other.repeatKey_) {} 961 962KeyEvent::~KeyEvent() {} 963 964std::shared_ptr<KeyEvent> KeyEvent::Create() 965{ 966 auto event = std::shared_ptr<KeyEvent>(new (std::nothrow) KeyEvent(InputEvent::EVENT_TYPE_KEY)); 967 CHKPP(event); 968 return event; 969} 970 971void KeyEvent::Reset() 972{ 973 InputEvent::Reset(); 974 keyCode_ = KeyEvent::UNKNOWN_FUNCTION_KEY; 975 keyAction_ = KeyEvent::KEY_ACTION_UNKNOWN; 976 keyIntention_ = KeyEvent::INTENTION_UNKNOWN; 977 numLock_ = false; 978 capsLock_ = false; 979 scrollLock_ = false; 980 repeat_ = false; 981 repeatKey_ = false; 982 keys_.clear(); 983#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 984 enhanceData_.clear(); 985#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 986#ifdef OHOS_BUILD_ENABLE_VKEYBOARD 987 vkeyboardAction_ = VKeyboardAction::UNKNOWN; 988 keyName_ = ""; 989#endif // OHOS_BUILD_ENABLE_VKEYBOARD 990} 991 992std::string KeyEvent::ToString() 993{ 994 std::string eventStr = InputEvent::ToString(); 995 eventStr += ",keyCode:" + std::to_string(keyCode_); 996 eventStr += ",keyAction:" + std::to_string(keyAction_); 997 eventStr += ",keyItems:["; 998 for (size_t i = 0; i < keys_.size(); i++) { 999 int32_t pressed = keys_[i].IsPressed() ? 1 : 0; 1000 eventStr += "{pressed:" + std::to_string(pressed); 1001 eventStr += ",deviceId:" + std::to_string(keys_[i].GetDeviceId()); 1002 eventStr += ",keyCode:" + std::to_string(keys_[i].GetKeyCode()); 1003 eventStr += ",downTime:" + std::to_string(keys_[i].GetDownTime()); 1004 eventStr += ",unicode:" + std::to_string(keys_[i].GetUnicode()) + "}"; 1005 if (i != keys_.size() - 1) { 1006 eventStr += ","; 1007 } 1008 } 1009 eventStr += "]"; 1010 return eventStr; 1011} 1012 1013int32_t KeyEvent::GetKeyCode() const 1014{ 1015 return keyCode_; 1016} 1017 1018void KeyEvent::SetKeyCode(int32_t keyCode) 1019{ 1020 keyCode_ = keyCode; 1021} 1022 1023int32_t KeyEvent::GetKeyAction() const 1024{ 1025 return keyAction_; 1026} 1027 1028void KeyEvent::SetKeyAction(int32_t keyAction) 1029{ 1030 keyAction_ = keyAction; 1031} 1032 1033void KeyEvent::AddKeyItem(const KeyItem& keyItem) 1034{ 1035 keys_.push_back(keyItem); 1036} 1037 1038void KeyEvent::SetKeyItem(std::vector<KeyItem> keyItem) 1039{ 1040 keys_ = keyItem; 1041} 1042 1043std::vector<KeyEvent::KeyItem> KeyEvent::GetKeyItems() const 1044{ 1045 return keys_; 1046} 1047 1048std::vector<int32_t> KeyEvent::GetPressedKeys() const 1049{ 1050 std::vector<int32_t> result; 1051 for (const auto &item : keys_) { 1052 if (item.IsPressed()) { 1053 result.push_back(item.GetKeyCode()); 1054 } 1055 } 1056 return result; 1057} 1058 1059void KeyEvent::AddPressedKeyItems(const KeyItem& keyItem) 1060{ 1061 std::vector<int32_t> pressedkeys = GetPressedKeys(); 1062 std::vector<int32_t>::iterator result = std::find(pressedkeys.begin(), 1063 pressedkeys.end(), keyItem.GetKeyCode()); 1064 if (result == pressedkeys.end()) { 1065 keys_.push_back(keyItem); 1066 } 1067} 1068 1069void KeyEvent::RemoveReleasedKeyItems(const KeyItem& keyItem) 1070{ 1071 if (keyItem.IsPressed()) { 1072 return; 1073 } 1074 int32_t keyCode = keyItem.GetKeyCode(); 1075 for (auto it = keys_.begin(); it != keys_.end(); ++it) { 1076 if (it->GetKeyCode() == keyCode) { 1077 keys_.erase(it); 1078 return; 1079 } 1080 } 1081} 1082 1083std::optional<KeyEvent::KeyItem> KeyEvent::GetKeyItem() const 1084{ 1085 return GetKeyItem(keyCode_); 1086} 1087 1088std::optional<KeyEvent::KeyItem> KeyEvent::GetKeyItem(int32_t keyCode) const 1089{ 1090 for (const auto &item : keys_) { 1091 if (item.GetKeyCode() == keyCode) { 1092 return std::make_optional(item); 1093 } 1094 } 1095 return std::nullopt; 1096} 1097 1098const char* KeyEvent::ActionToString(int32_t action) 1099{ 1100 switch (action) { 1101 case KEY_ACTION_UNKNOWN: { 1102 return "KEY_ACTION_UNKNOWN"; 1103 } 1104 case KEY_ACTION_CANCEL: { 1105 return "KEY_ACTION_CANCEL"; 1106 } 1107 case KEY_ACTION_DOWN: { 1108 return "KEY_ACTION_DOWN"; 1109 } 1110 case KEY_ACTION_UP: { 1111 return "KEY_ACTION_UP"; 1112 } 1113 default: { 1114 return "KEY_ACTION_INVALID"; 1115 } 1116 } 1117} 1118 1119const char* KeyEvent::KeyCodeToString(int32_t keyCode) 1120{ 1121 CALL_DEBUG_ENTER; 1122 auto iter = KEYCODE_TO_STRING.find(keyCode); 1123 if (iter == KEYCODE_TO_STRING.end()) { 1124 MMI_HILOGD("Failed to find the keycode"); 1125 return "KEYCODE_INVALID"; 1126 } 1127 return iter->second.c_str(); 1128} 1129 1130std::shared_ptr<KeyEvent> KeyEvent::Clone(std::shared_ptr<KeyEvent> keyEvent) 1131{ 1132 if (!keyEvent) { 1133 return nullptr; 1134 } 1135 auto event = std::shared_ptr<KeyEvent>(new (std::nothrow) KeyEvent(*keyEvent.get())); 1136 CHKPP(event); 1137 return event; 1138} 1139 1140bool KeyEvent::IsValidKeyItem() const 1141{ 1142 CALL_DEBUG_ENTER; 1143 int32_t sameKeyCodeNum = 0; 1144 int32_t keyCode = GetKeyCode(); 1145 int32_t action = GetKeyAction(); 1146 1147 for (auto it = keys_.begin(); it != keys_.end(); ++it) { 1148 if (it->GetKeyCode() == keyCode) { 1149 if (++sameKeyCodeNum > 1) { 1150 MMI_HILOGE("Keyitems keyCode is not unique with keyEvent keyCode"); 1151 return false; 1152 } 1153 } 1154 if (it->GetKeyCode() <= KEYCODE_UNKNOWN) { 1155 MMI_HILOGE("The keyCode is invalid"); 1156 return false; 1157 } 1158 if (it->GetDownTime() <= 0) { 1159 MMI_HILOGE("The downtime is invalid"); 1160 return false; 1161 } 1162 if (action != KEY_ACTION_UP && it->IsPressed() == false) { 1163 MMI_HILOGE("The isPressed is invalid"); 1164 return false; 1165 } 1166 if (action == KEY_ACTION_UP && it->IsPressed() == false) { 1167 if (it->GetKeyCode() != keyCode) { 1168 MMI_HILOGE("The keyCode is invalid when isPressed is false"); 1169 return false; 1170 } 1171 } 1172 1173 auto item = it; 1174 for (++item; item != keys_.end(); item++) { 1175 if (it->GetKeyCode() == item->GetKeyCode()) { 1176 MMI_HILOGE("Keyitems keyCode exist same items"); 1177 return false; 1178 } 1179 } 1180 } 1181 1182 if (sameKeyCodeNum == 0) { 1183 MMI_HILOGE("Keyitems keyCode is not exist equal item with keyEvent keyCode"); 1184 return false; 1185 } 1186 return true; 1187} 1188 1189bool KeyEvent::IsValid() const 1190{ 1191 CALL_DEBUG_ENTER; 1192 int32_t keyCode = GetKeyCode(); 1193 if (keyCode <= KEYCODE_UNKNOWN) { 1194 MMI_HILOGE("KeyCode_ is invalid"); 1195 return false; 1196 } 1197 1198 if (GetActionTime() <= 0) { 1199 MMI_HILOGE("Actiontime is invalid"); 1200 return false; 1201 } 1202 1203 int32_t action = GetKeyAction(); 1204 if (action != KEY_ACTION_CANCEL && action != KEY_ACTION_UP && 1205 action != KEY_ACTION_DOWN) { 1206 MMI_HILOGE("Action is invalid"); 1207 return false; 1208 } 1209 1210 if (!IsValidKeyItem()) { 1211 MMI_HILOGE("IsValidKeyItem is invalid"); 1212 return false; 1213 } 1214 return true; 1215} 1216 1217bool KeyEvent::WriteToParcel(Parcel &out) const 1218{ 1219 if (!InputEvent::WriteToParcel(out)) { 1220 return false; 1221 } 1222 WRITEINT32(out, keyCode_); 1223 if (keys_.size() > INT_MAX) { 1224 return false; 1225 } 1226 WRITEINT32(out, static_cast<int32_t>(keys_.size())); 1227 for (const auto &item : keys_) { 1228 if (!item.WriteToParcel(out)) { 1229 return false; 1230 } 1231 } 1232 WRITEINT32(out, keyAction_); 1233 WRITEINT32(out, keyIntention_); 1234 WRITEBOOL(out, numLock_); 1235 WRITEBOOL(out, capsLock_); 1236 WRITEBOOL(out, scrollLock_); 1237 WRITEBOOL(out, repeat_); 1238#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1239 WRITEINT32(out, static_cast<int32_t>(enhanceData_.size())); 1240 for (uint32_t i = 0; i < enhanceData_.size(); i++) { 1241 WRITEUINT32(out, enhanceData_[i]); 1242 } 1243#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1244#ifdef OHOS_BUILD_ENABLE_VKEYBOARD 1245 WRITEINT32(out, static_cast<int32_t>(vkeyboardAction_)); 1246 WRITESTRING(out, keyName_); 1247#endif // OHOS_BUILD_ENABLE_VKEYBOARD 1248 return true; 1249} 1250 1251bool KeyEvent::ReadFromParcel(Parcel &in) 1252{ 1253 if (!InputEvent::ReadFromParcel(in)) { 1254 return false; 1255 } 1256 READINT32(in, keyCode_); 1257 const int32_t keysSize = in.ReadInt32(); 1258 if (keysSize < 0 || keysSize > maxKeysSize) { 1259 return false; 1260 } 1261 for (int32_t i = 0; i < keysSize; i++) { 1262 KeyItem val = {}; 1263 if (!val.ReadFromParcel(in)) { 1264 return false; 1265 } 1266 keys_.push_back(val); 1267 } 1268 READINT32(in, keyAction_); 1269 READINT32(in, keyIntention_); 1270 READBOOL(in, numLock_); 1271 READBOOL(in, capsLock_); 1272 READBOOL(in, scrollLock_); 1273 READBOOL(in, repeat_); 1274#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1275 if (!ReadEnhanceDataFromParcel(in)) { 1276 return false; 1277 } 1278#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1279#ifdef OHOS_BUILD_ENABLE_VKEYBOARD 1280 int32_t vkAction = 0; 1281 READINT32(in, vkAction); 1282 vkeyboardAction_ = static_cast<VKeyboardAction>(vkAction); 1283 READSTRING(in, keyName_); 1284#endif // OHOS_BUILD_ENABLE_VKEYBOARD 1285 return true; 1286} 1287 1288#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1289bool KeyEvent::ReadEnhanceDataFromParcel(Parcel &in) 1290{ 1291 int32_t size = 0; 1292 READINT32(in, size); 1293 if (size > static_cast<int32_t>(MAX_N_ENHANCE_DATA_SIZE) || size < 0) { 1294 MMI_HILOGE("key event enhanceData_ size is invalid"); 1295 return false; 1296 } 1297 1298 for (int32_t i = 0; i < size; i++) { 1299 uint32_t val = 0; 1300 READUINT32(in, val); 1301 enhanceData_.emplace_back(val); 1302 } 1303 return true; 1304} 1305#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1306 1307int32_t KeyEvent::TransitionFunctionKey(int32_t keyCode) 1308{ 1309 switch (keyCode) { 1310 case KEYCODE_NUM_LOCK: { 1311 return NUM_LOCK_FUNCTION_KEY; 1312 } 1313 case KEYCODE_CAPS_LOCK: { 1314 return CAPS_LOCK_FUNCTION_KEY; 1315 } 1316 case KEYCODE_SCROLL_LOCK: { 1317 return SCROLL_LOCK_FUNCTION_KEY; 1318 } 1319 default: { 1320 MMI_HILOGW("Unknown key code:%d", keyCode); 1321 return UNKNOWN_FUNCTION_KEY; 1322 } 1323 } 1324} 1325 1326bool KeyEvent::GetFunctionKey(int32_t funcKey) const 1327{ 1328 switch (funcKey) { 1329 case NUM_LOCK_FUNCTION_KEY: { 1330 return numLock_; 1331 } 1332 case CAPS_LOCK_FUNCTION_KEY: { 1333 return capsLock_; 1334 } 1335 case SCROLL_LOCK_FUNCTION_KEY: { 1336 return scrollLock_; 1337 } 1338 default: { 1339 MMI_HILOGW("Unknown function key:%{public}d", funcKey); 1340 return false; 1341 } 1342 } 1343} 1344 1345int32_t KeyEvent::SetFunctionKey(int32_t funcKey, int32_t value) 1346{ 1347 bool state = static_cast<bool>(value); 1348 switch (funcKey) { 1349 case NUM_LOCK_FUNCTION_KEY: { 1350 numLock_ = state; 1351 return funcKey; 1352 } 1353 case CAPS_LOCK_FUNCTION_KEY: { 1354 capsLock_ = state; 1355 return funcKey; 1356 } 1357 case SCROLL_LOCK_FUNCTION_KEY: { 1358 scrollLock_ = state; 1359 return funcKey; 1360 } 1361 default: { 1362 MMI_HILOGW("Unknown function key:%{public}d", funcKey); 1363 return UNKNOWN_FUNCTION_KEY; 1364 } 1365 } 1366} 1367 1368int32_t KeyEvent::GetKeyIntention() const 1369{ 1370 return keyIntention_; 1371} 1372 1373void KeyEvent::SetKeyIntention(int32_t keyIntention) 1374{ 1375 keyIntention_ = keyIntention; 1376} 1377 1378bool KeyEvent::IsRepeat() const 1379{ 1380 return repeat_; 1381} 1382 1383void KeyEvent::SetRepeat(bool repeat) 1384{ 1385 repeat_ = repeat; 1386} 1387 1388bool KeyEvent::IsRepeatKey() const 1389{ 1390 return repeatKey_; 1391} 1392 1393void KeyEvent::SetRepeatKey(bool repeatKey) 1394{ 1395 repeatKey_ = repeatKey; 1396} 1397 1398std::string_view KeyEvent::ActionToShortStr(int32_t action) 1399{ 1400 switch (action) { 1401 case KeyEvent::KEY_ACTION_CANCEL: 1402 return "K:C:"; 1403 case KeyEvent::KEY_ACTION_UNKNOWN: 1404 return "K:UK:"; 1405 case KeyEvent::KEY_ACTION_UP: 1406 return "K:U:"; 1407 case KeyEvent::KEY_ACTION_DOWN: 1408 return "K:D:"; 1409 default: 1410 return "A:?:"; 1411 } 1412} 1413 1414#ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1415void KeyEvent::SetEnhanceData(const std::vector<uint8_t> enhanceData) 1416{ 1417 enhanceData_ = enhanceData; 1418} 1419 1420std::vector<uint8_t> KeyEvent::GetEnhanceData() const 1421{ 1422 return enhanceData_; 1423} 1424#endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 1425 1426#ifdef OHOS_BUILD_ENABLE_VKEYBOARD 1427KeyEvent::VKeyboardAction KeyEvent::GetVKeyboardAction() const 1428{ 1429 return vkeyboardAction_; 1430} 1431 1432void KeyEvent::SetVKeyboardAction(VKeyboardAction vkAction) 1433{ 1434 vkeyboardAction_ = vkAction; 1435} 1436 1437const char* KeyEvent::VKeyboardActionToStr(VKeyboardAction vKeyAction) 1438{ 1439 switch (vKeyAction) { 1440 case VKeyboardAction::ACTIVATE_KEYBOARD: 1441 return "ACTIVATE_KEYBOARD"; 1442 case VKeyboardAction::VKEY_DOWN: 1443 return "VKEY_DOWN"; 1444 case VKeyboardAction::VKEY_UP: 1445 return "VKEY_UP"; 1446 case VKeyboardAction::RESET_BUTTON_COLOR: 1447 return "RESET_BUTTON_COLOR"; 1448 case VKeyboardAction::TWO_FINGERS_IN: 1449 return "TWO_FINGERS_IN"; 1450 case VKeyboardAction::TWO_FINGERS_OUT: 1451 return "TWO_FINGERS_OUT"; 1452 case VKeyboardAction::TWO_HANDS_UP: 1453 return "TWO_HANDS_UP"; 1454 case VKeyboardAction::TWO_HANDS_DOWN: 1455 return "TWO_HANDS_DOWN"; 1456 default: 1457 MMI_HILOGW("Unknown virtual keyboard action:%{public}d", static_cast<int>(vKeyAction)); 1458 return "UNKNOWN"; 1459 } 1460} 1461 1462std::string KeyEvent::GetKeyName() const 1463{ 1464 return keyName_; 1465} 1466 1467void KeyEvent::SetKeyName(const std::string& keyName) 1468{ 1469 keyName_ = keyName; 1470} 1471#endif // OHOS_BUILD_ENABLE_VKEYBOARD 1472} // namespace MMI 1473} // namespace OHOS 1474