1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _UI_KEYCODE_LABELS_H 18 #define _UI_KEYCODE_LABELS_H 19 20 struct KeycodeLabel { 21 const char *literal; 22 int value; 23 }; 24 25 static const KeycodeLabel KEYCODES[] = { 26 { "SOFT_LEFT", 1 }, 27 { "SOFT_RIGHT", 2 }, 28 { "HOME", 3 }, 29 { "BACK", 4 }, 30 { "CALL", 5 }, 31 { "ENDCALL", 6 }, 32 { "0", 7 }, 33 { "1", 8 }, 34 { "2", 9 }, 35 { "3", 10 }, 36 { "4", 11 }, 37 { "5", 12 }, 38 { "6", 13 }, 39 { "7", 14 }, 40 { "8", 15 }, 41 { "9", 16 }, 42 { "STAR", 17 }, 43 { "POUND", 18 }, 44 { "DPAD_UP", 19 }, 45 { "DPAD_DOWN", 20 }, 46 { "DPAD_LEFT", 21 }, 47 { "DPAD_RIGHT", 22 }, 48 { "DPAD_CENTER", 23 }, 49 { "VOLUME_UP", 24 }, 50 { "VOLUME_DOWN", 25 }, 51 { "POWER", 26 }, 52 { "CAMERA", 27 }, 53 { "CLEAR", 28 }, 54 { "A", 29 }, 55 { "B", 30 }, 56 { "C", 31 }, 57 { "D", 32 }, 58 { "E", 33 }, 59 { "F", 34 }, 60 { "G", 35 }, 61 { "H", 36 }, 62 { "I", 37 }, 63 { "J", 38 }, 64 { "K", 39 }, 65 { "L", 40 }, 66 { "M", 41 }, 67 { "N", 42 }, 68 { "O", 43 }, 69 { "P", 44 }, 70 { "Q", 45 }, 71 { "R", 46 }, 72 { "S", 47 }, 73 { "T", 48 }, 74 { "U", 49 }, 75 { "V", 50 }, 76 { "W", 51 }, 77 { "X", 52 }, 78 { "Y", 53 }, 79 { "Z", 54 }, 80 { "COMMA", 55 }, 81 { "PERIOD", 56 }, 82 { "ALT_LEFT", 57 }, 83 { "ALT_RIGHT", 58 }, 84 { "SHIFT_LEFT", 59 }, 85 { "SHIFT_RIGHT", 60 }, 86 { "TAB", 61 }, 87 { "SPACE", 62 }, 88 { "SYM", 63 }, 89 { "EXPLORER", 64 }, 90 { "ENVELOPE", 65 }, 91 { "ENTER", 66 }, 92 { "DEL", 67 }, 93 { "GRAVE", 68 }, 94 { "MINUS", 69 }, 95 { "EQUALS", 70 }, 96 { "LEFT_BRACKET", 71 }, 97 { "RIGHT_BRACKET", 72 }, 98 { "BACKSLASH", 73 }, 99 { "SEMICOLON", 74 }, 100 { "APOSTROPHE", 75 }, 101 { "SLASH", 76 }, 102 { "AT", 77 }, 103 { "NUM", 78 }, 104 { "HEADSETHOOK", 79 }, 105 { "FOCUS", 80 }, 106 { "PLUS", 81 }, 107 { "MENU", 82 }, 108 { "NOTIFICATION", 83 }, 109 { "SEARCH", 84 }, 110 { "MEDIA_PLAY_PAUSE", 85 }, 111 { "MEDIA_STOP", 86 }, 112 { "MEDIA_NEXT", 87 }, 113 { "MEDIA_PREVIOUS", 88 }, 114 { "MEDIA_REWIND", 89 }, 115 { "MEDIA_FAST_FORWARD", 90 }, 116 { "MUTE", 91 }, 117 118 // NOTE: If you add a new keycode here you must also add it to: 119 // (enum KeyCode, in this file) 120 // frameworks/base/core/java/android/view/KeyEvent.java 121 // tools/puppet_master/PuppetMaster.nav_keys.py 122 // frameworks/base/core/res/res/values/attrs.xml 123 124 { NULL, 0 } 125 }; 126 127 // These constants need to match the above mappings. 128 typedef enum KeyCode { 129 kKeyCodeUnknown = 0, 130 131 kKeyCodeSoftLeft = 1, 132 kKeyCodeSoftRight = 2, 133 kKeyCodeHome = 3, 134 kKeyCodeBack = 4, 135 kKeyCodeCall = 5, 136 kKeyCodeEndCall = 6, 137 kKeyCode0 = 7, 138 kKeyCode1 = 8, 139 kKeyCode2 = 9, 140 kKeyCode3 = 10, 141 kKeyCode4 = 11, 142 kKeyCode5 = 12, 143 kKeyCode6 = 13, 144 kKeyCode7 = 14, 145 kKeyCode8 = 15, 146 kKeyCode9 = 16, 147 kKeyCodeStar = 17, 148 kKeyCodePound = 18, 149 kKeyCodeDpadUp = 19, 150 kKeyCodeDpadDown = 20, 151 kKeyCodeDpadLeft = 21, 152 kKeyCodeDpadRight = 22, 153 kKeyCodeDpadCenter = 23, 154 kKeyCodeVolumeUp = 24, 155 kKeyCodeVolumeDown = 25, 156 kKeyCodePower = 26, 157 kKeyCodeCamera = 27, 158 kKeyCodeClear = 28, 159 kKeyCodeA = 29, 160 kKeyCodeB = 30, 161 kKeyCodeC = 31, 162 kKeyCodeD = 32, 163 kKeyCodeE = 33, 164 kKeyCodeF = 34, 165 kKeyCodeG = 35, 166 kKeyCodeH = 36, 167 kKeyCodeI = 37, 168 kKeyCodeJ = 38, 169 kKeyCodeK = 39, 170 kKeyCodeL = 40, 171 kKeyCodeM = 41, 172 kKeyCodeN = 42, 173 kKeyCodeO = 43, 174 kKeyCodeP = 44, 175 kKeyCodeQ = 45, 176 kKeyCodeR = 46, 177 kKeyCodeS = 47, 178 kKeyCodeT = 48, 179 kKeyCodeU = 49, 180 kKeyCodeV = 50, 181 kKeyCodeW = 51, 182 kKeyCodeX = 52, 183 kKeyCodeY = 53, 184 kKeyCodeZ = 54, 185 kKeyCodeComma = 55, 186 kKeyCodePeriod = 56, 187 kKeyCodeAltLeft = 57, 188 kKeyCodeAltRight = 58, 189 kKeyCodeShiftLeft = 59, 190 kKeyCodeShiftRight = 60, 191 kKeyCodeTab = 61, 192 kKeyCodeSpace = 62, 193 kKeyCodeSym = 63, 194 kKeyCodeExplorer = 64, 195 kKeyCodeEnvelope = 65, 196 kKeyCodeNewline = 66, 197 kKeyCodeDel = 67, 198 kKeyCodeGrave = 68, 199 kKeyCodeMinus = 69, 200 kKeyCodeEquals = 70, 201 kKeyCodeLeftBracket = 71, 202 kKeyCodeRightBracket = 72, 203 kKeyCodeBackslash = 73, 204 kKeyCodeSemicolon = 74, 205 kKeyCodeApostrophe = 75, 206 kKeyCodeSlash = 76, 207 kKeyCodeAt = 77, 208 kKeyCodeNum = 78, 209 kKeyCodeHeadSetHook = 79, 210 kKeyCodeFocus = 80, 211 kKeyCodePlus = 81, 212 kKeyCodeMenu = 82, 213 kKeyCodeNotification = 83, 214 kKeyCodeSearch = 84, 215 kKeyCodePlayPause = 85, 216 kKeyCodeStop = 86, 217 kKeyCodeNextSong = 87, 218 kKeyCodePreviousSong = 88, 219 kKeyCodeRewind = 89, 220 kKeyCodeForward = 90, 221 kKeyCodeMute = 91 222 } KeyCode; 223 224 static const KeycodeLabel FLAGS[] = { 225 { "WAKE", 0x00000001 }, 226 { "WAKE_DROPPED", 0x00000002 }, 227 { "SHIFT", 0x00000004 }, 228 { "CAPS_LOCK", 0x00000008 }, 229 { "ALT", 0x00000010 }, 230 { "ALT_GR", 0x00000020 }, 231 { "MENU", 0x00000040 }, 232 { "LAUNCHER", 0x00000080 }, 233 { NULL, 0 } 234 }; 235 236 #endif // _UI_KEYCODE_LABELS_H 237