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