KeyCharacterMap.java revision 1e08fe90df18930691b0c2ec22e5db25d7fcb4cf
1/* 2 * Copyright (C) 2007 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 17package android.view; 18 19import android.text.method.MetaKeyKeyListener; 20import android.util.AndroidRuntimeException; 21import android.util.SparseIntArray; 22import android.os.RemoteException; 23import android.util.SparseArray; 24 25import java.lang.Character; 26 27/** 28 * Describes the keys provided by a keyboard device and their associated labels. 29 */ 30public class KeyCharacterMap { 31 /** 32 * The id of the device's primary built in keyboard is always 0. 33 * 34 * @deprecated This constant should no longer be used because there is no 35 * guarantee that a device has a built-in keyboard that can be used for 36 * typing text. There might not be a built-in keyboard, the built-in keyboard 37 * might be a {@link #NUMERIC} or {@link #SPECIAL_FUNCTION} keyboard, or there 38 * might be multiple keyboards installed including external keyboards. 39 * When interpreting key presses received from the framework, applications should 40 * use the device id specified in the {@link KeyEvent} received. 41 * When synthesizing key presses for delivery elsewhere or when translating key presses 42 * from unknown keyboards, applications should use the special {@link #VIRTUAL_KEYBOARD} 43 * device id. 44 */ 45 @Deprecated 46 public static final int BUILT_IN_KEYBOARD = 0; 47 48 /** 49 * The id of a generic virtual keyboard with a full layout that can be used to 50 * synthesize key events. Typically used with {@link #getEvents}. 51 */ 52 public static final int VIRTUAL_KEYBOARD = -1; 53 54 /** 55 * A numeric (12-key) keyboard. 56 * <p> 57 * A numeric keyboard supports text entry using a multi-tap approach. 58 * It may be necessary to tap a key multiple times to generate the desired letter 59 * or symbol. 60 * </p><p> 61 * This type of keyboard is generally designed for thumb typing. 62 * </p> 63 */ 64 public static final int NUMERIC = 1; 65 66 /** 67 * A keyboard with all the letters, but with more than one letter per key. 68 * <p> 69 * This type of keyboard is generally designed for thumb typing. 70 * </p> 71 */ 72 public static final int PREDICTIVE = 2; 73 74 /** 75 * A keyboard with all the letters, and maybe some numbers. 76 * <p> 77 * An alphabetic keyboard supports text entry directly but may have a condensed 78 * layout with a small form factor. In contrast to a {@link #FULL full keyboard}, some 79 * symbols may only be accessible using special on-screen character pickers. 80 * In addition, to improve typing speed and accuracy, the framework provides 81 * special affordances for alphabetic keyboards such as auto-capitalization 82 * and toggled / locked shift and alt keys. 83 * </p><p> 84 * This type of keyboard is generally designed for thumb typing. 85 * </p> 86 */ 87 public static final int ALPHA = 3; 88 89 /** 90 * A full PC-style keyboard. 91 * <p> 92 * A full keyboard behaves like a PC keyboard. All symbols are accessed directly 93 * by pressing keys on the keyboard without on-screen support or affordances such 94 * as auto-capitalization. 95 * </p><p> 96 * This type of keyboard is generally designed for full two hand typing. 97 * </p> 98 */ 99 public static final int FULL = 4; 100 101 /** 102 * A keyboard that is only used to control special functions rather than for typing. 103 * <p> 104 * A special function keyboard consists only of non-printing keys such as 105 * HOME and POWER that are not actually used for typing. 106 * </p> 107 */ 108 public static final int SPECIAL_FUNCTION = 5; 109 110 /** 111 * This private-use character is used to trigger Unicode character 112 * input by hex digits. 113 */ 114 public static final char HEX_INPUT = '\uEF00'; 115 116 /** 117 * This private-use character is used to bring up a character picker for 118 * miscellaneous symbols. 119 */ 120 public static final char PICKER_DIALOG_INPUT = '\uEF01'; 121 122 /** 123 * Modifier keys may be chorded with character keys. 124 * 125 * @see {#link #getModifierBehavior()} for more details. 126 */ 127 public static final int MODIFIER_BEHAVIOR_CHORDED = 0; 128 129 /** 130 * Modifier keys may be chorded with character keys or they may toggle 131 * into latched or locked states when pressed independently. 132 * 133 * @see {#link #getModifierBehavior()} for more details. 134 */ 135 public static final int MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED = 1; 136 137 private static SparseArray<KeyCharacterMap> sInstances = new SparseArray<KeyCharacterMap>(); 138 139 private final int mDeviceId; 140 private int mPtr; 141 142 private static native int nativeLoad(String file); 143 private static native void nativeDispose(int ptr); 144 145 private static native char nativeGetCharacter(int ptr, int keyCode, int metaState); 146 private static native boolean nativeGetFallbackAction(int ptr, int keyCode, int metaState, 147 FallbackAction outFallbackAction); 148 private static native char nativeGetNumber(int ptr, int keyCode); 149 private static native char nativeGetMatch(int ptr, int keyCode, char[] chars, int metaState); 150 private static native char nativeGetDisplayLabel(int ptr, int keyCode); 151 private static native int nativeGetKeyboardType(int ptr); 152 private static native KeyEvent[] nativeGetEvents(int ptr, int deviceId, char[] chars); 153 154 private KeyCharacterMap(int deviceId, int ptr) { 155 mDeviceId = deviceId; 156 mPtr = ptr; 157 } 158 159 @Override 160 protected void finalize() throws Throwable { 161 if (mPtr != 0) { 162 nativeDispose(mPtr); 163 mPtr = 0; 164 } 165 } 166 167 /** 168 * Loads the key character maps for the keyboard with the specified device id. 169 * 170 * @param deviceId The device id of the keyboard. 171 * @return The associated key character map. 172 * @throws {@link UnavailableException} if the key character map 173 * could not be loaded because it was malformed or the default key character map 174 * is missing from the system. 175 */ 176 public static KeyCharacterMap load(int deviceId) { 177 synchronized (sInstances) { 178 KeyCharacterMap map = sInstances.get(deviceId); 179 if (map == null) { 180 String kcm = null; 181 if (deviceId != VIRTUAL_KEYBOARD) { 182 InputDevice device = InputDevice.getDevice(deviceId); 183 if (device != null) { 184 kcm = device.getKeyCharacterMapFile(); 185 } 186 } 187 if (kcm == null || kcm.length() == 0) { 188 kcm = "/system/usr/keychars/Virtual.kcm"; 189 } 190 int ptr = nativeLoad(kcm); // might throw 191 map = new KeyCharacterMap(deviceId, ptr); 192 sInstances.put(deviceId, map); 193 } 194 return map; 195 } 196 } 197 198 /** 199 * Gets the Unicode character generated by the specified key and meta 200 * key state combination. 201 * <p> 202 * Returns the Unicode character that the specified key would produce 203 * when the specified meta bits (see {@link MetaKeyKeyListener}) 204 * were active. 205 * </p><p> 206 * Returns 0 if the key is not one that is used to type Unicode 207 * characters. 208 * </p><p> 209 * If the return value has bit {@link #COMBINING_ACCENT} set, the 210 * key is a "dead key" that should be combined with another to 211 * actually produce a character -- see {@link #getDeadChar} -- 212 * after masking with {@link #COMBINING_ACCENT_MASK}. 213 * </p> 214 * 215 * @param keyCode The key code. 216 * @param metaState The meta key modifier state. 217 * @return The associated character or combining accent, or 0 if none. 218 */ 219 public int get(int keyCode, int metaState) { 220 metaState = KeyEvent.normalizeMetaState(metaState); 221 char ch = nativeGetCharacter(mPtr, keyCode, metaState); 222 223 int map = COMBINING.get(ch); 224 if (map != 0) { 225 return map; 226 } else { 227 return ch; 228 } 229 } 230 231 /** 232 * Gets the fallback action to perform if the application does not 233 * handle the specified key. 234 * <p> 235 * When an application does not handle a particular key, the system may 236 * translate the key to an alternate fallback key (specified in the 237 * fallback action) and dispatch it to the application. 238 * The event containing the fallback key is flagged 239 * with {@link KeyEvent#FLAG_FALLBACK}. 240 * </p> 241 * 242 * @param keyCode The key code. 243 * @param metaState The meta key modifier state. 244 * @param outFallbackAction The fallback action object to populate. 245 * @return True if a fallback action was found, false otherwise. 246 * 247 * @hide 248 */ 249 public boolean getFallbackAction(int keyCode, int metaState, 250 FallbackAction outFallbackAction) { 251 if (outFallbackAction == null) { 252 throw new IllegalArgumentException("fallbackAction must not be null"); 253 } 254 255 metaState = KeyEvent.normalizeMetaState(metaState); 256 return nativeGetFallbackAction(mPtr, keyCode, metaState, outFallbackAction); 257 } 258 259 /** 260 * Gets the number or symbol associated with the key. 261 * <p> 262 * The character value is returned, not the numeric value. 263 * If the key is not a number, but is a symbol, the symbol is retuned. 264 * </p><p> 265 * This method is intended to to support dial pads and other numeric or 266 * symbolic entry on keyboards where certain keys serve dual function 267 * as alphabetic and symbolic keys. This method returns the number 268 * or symbol associated with the key independent of whether the user 269 * has pressed the required modifier. 270 * </p><p> 271 * For example, on one particular keyboard the keys on the top QWERTY row generate 272 * numbers when ALT is pressed such that ALT-Q maps to '1'. So for that keyboard 273 * when {@link #getNumber} is called with {@link KeyEvent#KEYCODE_Q} it returns '1' 274 * so that the user can type numbers without pressing ALT when it makes sense. 275 * </p> 276 * 277 * @param keyCode The key code. 278 * @return The associated numeric or symbolic character, or 0 if none. 279 */ 280 public char getNumber(int keyCode) { 281 return nativeGetNumber(mPtr, keyCode); 282 } 283 284 /** 285 * Gets the first character in the character array that can be generated 286 * by the specified key code. 287 * <p> 288 * This is a convenience function that returns the same value as 289 * {@link #getMatch(int,char[],int) getMatch(keyCode, chars, 0)}. 290 * </p> 291 * 292 * @param keyCode The keycode. 293 * @param chars The array of matching characters to consider. 294 * @return The matching associated character, or 0 if none. 295 */ 296 public char getMatch(int keyCode, char[] chars) { 297 return getMatch(keyCode, chars, 0); 298 } 299 300 /** 301 * Gets the first character in the character array that can be generated 302 * by the specified key code. If there are multiple choices, prefers 303 * the one that would be generated with the specified meta key modifier state. 304 * 305 * @param keyCode The key code. 306 * @param chars The array of matching characters to consider. 307 * @param metaState The preferred meta key modifier state. 308 * @return The matching associated character, or 0 if none. 309 */ 310 public char getMatch(int keyCode, char[] chars, int metaState) { 311 if (chars == null) { 312 throw new IllegalArgumentException("chars must not be null."); 313 } 314 315 metaState = KeyEvent.normalizeMetaState(metaState); 316 return nativeGetMatch(mPtr, keyCode, chars, metaState); 317 } 318 319 /** 320 * Gets the primary character for this key. 321 * In other words, the label that is physically printed on it. 322 * 323 * @param keyCode The key code. 324 * @return The display label character, or 0 if none (eg. for non-printing keys). 325 */ 326 public char getDisplayLabel(int keyCode) { 327 return nativeGetDisplayLabel(mPtr, keyCode); 328 } 329 330 /** 331 * Get the character that is produced by putting accent on the character c. 332 * For example, getDeadChar('`', 'e') returns è. 333 * 334 * @param accent The accent character. eg. '`' 335 * @param c The basic character. 336 * @return The combined character, or 0 if the characters cannot be combined. 337 */ 338 public static int getDeadChar(int accent, int c) { 339 return DEAD.get((accent << 16) | c); 340 } 341 342 /** 343 * Describes the character mappings associated with a key. 344 * 345 * @deprecated instead use {@link KeyCharacterMap#getDisplayLabel(int)}, 346 * {@link KeyCharacterMap#getNumber(int)} and {@link KeyCharacterMap#get(int, int)}. 347 */ 348 @Deprecated 349 public static class KeyData { 350 public static final int META_LENGTH = 4; 351 352 /** 353 * The display label (see {@link #getDisplayLabel}). 354 */ 355 public char displayLabel; 356 /** 357 * The "number" value (see {@link #getNumber}). 358 */ 359 public char number; 360 /** 361 * The character that will be generated in various meta states 362 * (the same ones used for {@link #get} and defined as 363 * {@link KeyEvent#META_SHIFT_ON} and {@link KeyEvent#META_ALT_ON}). 364 * <table> 365 * <tr><th>Index</th><th align="left">Value</th></tr> 366 * <tr><td>0</td><td>no modifiers</td></tr> 367 * <tr><td>1</td><td>caps</td></tr> 368 * <tr><td>2</td><td>alt</td></tr> 369 * <tr><td>3</td><td>caps + alt</td></tr> 370 * </table> 371 */ 372 public char[] meta = new char[META_LENGTH]; 373 } 374 375 /** 376 * Get the character conversion data for a given key code. 377 * 378 * @param keyCode The keyCode to query. 379 * @param results A {@link KeyData} instance that will be filled with the results. 380 * @return True if the key was mapped. If the key was not mapped, results is not modified. 381 * 382 * @deprecated instead use {@link KeyCharacterMap#getDisplayLabel(int)}, 383 * {@link KeyCharacterMap#getNumber(int)} or {@link KeyCharacterMap#get(int, int)}. 384 */ 385 @Deprecated 386 public boolean getKeyData(int keyCode, KeyData results) { 387 if (results.meta.length < KeyData.META_LENGTH) { 388 throw new IndexOutOfBoundsException( 389 "results.meta.length must be >= " + KeyData.META_LENGTH); 390 } 391 392 char displayLabel = nativeGetDisplayLabel(mPtr, keyCode); 393 if (displayLabel == 0) { 394 return false; 395 } 396 397 results.displayLabel = displayLabel; 398 results.number = nativeGetNumber(mPtr, keyCode); 399 results.meta[0] = nativeGetCharacter(mPtr, keyCode, 0); 400 results.meta[1] = nativeGetCharacter(mPtr, keyCode, KeyEvent.META_SHIFT_ON); 401 results.meta[2] = nativeGetCharacter(mPtr, keyCode, KeyEvent.META_ALT_ON); 402 results.meta[3] = nativeGetCharacter(mPtr, keyCode, 403 KeyEvent.META_ALT_ON | KeyEvent.META_SHIFT_ON); 404 return true; 405 } 406 407 /** 408 * Get an array of KeyEvent objects that if put into the input stream 409 * could plausibly generate the provided sequence of characters. It is 410 * not guaranteed that the sequence is the only way to generate these 411 * events or that it is optimal. 412 * <p> 413 * This function is primarily offered for instrumentation and testing purposes. 414 * It may fail to map characters to key codes. In particular, the key character 415 * map for the {@link #BUILT_IN_KEYBOARD built-in keyboard} device id may be empty. 416 * Consider using the key character map associated with the 417 * {@link #VIRTUAL_KEYBOARD virtual keyboard} device id instead. 418 * </p><p> 419 * For robust text entry, do not use this function. Instead construct a 420 * {@link KeyEvent} with action code {@link KeyEvent#ACTION_MULTIPLE} that contains 421 * the desired string using {@link KeyEvent#KeyEvent(long, String, int, int)}. 422 * </p> 423 * 424 * @param chars The sequence of characters to generate. 425 * @return An array of {@link KeyEvent} objects, or null if the given char array 426 * can not be generated using the current key character map. 427 */ 428 public KeyEvent[] getEvents(char[] chars) { 429 if (chars == null) { 430 throw new IllegalArgumentException("chars must not be null."); 431 } 432 return nativeGetEvents(mPtr, mDeviceId, chars); 433 } 434 435 /** 436 * Returns true if the specified key produces a glyph. 437 * 438 * @param keyCode The key code. 439 * @return True if the key is a printing key. 440 */ 441 public boolean isPrintingKey(int keyCode) { 442 int type = Character.getType(nativeGetDisplayLabel(mPtr, keyCode)); 443 444 switch (type) 445 { 446 case Character.SPACE_SEPARATOR: 447 case Character.LINE_SEPARATOR: 448 case Character.PARAGRAPH_SEPARATOR: 449 case Character.CONTROL: 450 case Character.FORMAT: 451 return false; 452 default: 453 return true; 454 } 455 } 456 457 /** 458 * Gets the keyboard type. 459 * Returns {@link #NUMERIC}, {@link #PREDICTIVE}, {@link #ALPHA} or {@link #FULL}. 460 * <p> 461 * Different keyboard types have different semantics. Refer to the documentation 462 * associated with the keyboard type constants for details. 463 * </p> 464 * 465 * @return The keyboard type. 466 */ 467 public int getKeyboardType() { 468 return nativeGetKeyboardType(mPtr); 469 } 470 471 /** 472 * Gets a constant that describes the behavior of this keyboard's modifier keys 473 * such as {@link KeyEvent#KEYCODE_SHIFT_LEFT}. 474 * <p> 475 * Currently there are two behaviors that may be combined: 476 * </p> 477 * <ul> 478 * <li>Chorded behavior: When the modifier key is pressed together with one or more 479 * character keys, the keyboard inserts the modified keys and 480 * then resets the modifier state when the modifier key is released.</li> 481 * <li>Toggled behavior: When the modifier key is pressed and released on its own 482 * it first toggles into a latched state. When latched, the modifier will apply 483 * to next character key that is pressed and will then reset itself to the initial state. 484 * If the modifier is already latched and the modifier key is pressed and release on 485 * its own again, then it toggles into a locked state. When locked, the modifier will 486 * apply to all subsequent character keys that are pressed until unlocked by pressing 487 * the modifier key on its own one more time to reset it to the initial state. 488 * Toggled behavior is useful for small profile keyboards designed for thumb typing. 489 * </ul> 490 * <p> 491 * This function currently returns {@link #MODIFIER_BEHAVIOR_CHORDED} when the 492 * {@link #getKeyboardType() keyboard type} is {@link #FULL} or {@link #SPECIAL_FUNCTION} and 493 * {@link #MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED} otherwise. 494 * In the future, the function may also take into account global keyboard 495 * accessibility settings, other user preferences, or new device capabilities. 496 * </p> 497 * 498 * @return The modifier behavior for this keyboard. 499 * 500 * @see {@link #MODIFIER_BEHAVIOR_CHORDED} 501 * @see {@link #MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED} 502 */ 503 public int getModifierBehavior() { 504 switch (getKeyboardType()) { 505 case FULL: 506 case SPECIAL_FUNCTION: 507 return MODIFIER_BEHAVIOR_CHORDED; 508 default: 509 return MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED; 510 } 511 } 512 513 /** 514 * Queries the framework about whether any physical keys exist on the 515 * any keyboard attached to the device that are capable of producing the given key code. 516 * 517 * @param keyCode The key code to query. 518 * @return True if at least one attached keyboard supports the specified key code. 519 */ 520 public static boolean deviceHasKey(int keyCode) { 521 int[] codeArray = new int[1]; 522 codeArray[0] = keyCode; 523 boolean[] ret = deviceHasKeys(codeArray); 524 return ret[0]; 525 } 526 527 /** 528 * Queries the framework about whether any physical keys exist on the 529 * any keyboard attached to the device that are capable of producing the given 530 * array of key codes. 531 * 532 * @param keyCodes The array of key codes to query. 533 * @return A new array of the same size as the key codes array whose elements 534 * are set to true if at least one attached keyboard supports the corresponding key code 535 * at the same index in the key codes array. 536 */ 537 public static boolean[] deviceHasKeys(int[] keyCodes) { 538 boolean[] ret = new boolean[keyCodes.length]; 539 IWindowManager wm = Display.getWindowManager(); 540 try { 541 wm.hasKeys(keyCodes, ret); 542 } catch (RemoteException e) { 543 // no fallback; just return the empty array 544 } 545 return ret; 546 } 547 548 /** 549 * Maps Unicode combining diacritical to display-form dead key 550 * (display character shifted left 16 bits). 551 */ 552 private static SparseIntArray COMBINING = new SparseIntArray(); 553 554 /** 555 * Maps combinations of (display-form) dead key and second character 556 * to combined output character. 557 */ 558 private static SparseIntArray DEAD = new SparseIntArray(); 559 560 /* 561 * TODO: Change the table format to support full 21-bit-wide 562 * accent characters and combined characters if ever necessary. 563 */ 564 private static final int ACUTE = '\u00B4' << 16; 565 private static final int GRAVE = '`' << 16; 566 private static final int CIRCUMFLEX = '^' << 16; 567 private static final int TILDE = '~' << 16; 568 private static final int UMLAUT = '\u00A8' << 16; 569 570 /* 571 * This bit will be set in the return value of {@link #get(int, int)} if the 572 * key is a "dead key." 573 */ 574 public static final int COMBINING_ACCENT = 0x80000000; 575 /** 576 * Mask the return value from {@link #get(int, int)} with this value to get 577 * a printable representation of the accent character of a "dead key." 578 */ 579 public static final int COMBINING_ACCENT_MASK = 0x7FFFFFFF; 580 581 static { 582 COMBINING.put('\u0300', (GRAVE >> 16) | COMBINING_ACCENT); 583 COMBINING.put('\u0301', (ACUTE >> 16) | COMBINING_ACCENT); 584 COMBINING.put('\u0302', (CIRCUMFLEX >> 16) | COMBINING_ACCENT); 585 COMBINING.put('\u0303', (TILDE >> 16) | COMBINING_ACCENT); 586 COMBINING.put('\u0308', (UMLAUT >> 16) | COMBINING_ACCENT); 587 588 DEAD.put(ACUTE | 'A', '\u00C1'); 589 DEAD.put(ACUTE | 'C', '\u0106'); 590 DEAD.put(ACUTE | 'E', '\u00C9'); 591 DEAD.put(ACUTE | 'G', '\u01F4'); 592 DEAD.put(ACUTE | 'I', '\u00CD'); 593 DEAD.put(ACUTE | 'K', '\u1E30'); 594 DEAD.put(ACUTE | 'L', '\u0139'); 595 DEAD.put(ACUTE | 'M', '\u1E3E'); 596 DEAD.put(ACUTE | 'N', '\u0143'); 597 DEAD.put(ACUTE | 'O', '\u00D3'); 598 DEAD.put(ACUTE | 'P', '\u1E54'); 599 DEAD.put(ACUTE | 'R', '\u0154'); 600 DEAD.put(ACUTE | 'S', '\u015A'); 601 DEAD.put(ACUTE | 'U', '\u00DA'); 602 DEAD.put(ACUTE | 'W', '\u1E82'); 603 DEAD.put(ACUTE | 'Y', '\u00DD'); 604 DEAD.put(ACUTE | 'Z', '\u0179'); 605 DEAD.put(ACUTE | 'a', '\u00E1'); 606 DEAD.put(ACUTE | 'c', '\u0107'); 607 DEAD.put(ACUTE | 'e', '\u00E9'); 608 DEAD.put(ACUTE | 'g', '\u01F5'); 609 DEAD.put(ACUTE | 'i', '\u00ED'); 610 DEAD.put(ACUTE | 'k', '\u1E31'); 611 DEAD.put(ACUTE | 'l', '\u013A'); 612 DEAD.put(ACUTE | 'm', '\u1E3F'); 613 DEAD.put(ACUTE | 'n', '\u0144'); 614 DEAD.put(ACUTE | 'o', '\u00F3'); 615 DEAD.put(ACUTE | 'p', '\u1E55'); 616 DEAD.put(ACUTE | 'r', '\u0155'); 617 DEAD.put(ACUTE | 's', '\u015B'); 618 DEAD.put(ACUTE | 'u', '\u00FA'); 619 DEAD.put(ACUTE | 'w', '\u1E83'); 620 DEAD.put(ACUTE | 'y', '\u00FD'); 621 DEAD.put(ACUTE | 'z', '\u017A'); 622 DEAD.put(CIRCUMFLEX | 'A', '\u00C2'); 623 DEAD.put(CIRCUMFLEX | 'C', '\u0108'); 624 DEAD.put(CIRCUMFLEX | 'E', '\u00CA'); 625 DEAD.put(CIRCUMFLEX | 'G', '\u011C'); 626 DEAD.put(CIRCUMFLEX | 'H', '\u0124'); 627 DEAD.put(CIRCUMFLEX | 'I', '\u00CE'); 628 DEAD.put(CIRCUMFLEX | 'J', '\u0134'); 629 DEAD.put(CIRCUMFLEX | 'O', '\u00D4'); 630 DEAD.put(CIRCUMFLEX | 'S', '\u015C'); 631 DEAD.put(CIRCUMFLEX | 'U', '\u00DB'); 632 DEAD.put(CIRCUMFLEX | 'W', '\u0174'); 633 DEAD.put(CIRCUMFLEX | 'Y', '\u0176'); 634 DEAD.put(CIRCUMFLEX | 'Z', '\u1E90'); 635 DEAD.put(CIRCUMFLEX | 'a', '\u00E2'); 636 DEAD.put(CIRCUMFLEX | 'c', '\u0109'); 637 DEAD.put(CIRCUMFLEX | 'e', '\u00EA'); 638 DEAD.put(CIRCUMFLEX | 'g', '\u011D'); 639 DEAD.put(CIRCUMFLEX | 'h', '\u0125'); 640 DEAD.put(CIRCUMFLEX | 'i', '\u00EE'); 641 DEAD.put(CIRCUMFLEX | 'j', '\u0135'); 642 DEAD.put(CIRCUMFLEX | 'o', '\u00F4'); 643 DEAD.put(CIRCUMFLEX | 's', '\u015D'); 644 DEAD.put(CIRCUMFLEX | 'u', '\u00FB'); 645 DEAD.put(CIRCUMFLEX | 'w', '\u0175'); 646 DEAD.put(CIRCUMFLEX | 'y', '\u0177'); 647 DEAD.put(CIRCUMFLEX | 'z', '\u1E91'); 648 DEAD.put(GRAVE | 'A', '\u00C0'); 649 DEAD.put(GRAVE | 'E', '\u00C8'); 650 DEAD.put(GRAVE | 'I', '\u00CC'); 651 DEAD.put(GRAVE | 'N', '\u01F8'); 652 DEAD.put(GRAVE | 'O', '\u00D2'); 653 DEAD.put(GRAVE | 'U', '\u00D9'); 654 DEAD.put(GRAVE | 'W', '\u1E80'); 655 DEAD.put(GRAVE | 'Y', '\u1EF2'); 656 DEAD.put(GRAVE | 'a', '\u00E0'); 657 DEAD.put(GRAVE | 'e', '\u00E8'); 658 DEAD.put(GRAVE | 'i', '\u00EC'); 659 DEAD.put(GRAVE | 'n', '\u01F9'); 660 DEAD.put(GRAVE | 'o', '\u00F2'); 661 DEAD.put(GRAVE | 'u', '\u00F9'); 662 DEAD.put(GRAVE | 'w', '\u1E81'); 663 DEAD.put(GRAVE | 'y', '\u1EF3'); 664 DEAD.put(TILDE | 'A', '\u00C3'); 665 DEAD.put(TILDE | 'E', '\u1EBC'); 666 DEAD.put(TILDE | 'I', '\u0128'); 667 DEAD.put(TILDE | 'N', '\u00D1'); 668 DEAD.put(TILDE | 'O', '\u00D5'); 669 DEAD.put(TILDE | 'U', '\u0168'); 670 DEAD.put(TILDE | 'V', '\u1E7C'); 671 DEAD.put(TILDE | 'Y', '\u1EF8'); 672 DEAD.put(TILDE | 'a', '\u00E3'); 673 DEAD.put(TILDE | 'e', '\u1EBD'); 674 DEAD.put(TILDE | 'i', '\u0129'); 675 DEAD.put(TILDE | 'n', '\u00F1'); 676 DEAD.put(TILDE | 'o', '\u00F5'); 677 DEAD.put(TILDE | 'u', '\u0169'); 678 DEAD.put(TILDE | 'v', '\u1E7D'); 679 DEAD.put(TILDE | 'y', '\u1EF9'); 680 DEAD.put(UMLAUT | 'A', '\u00C4'); 681 DEAD.put(UMLAUT | 'E', '\u00CB'); 682 DEAD.put(UMLAUT | 'H', '\u1E26'); 683 DEAD.put(UMLAUT | 'I', '\u00CF'); 684 DEAD.put(UMLAUT | 'O', '\u00D6'); 685 DEAD.put(UMLAUT | 'U', '\u00DC'); 686 DEAD.put(UMLAUT | 'W', '\u1E84'); 687 DEAD.put(UMLAUT | 'X', '\u1E8C'); 688 DEAD.put(UMLAUT | 'Y', '\u0178'); 689 DEAD.put(UMLAUT | 'a', '\u00E4'); 690 DEAD.put(UMLAUT | 'e', '\u00EB'); 691 DEAD.put(UMLAUT | 'h', '\u1E27'); 692 DEAD.put(UMLAUT | 'i', '\u00EF'); 693 DEAD.put(UMLAUT | 'o', '\u00F6'); 694 DEAD.put(UMLAUT | 't', '\u1E97'); 695 DEAD.put(UMLAUT | 'u', '\u00FC'); 696 DEAD.put(UMLAUT | 'w', '\u1E85'); 697 DEAD.put(UMLAUT | 'x', '\u1E8D'); 698 DEAD.put(UMLAUT | 'y', '\u00FF'); 699 } 700 701 /** 702 * Thrown by {@link KeyCharacterMap#load} when a key character map could not be loaded. 703 */ 704 public static class UnavailableException extends AndroidRuntimeException { 705 public UnavailableException(String msg) { 706 super(msg); 707 } 708 } 709 710 /** 711 * Specifies a substitute key code and meta state as a fallback action 712 * for an unhandled key. 713 * @hide 714 */ 715 public static final class FallbackAction { 716 public int keyCode; 717 public int metaState; 718 } 719} 720