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