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