diff --git a/src/api-impl-jni/defines.h b/src/api-impl-jni/defines.h index ebbeb701..f7757afa 100644 --- a/src/api-impl-jni/defines.h +++ b/src/api-impl-jni/defines.h @@ -29,6 +29,7 @@ #define _SET_INT_FIELD(object, field, value) ((*env)->SetIntField(env, object, _FIELD_ID(_CLASS(object), field, "I"), value)) #define _SET_STATIC_INT_FIELD(class, field, value) ((*env)->SetStaticIntField(env, class, _STATIC_FIELD_ID(class, field, "I"), value)) #define _SET_STATIC_OBJ_FIELD(class, field, type, value) ((*env)->SetStaticObjectField(env, class, _STATIC_FIELD_ID(class, field, type), value)) +#define _GET_STATIC_OBJ_FIELD(class, field, type) ((*env)->GetStaticObjectField(env, class, _STATIC_FIELD_ID(class, field, type))) #define _GET_INT_FIELD(object, field) ((*env)->GetIntField(env, object, _FIELD_ID(_CLASS(object), field, "I"))) #define _GET_BYTE_ARRAY_ELEMENTS(b_array) ((*env)->GetByteArrayElements(env, b_array, NULL)) #define _RELEASE_BYTE_ARRAY_ELEMENTS(b_array, buffer_ptr) ((*env)->ReleaseByteArrayElements(env, b_array, buffer_ptr, 0)) diff --git a/src/api-impl-jni/generated_headers/android_content_res_AssetManager.h b/src/api-impl-jni/generated_headers/android_content_res_AssetManager.h index d6d51981..f72ef4ed 100644 --- a/src/api-impl-jni/generated_headers/android_content_res_AssetManager.h +++ b/src/api-impl-jni/generated_headers/android_content_res_AssetManager.h @@ -33,14 +33,6 @@ extern "C" { #define android_content_res_AssetManager_STYLE_CHANGING_CONFIGURATIONS 4L #undef android_content_res_AssetManager_STYLE_DENSITY #define android_content_res_AssetManager_STYLE_DENSITY 5L -/* - * Class: android_content_res_AssetManager - * Method: list - * Signature: (Ljava/lang/String;)[Ljava/lang/String; - */ -JNIEXPORT jobjectArray JNICALL Java_android_content_res_AssetManager_list - (JNIEnv *, jobject, jstring); - /* * Class: android_content_res_AssetManager * Method: addAssetPathNative @@ -289,14 +281,6 @@ JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_getGlobalAssetManag JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_newTheme (JNIEnv *, jobject); -/* - * Class: android_content_res_AssetManager - * Method: deleteTheme - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_android_content_res_AssetManager_deleteTheme - (JNIEnv *, jobject, jint); - /* * Class: android_content_res_AssetManager * Method: applyThemeStyle @@ -345,14 +329,6 @@ JNIEXPORT jobjectArray JNICALL Java_android_content_res_AssetManager_getArrayStr JNIEXPORT jintArray JNICALL Java_android_content_res_AssetManager_getArrayStringInfo (JNIEnv *, jobject, jint); -/* - * Class: android_content_res_AssetManager - * Method: destroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_android_content_res_AssetManager_destroy - (JNIEnv *, jobject); - #ifdef __cplusplus } #endif diff --git a/src/api-impl-jni/generated_headers/android_view_KeyCharacterMap.h b/src/api-impl-jni/generated_headers/android_view_KeyCharacterMap.h new file mode 100644 index 00000000..3860f97e --- /dev/null +++ b/src/api-impl-jni/generated_headers/android_view_KeyCharacterMap.h @@ -0,0 +1,159 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class android_view_KeyCharacterMap */ + +#ifndef _Included_android_view_KeyCharacterMap +#define _Included_android_view_KeyCharacterMap +#ifdef __cplusplus +extern "C" { +#endif +#undef android_view_KeyCharacterMap_BUILT_IN_KEYBOARD +#define android_view_KeyCharacterMap_BUILT_IN_KEYBOARD 0L +#undef android_view_KeyCharacterMap_VIRTUAL_KEYBOARD +#define android_view_KeyCharacterMap_VIRTUAL_KEYBOARD -1L +#undef android_view_KeyCharacterMap_NUMERIC +#define android_view_KeyCharacterMap_NUMERIC 1L +#undef android_view_KeyCharacterMap_PREDICTIVE +#define android_view_KeyCharacterMap_PREDICTIVE 2L +#undef android_view_KeyCharacterMap_ALPHA +#define android_view_KeyCharacterMap_ALPHA 3L +#undef android_view_KeyCharacterMap_FULL +#define android_view_KeyCharacterMap_FULL 4L +#undef android_view_KeyCharacterMap_SPECIAL_FUNCTION +#define android_view_KeyCharacterMap_SPECIAL_FUNCTION 5L +#undef android_view_KeyCharacterMap_HEX_INPUT +#define android_view_KeyCharacterMap_HEX_INPUT 61184L +#undef android_view_KeyCharacterMap_PICKER_DIALOG_INPUT +#define android_view_KeyCharacterMap_PICKER_DIALOG_INPUT 61185L +#undef android_view_KeyCharacterMap_MODIFIER_BEHAVIOR_CHORDED +#define android_view_KeyCharacterMap_MODIFIER_BEHAVIOR_CHORDED 0L +#undef android_view_KeyCharacterMap_MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED +#define android_view_KeyCharacterMap_MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED 1L +#undef android_view_KeyCharacterMap_COMBINING_ACCENT +#define android_view_KeyCharacterMap_COMBINING_ACCENT -2147483648L +#undef android_view_KeyCharacterMap_COMBINING_ACCENT_MASK +#define android_view_KeyCharacterMap_COMBINING_ACCENT_MASK 2147483647L +#undef android_view_KeyCharacterMap_ACCENT_ACUTE +#define android_view_KeyCharacterMap_ACCENT_ACUTE 180L +#undef android_view_KeyCharacterMap_ACCENT_BREVE +#define android_view_KeyCharacterMap_ACCENT_BREVE 728L +#undef android_view_KeyCharacterMap_ACCENT_CARON +#define android_view_KeyCharacterMap_ACCENT_CARON 711L +#undef android_view_KeyCharacterMap_ACCENT_CEDILLA +#define android_view_KeyCharacterMap_ACCENT_CEDILLA 184L +#undef android_view_KeyCharacterMap_ACCENT_CIRCUMFLEX +#define android_view_KeyCharacterMap_ACCENT_CIRCUMFLEX 710L +#undef android_view_KeyCharacterMap_ACCENT_COMMA_ABOVE +#define android_view_KeyCharacterMap_ACCENT_COMMA_ABOVE 8125L +#undef android_view_KeyCharacterMap_ACCENT_COMMA_ABOVE_RIGHT +#define android_view_KeyCharacterMap_ACCENT_COMMA_ABOVE_RIGHT 700L +#undef android_view_KeyCharacterMap_ACCENT_DOT_ABOVE +#define android_view_KeyCharacterMap_ACCENT_DOT_ABOVE 729L +#undef android_view_KeyCharacterMap_ACCENT_DOT_BELOW +#define android_view_KeyCharacterMap_ACCENT_DOT_BELOW 46L +#undef android_view_KeyCharacterMap_ACCENT_DOUBLE_ACUTE +#define android_view_KeyCharacterMap_ACCENT_DOUBLE_ACUTE 733L +#undef android_view_KeyCharacterMap_ACCENT_GRAVE +#define android_view_KeyCharacterMap_ACCENT_GRAVE 715L +#undef android_view_KeyCharacterMap_ACCENT_HOOK_ABOVE +#define android_view_KeyCharacterMap_ACCENT_HOOK_ABOVE 704L +#undef android_view_KeyCharacterMap_ACCENT_HORN +#define android_view_KeyCharacterMap_ACCENT_HORN 39L +#undef android_view_KeyCharacterMap_ACCENT_MACRON +#define android_view_KeyCharacterMap_ACCENT_MACRON 175L +#undef android_view_KeyCharacterMap_ACCENT_MACRON_BELOW +#define android_view_KeyCharacterMap_ACCENT_MACRON_BELOW 717L +#undef android_view_KeyCharacterMap_ACCENT_OGONEK +#define android_view_KeyCharacterMap_ACCENT_OGONEK 731L +#undef android_view_KeyCharacterMap_ACCENT_REVERSED_COMMA_ABOVE +#define android_view_KeyCharacterMap_ACCENT_REVERSED_COMMA_ABOVE 701L +#undef android_view_KeyCharacterMap_ACCENT_RING_ABOVE +#define android_view_KeyCharacterMap_ACCENT_RING_ABOVE 730L +#undef android_view_KeyCharacterMap_ACCENT_STROKE +#define android_view_KeyCharacterMap_ACCENT_STROKE 45L +#undef android_view_KeyCharacterMap_ACCENT_TILDE +#define android_view_KeyCharacterMap_ACCENT_TILDE 732L +#undef android_view_KeyCharacterMap_ACCENT_TURNED_COMMA_ABOVE +#define android_view_KeyCharacterMap_ACCENT_TURNED_COMMA_ABOVE 699L +#undef android_view_KeyCharacterMap_ACCENT_UMLAUT +#define android_view_KeyCharacterMap_ACCENT_UMLAUT 168L +#undef android_view_KeyCharacterMap_ACCENT_VERTICAL_LINE_ABOVE +#define android_view_KeyCharacterMap_ACCENT_VERTICAL_LINE_ABOVE 712L +#undef android_view_KeyCharacterMap_ACCENT_VERTICAL_LINE_BELOW +#define android_view_KeyCharacterMap_ACCENT_VERTICAL_LINE_BELOW 716L +#undef android_view_KeyCharacterMap_ACCENT_GRAVE_LEGACY +#define android_view_KeyCharacterMap_ACCENT_GRAVE_LEGACY 96L +#undef android_view_KeyCharacterMap_ACCENT_CIRCUMFLEX_LEGACY +#define android_view_KeyCharacterMap_ACCENT_CIRCUMFLEX_LEGACY 94L +#undef android_view_KeyCharacterMap_ACCENT_TILDE_LEGACY +#define android_view_KeyCharacterMap_ACCENT_TILDE_LEGACY 126L +#undef android_view_KeyCharacterMap_CHAR_SPACE +#define android_view_KeyCharacterMap_CHAR_SPACE 32L +/* + * Class: android_view_KeyCharacterMap + * Method: nativeDispose + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_android_view_KeyCharacterMap_nativeDispose + (JNIEnv *, jclass, jint); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetCharacter + * Signature: (III)C + */ +JNIEXPORT jchar JNICALL Java_android_view_KeyCharacterMap_nativeGetCharacter + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetFallbackAction + * Signature: (IIILandroid/view/KeyCharacterMap/FallbackAction;)Z + */ +JNIEXPORT jboolean JNICALL Java_android_view_KeyCharacterMap_nativeGetFallbackAction + (JNIEnv *, jclass, jint, jint, jint, jobject); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetNumber + * Signature: (II)C + */ +JNIEXPORT jchar JNICALL Java_android_view_KeyCharacterMap_nativeGetNumber + (JNIEnv *, jclass, jint, jint); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetMatch + * Signature: (II[CI)C + */ +JNIEXPORT jchar JNICALL Java_android_view_KeyCharacterMap_nativeGetMatch + (JNIEnv *, jclass, jint, jint, jcharArray, jint); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetDisplayLabel + * Signature: (II)C + */ +JNIEXPORT jchar JNICALL Java_android_view_KeyCharacterMap_nativeGetDisplayLabel + (JNIEnv *, jclass, jint, jint); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetKeyboardType + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_android_view_KeyCharacterMap_nativeGetKeyboardType + (JNIEnv *, jclass, jint); + +/* + * Class: android_view_KeyCharacterMap + * Method: nativeGetEvents + * Signature: (I[C)[Landroid/view/KeyEvent; + */ +JNIEXPORT jobjectArray JNICALL Java_android_view_KeyCharacterMap_nativeGetEvents + (JNIEnv *, jclass, jint, jcharArray); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/api-impl-jni/generated_headers/android_view_KeyEvent.h b/src/api-impl-jni/generated_headers/android_view_KeyEvent.h new file mode 100644 index 00000000..3eab37ca --- /dev/null +++ b/src/api-impl-jni/generated_headers/android_view_KeyEvent.h @@ -0,0 +1,583 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class android_view_KeyEvent */ + +#ifndef _Included_android_view_KeyEvent +#define _Included_android_view_KeyEvent +#ifdef __cplusplus +extern "C" { +#endif +#undef android_view_KeyEvent_PARCEL_TOKEN_MOTION_EVENT +#define android_view_KeyEvent_PARCEL_TOKEN_MOTION_EVENT 1L +#undef android_view_KeyEvent_PARCEL_TOKEN_KEY_EVENT +#define android_view_KeyEvent_PARCEL_TOKEN_KEY_EVENT 2L +#undef android_view_KeyEvent_TRACK_RECYCLED_LOCATION +#define android_view_KeyEvent_TRACK_RECYCLED_LOCATION 0L +#undef android_view_KeyEvent_KEYCODE_UNKNOWN +#define android_view_KeyEvent_KEYCODE_UNKNOWN 0L +#undef android_view_KeyEvent_KEYCODE_SOFT_LEFT +#define android_view_KeyEvent_KEYCODE_SOFT_LEFT 1L +#undef android_view_KeyEvent_KEYCODE_SOFT_RIGHT +#define android_view_KeyEvent_KEYCODE_SOFT_RIGHT 2L +#undef android_view_KeyEvent_KEYCODE_HOME +#define android_view_KeyEvent_KEYCODE_HOME 3L +#undef android_view_KeyEvent_KEYCODE_BACK +#define android_view_KeyEvent_KEYCODE_BACK 4L +#undef android_view_KeyEvent_KEYCODE_CALL +#define android_view_KeyEvent_KEYCODE_CALL 5L +#undef android_view_KeyEvent_KEYCODE_ENDCALL +#define android_view_KeyEvent_KEYCODE_ENDCALL 6L +#undef android_view_KeyEvent_KEYCODE_0 +#define android_view_KeyEvent_KEYCODE_0 7L +#undef android_view_KeyEvent_KEYCODE_1 +#define android_view_KeyEvent_KEYCODE_1 8L +#undef android_view_KeyEvent_KEYCODE_2 +#define android_view_KeyEvent_KEYCODE_2 9L +#undef android_view_KeyEvent_KEYCODE_3 +#define android_view_KeyEvent_KEYCODE_3 10L +#undef android_view_KeyEvent_KEYCODE_4 +#define android_view_KeyEvent_KEYCODE_4 11L +#undef android_view_KeyEvent_KEYCODE_5 +#define android_view_KeyEvent_KEYCODE_5 12L +#undef android_view_KeyEvent_KEYCODE_6 +#define android_view_KeyEvent_KEYCODE_6 13L +#undef android_view_KeyEvent_KEYCODE_7 +#define android_view_KeyEvent_KEYCODE_7 14L +#undef android_view_KeyEvent_KEYCODE_8 +#define android_view_KeyEvent_KEYCODE_8 15L +#undef android_view_KeyEvent_KEYCODE_9 +#define android_view_KeyEvent_KEYCODE_9 16L +#undef android_view_KeyEvent_KEYCODE_STAR +#define android_view_KeyEvent_KEYCODE_STAR 17L +#undef android_view_KeyEvent_KEYCODE_POUND +#define android_view_KeyEvent_KEYCODE_POUND 18L +#undef android_view_KeyEvent_KEYCODE_DPAD_UP +#define android_view_KeyEvent_KEYCODE_DPAD_UP 19L +#undef android_view_KeyEvent_KEYCODE_DPAD_DOWN +#define android_view_KeyEvent_KEYCODE_DPAD_DOWN 20L +#undef android_view_KeyEvent_KEYCODE_DPAD_LEFT +#define android_view_KeyEvent_KEYCODE_DPAD_LEFT 21L +#undef android_view_KeyEvent_KEYCODE_DPAD_RIGHT +#define android_view_KeyEvent_KEYCODE_DPAD_RIGHT 22L +#undef android_view_KeyEvent_KEYCODE_DPAD_CENTER +#define android_view_KeyEvent_KEYCODE_DPAD_CENTER 23L +#undef android_view_KeyEvent_KEYCODE_VOLUME_UP +#define android_view_KeyEvent_KEYCODE_VOLUME_UP 24L +#undef android_view_KeyEvent_KEYCODE_VOLUME_DOWN +#define android_view_KeyEvent_KEYCODE_VOLUME_DOWN 25L +#undef android_view_KeyEvent_KEYCODE_POWER +#define android_view_KeyEvent_KEYCODE_POWER 26L +#undef android_view_KeyEvent_KEYCODE_CAMERA +#define android_view_KeyEvent_KEYCODE_CAMERA 27L +#undef android_view_KeyEvent_KEYCODE_CLEAR +#define android_view_KeyEvent_KEYCODE_CLEAR 28L +#undef android_view_KeyEvent_KEYCODE_A +#define android_view_KeyEvent_KEYCODE_A 29L +#undef android_view_KeyEvent_KEYCODE_B +#define android_view_KeyEvent_KEYCODE_B 30L +#undef android_view_KeyEvent_KEYCODE_C +#define android_view_KeyEvent_KEYCODE_C 31L +#undef android_view_KeyEvent_KEYCODE_D +#define android_view_KeyEvent_KEYCODE_D 32L +#undef android_view_KeyEvent_KEYCODE_E +#define android_view_KeyEvent_KEYCODE_E 33L +#undef android_view_KeyEvent_KEYCODE_F +#define android_view_KeyEvent_KEYCODE_F 34L +#undef android_view_KeyEvent_KEYCODE_G +#define android_view_KeyEvent_KEYCODE_G 35L +#undef android_view_KeyEvent_KEYCODE_H +#define android_view_KeyEvent_KEYCODE_H 36L +#undef android_view_KeyEvent_KEYCODE_I +#define android_view_KeyEvent_KEYCODE_I 37L +#undef android_view_KeyEvent_KEYCODE_J +#define android_view_KeyEvent_KEYCODE_J 38L +#undef android_view_KeyEvent_KEYCODE_K +#define android_view_KeyEvent_KEYCODE_K 39L +#undef android_view_KeyEvent_KEYCODE_L +#define android_view_KeyEvent_KEYCODE_L 40L +#undef android_view_KeyEvent_KEYCODE_M +#define android_view_KeyEvent_KEYCODE_M 41L +#undef android_view_KeyEvent_KEYCODE_N +#define android_view_KeyEvent_KEYCODE_N 42L +#undef android_view_KeyEvent_KEYCODE_O +#define android_view_KeyEvent_KEYCODE_O 43L +#undef android_view_KeyEvent_KEYCODE_P +#define android_view_KeyEvent_KEYCODE_P 44L +#undef android_view_KeyEvent_KEYCODE_Q +#define android_view_KeyEvent_KEYCODE_Q 45L +#undef android_view_KeyEvent_KEYCODE_R +#define android_view_KeyEvent_KEYCODE_R 46L +#undef android_view_KeyEvent_KEYCODE_S +#define android_view_KeyEvent_KEYCODE_S 47L +#undef android_view_KeyEvent_KEYCODE_T +#define android_view_KeyEvent_KEYCODE_T 48L +#undef android_view_KeyEvent_KEYCODE_U +#define android_view_KeyEvent_KEYCODE_U 49L +#undef android_view_KeyEvent_KEYCODE_V +#define android_view_KeyEvent_KEYCODE_V 50L +#undef android_view_KeyEvent_KEYCODE_W +#define android_view_KeyEvent_KEYCODE_W 51L +#undef android_view_KeyEvent_KEYCODE_X +#define android_view_KeyEvent_KEYCODE_X 52L +#undef android_view_KeyEvent_KEYCODE_Y +#define android_view_KeyEvent_KEYCODE_Y 53L +#undef android_view_KeyEvent_KEYCODE_Z +#define android_view_KeyEvent_KEYCODE_Z 54L +#undef android_view_KeyEvent_KEYCODE_COMMA +#define android_view_KeyEvent_KEYCODE_COMMA 55L +#undef android_view_KeyEvent_KEYCODE_PERIOD +#define android_view_KeyEvent_KEYCODE_PERIOD 56L +#undef android_view_KeyEvent_KEYCODE_ALT_LEFT +#define android_view_KeyEvent_KEYCODE_ALT_LEFT 57L +#undef android_view_KeyEvent_KEYCODE_ALT_RIGHT +#define android_view_KeyEvent_KEYCODE_ALT_RIGHT 58L +#undef android_view_KeyEvent_KEYCODE_SHIFT_LEFT +#define android_view_KeyEvent_KEYCODE_SHIFT_LEFT 59L +#undef android_view_KeyEvent_KEYCODE_SHIFT_RIGHT +#define android_view_KeyEvent_KEYCODE_SHIFT_RIGHT 60L +#undef android_view_KeyEvent_KEYCODE_TAB +#define android_view_KeyEvent_KEYCODE_TAB 61L +#undef android_view_KeyEvent_KEYCODE_SPACE +#define android_view_KeyEvent_KEYCODE_SPACE 62L +#undef android_view_KeyEvent_KEYCODE_SYM +#define android_view_KeyEvent_KEYCODE_SYM 63L +#undef android_view_KeyEvent_KEYCODE_EXPLORER +#define android_view_KeyEvent_KEYCODE_EXPLORER 64L +#undef android_view_KeyEvent_KEYCODE_ENVELOPE +#define android_view_KeyEvent_KEYCODE_ENVELOPE 65L +#undef android_view_KeyEvent_KEYCODE_ENTER +#define android_view_KeyEvent_KEYCODE_ENTER 66L +#undef android_view_KeyEvent_KEYCODE_DEL +#define android_view_KeyEvent_KEYCODE_DEL 67L +#undef android_view_KeyEvent_KEYCODE_GRAVE +#define android_view_KeyEvent_KEYCODE_GRAVE 68L +#undef android_view_KeyEvent_KEYCODE_MINUS +#define android_view_KeyEvent_KEYCODE_MINUS 69L +#undef android_view_KeyEvent_KEYCODE_EQUALS +#define android_view_KeyEvent_KEYCODE_EQUALS 70L +#undef android_view_KeyEvent_KEYCODE_LEFT_BRACKET +#define android_view_KeyEvent_KEYCODE_LEFT_BRACKET 71L +#undef android_view_KeyEvent_KEYCODE_RIGHT_BRACKET +#define android_view_KeyEvent_KEYCODE_RIGHT_BRACKET 72L +#undef android_view_KeyEvent_KEYCODE_BACKSLASH +#define android_view_KeyEvent_KEYCODE_BACKSLASH 73L +#undef android_view_KeyEvent_KEYCODE_SEMICOLON +#define android_view_KeyEvent_KEYCODE_SEMICOLON 74L +#undef android_view_KeyEvent_KEYCODE_APOSTROPHE +#define android_view_KeyEvent_KEYCODE_APOSTROPHE 75L +#undef android_view_KeyEvent_KEYCODE_SLASH +#define android_view_KeyEvent_KEYCODE_SLASH 76L +#undef android_view_KeyEvent_KEYCODE_AT +#define android_view_KeyEvent_KEYCODE_AT 77L +#undef android_view_KeyEvent_KEYCODE_NUM +#define android_view_KeyEvent_KEYCODE_NUM 78L +#undef android_view_KeyEvent_KEYCODE_HEADSETHOOK +#define android_view_KeyEvent_KEYCODE_HEADSETHOOK 79L +#undef android_view_KeyEvent_KEYCODE_FOCUS +#define android_view_KeyEvent_KEYCODE_FOCUS 80L +#undef android_view_KeyEvent_KEYCODE_PLUS +#define android_view_KeyEvent_KEYCODE_PLUS 81L +#undef android_view_KeyEvent_KEYCODE_MENU +#define android_view_KeyEvent_KEYCODE_MENU 82L +#undef android_view_KeyEvent_KEYCODE_NOTIFICATION +#define android_view_KeyEvent_KEYCODE_NOTIFICATION 83L +#undef android_view_KeyEvent_KEYCODE_SEARCH +#define android_view_KeyEvent_KEYCODE_SEARCH 84L +#undef android_view_KeyEvent_KEYCODE_MEDIA_PLAY_PAUSE +#define android_view_KeyEvent_KEYCODE_MEDIA_PLAY_PAUSE 85L +#undef android_view_KeyEvent_KEYCODE_MEDIA_STOP +#define android_view_KeyEvent_KEYCODE_MEDIA_STOP 86L +#undef android_view_KeyEvent_KEYCODE_MEDIA_NEXT +#define android_view_KeyEvent_KEYCODE_MEDIA_NEXT 87L +#undef android_view_KeyEvent_KEYCODE_MEDIA_PREVIOUS +#define android_view_KeyEvent_KEYCODE_MEDIA_PREVIOUS 88L +#undef android_view_KeyEvent_KEYCODE_MEDIA_REWIND +#define android_view_KeyEvent_KEYCODE_MEDIA_REWIND 89L +#undef android_view_KeyEvent_KEYCODE_MEDIA_FAST_FORWARD +#define android_view_KeyEvent_KEYCODE_MEDIA_FAST_FORWARD 90L +#undef android_view_KeyEvent_KEYCODE_MUTE +#define android_view_KeyEvent_KEYCODE_MUTE 91L +#undef android_view_KeyEvent_KEYCODE_PAGE_UP +#define android_view_KeyEvent_KEYCODE_PAGE_UP 92L +#undef android_view_KeyEvent_KEYCODE_PAGE_DOWN +#define android_view_KeyEvent_KEYCODE_PAGE_DOWN 93L +#undef android_view_KeyEvent_KEYCODE_PICTSYMBOLS +#define android_view_KeyEvent_KEYCODE_PICTSYMBOLS 94L +#undef android_view_KeyEvent_KEYCODE_SWITCH_CHARSET +#define android_view_KeyEvent_KEYCODE_SWITCH_CHARSET 95L +#undef android_view_KeyEvent_KEYCODE_BUTTON_A +#define android_view_KeyEvent_KEYCODE_BUTTON_A 96L +#undef android_view_KeyEvent_KEYCODE_BUTTON_B +#define android_view_KeyEvent_KEYCODE_BUTTON_B 97L +#undef android_view_KeyEvent_KEYCODE_BUTTON_C +#define android_view_KeyEvent_KEYCODE_BUTTON_C 98L +#undef android_view_KeyEvent_KEYCODE_BUTTON_X +#define android_view_KeyEvent_KEYCODE_BUTTON_X 99L +#undef android_view_KeyEvent_KEYCODE_BUTTON_Y +#define android_view_KeyEvent_KEYCODE_BUTTON_Y 100L +#undef android_view_KeyEvent_KEYCODE_BUTTON_Z +#define android_view_KeyEvent_KEYCODE_BUTTON_Z 101L +#undef android_view_KeyEvent_KEYCODE_BUTTON_L1 +#define android_view_KeyEvent_KEYCODE_BUTTON_L1 102L +#undef android_view_KeyEvent_KEYCODE_BUTTON_R1 +#define android_view_KeyEvent_KEYCODE_BUTTON_R1 103L +#undef android_view_KeyEvent_KEYCODE_BUTTON_L2 +#define android_view_KeyEvent_KEYCODE_BUTTON_L2 104L +#undef android_view_KeyEvent_KEYCODE_BUTTON_R2 +#define android_view_KeyEvent_KEYCODE_BUTTON_R2 105L +#undef android_view_KeyEvent_KEYCODE_BUTTON_THUMBL +#define android_view_KeyEvent_KEYCODE_BUTTON_THUMBL 106L +#undef android_view_KeyEvent_KEYCODE_BUTTON_THUMBR +#define android_view_KeyEvent_KEYCODE_BUTTON_THUMBR 107L +#undef android_view_KeyEvent_KEYCODE_BUTTON_START +#define android_view_KeyEvent_KEYCODE_BUTTON_START 108L +#undef android_view_KeyEvent_KEYCODE_BUTTON_SELECT +#define android_view_KeyEvent_KEYCODE_BUTTON_SELECT 109L +#undef android_view_KeyEvent_KEYCODE_BUTTON_MODE +#define android_view_KeyEvent_KEYCODE_BUTTON_MODE 110L +#undef android_view_KeyEvent_KEYCODE_ESCAPE +#define android_view_KeyEvent_KEYCODE_ESCAPE 111L +#undef android_view_KeyEvent_KEYCODE_FORWARD_DEL +#define android_view_KeyEvent_KEYCODE_FORWARD_DEL 112L +#undef android_view_KeyEvent_KEYCODE_CTRL_LEFT +#define android_view_KeyEvent_KEYCODE_CTRL_LEFT 113L +#undef android_view_KeyEvent_KEYCODE_CTRL_RIGHT +#define android_view_KeyEvent_KEYCODE_CTRL_RIGHT 114L +#undef android_view_KeyEvent_KEYCODE_CAPS_LOCK +#define android_view_KeyEvent_KEYCODE_CAPS_LOCK 115L +#undef android_view_KeyEvent_KEYCODE_SCROLL_LOCK +#define android_view_KeyEvent_KEYCODE_SCROLL_LOCK 116L +#undef android_view_KeyEvent_KEYCODE_META_LEFT +#define android_view_KeyEvent_KEYCODE_META_LEFT 117L +#undef android_view_KeyEvent_KEYCODE_META_RIGHT +#define android_view_KeyEvent_KEYCODE_META_RIGHT 118L +#undef android_view_KeyEvent_KEYCODE_FUNCTION +#define android_view_KeyEvent_KEYCODE_FUNCTION 119L +#undef android_view_KeyEvent_KEYCODE_SYSRQ +#define android_view_KeyEvent_KEYCODE_SYSRQ 120L +#undef android_view_KeyEvent_KEYCODE_BREAK +#define android_view_KeyEvent_KEYCODE_BREAK 121L +#undef android_view_KeyEvent_KEYCODE_MOVE_HOME +#define android_view_KeyEvent_KEYCODE_MOVE_HOME 122L +#undef android_view_KeyEvent_KEYCODE_MOVE_END +#define android_view_KeyEvent_KEYCODE_MOVE_END 123L +#undef android_view_KeyEvent_KEYCODE_INSERT +#define android_view_KeyEvent_KEYCODE_INSERT 124L +#undef android_view_KeyEvent_KEYCODE_FORWARD +#define android_view_KeyEvent_KEYCODE_FORWARD 125L +#undef android_view_KeyEvent_KEYCODE_MEDIA_PLAY +#define android_view_KeyEvent_KEYCODE_MEDIA_PLAY 126L +#undef android_view_KeyEvent_KEYCODE_MEDIA_PAUSE +#define android_view_KeyEvent_KEYCODE_MEDIA_PAUSE 127L +#undef android_view_KeyEvent_KEYCODE_MEDIA_CLOSE +#define android_view_KeyEvent_KEYCODE_MEDIA_CLOSE 128L +#undef android_view_KeyEvent_KEYCODE_MEDIA_EJECT +#define android_view_KeyEvent_KEYCODE_MEDIA_EJECT 129L +#undef android_view_KeyEvent_KEYCODE_MEDIA_RECORD +#define android_view_KeyEvent_KEYCODE_MEDIA_RECORD 130L +#undef android_view_KeyEvent_KEYCODE_F1 +#define android_view_KeyEvent_KEYCODE_F1 131L +#undef android_view_KeyEvent_KEYCODE_F2 +#define android_view_KeyEvent_KEYCODE_F2 132L +#undef android_view_KeyEvent_KEYCODE_F3 +#define android_view_KeyEvent_KEYCODE_F3 133L +#undef android_view_KeyEvent_KEYCODE_F4 +#define android_view_KeyEvent_KEYCODE_F4 134L +#undef android_view_KeyEvent_KEYCODE_F5 +#define android_view_KeyEvent_KEYCODE_F5 135L +#undef android_view_KeyEvent_KEYCODE_F6 +#define android_view_KeyEvent_KEYCODE_F6 136L +#undef android_view_KeyEvent_KEYCODE_F7 +#define android_view_KeyEvent_KEYCODE_F7 137L +#undef android_view_KeyEvent_KEYCODE_F8 +#define android_view_KeyEvent_KEYCODE_F8 138L +#undef android_view_KeyEvent_KEYCODE_F9 +#define android_view_KeyEvent_KEYCODE_F9 139L +#undef android_view_KeyEvent_KEYCODE_F10 +#define android_view_KeyEvent_KEYCODE_F10 140L +#undef android_view_KeyEvent_KEYCODE_F11 +#define android_view_KeyEvent_KEYCODE_F11 141L +#undef android_view_KeyEvent_KEYCODE_F12 +#define android_view_KeyEvent_KEYCODE_F12 142L +#undef android_view_KeyEvent_KEYCODE_NUM_LOCK +#define android_view_KeyEvent_KEYCODE_NUM_LOCK 143L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_0 +#define android_view_KeyEvent_KEYCODE_NUMPAD_0 144L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_1 +#define android_view_KeyEvent_KEYCODE_NUMPAD_1 145L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_2 +#define android_view_KeyEvent_KEYCODE_NUMPAD_2 146L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_3 +#define android_view_KeyEvent_KEYCODE_NUMPAD_3 147L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_4 +#define android_view_KeyEvent_KEYCODE_NUMPAD_4 148L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_5 +#define android_view_KeyEvent_KEYCODE_NUMPAD_5 149L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_6 +#define android_view_KeyEvent_KEYCODE_NUMPAD_6 150L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_7 +#define android_view_KeyEvent_KEYCODE_NUMPAD_7 151L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_8 +#define android_view_KeyEvent_KEYCODE_NUMPAD_8 152L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_9 +#define android_view_KeyEvent_KEYCODE_NUMPAD_9 153L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_DIVIDE +#define android_view_KeyEvent_KEYCODE_NUMPAD_DIVIDE 154L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_MULTIPLY +#define android_view_KeyEvent_KEYCODE_NUMPAD_MULTIPLY 155L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_SUBTRACT +#define android_view_KeyEvent_KEYCODE_NUMPAD_SUBTRACT 156L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_ADD +#define android_view_KeyEvent_KEYCODE_NUMPAD_ADD 157L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_DOT +#define android_view_KeyEvent_KEYCODE_NUMPAD_DOT 158L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_COMMA +#define android_view_KeyEvent_KEYCODE_NUMPAD_COMMA 159L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_ENTER +#define android_view_KeyEvent_KEYCODE_NUMPAD_ENTER 160L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_EQUALS +#define android_view_KeyEvent_KEYCODE_NUMPAD_EQUALS 161L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_LEFT_PAREN +#define android_view_KeyEvent_KEYCODE_NUMPAD_LEFT_PAREN 162L +#undef android_view_KeyEvent_KEYCODE_NUMPAD_RIGHT_PAREN +#define android_view_KeyEvent_KEYCODE_NUMPAD_RIGHT_PAREN 163L +#undef android_view_KeyEvent_KEYCODE_VOLUME_MUTE +#define android_view_KeyEvent_KEYCODE_VOLUME_MUTE 164L +#undef android_view_KeyEvent_KEYCODE_INFO +#define android_view_KeyEvent_KEYCODE_INFO 165L +#undef android_view_KeyEvent_KEYCODE_CHANNEL_UP +#define android_view_KeyEvent_KEYCODE_CHANNEL_UP 166L +#undef android_view_KeyEvent_KEYCODE_CHANNEL_DOWN +#define android_view_KeyEvent_KEYCODE_CHANNEL_DOWN 167L +#undef android_view_KeyEvent_KEYCODE_ZOOM_IN +#define android_view_KeyEvent_KEYCODE_ZOOM_IN 168L +#undef android_view_KeyEvent_KEYCODE_ZOOM_OUT +#define android_view_KeyEvent_KEYCODE_ZOOM_OUT 169L +#undef android_view_KeyEvent_KEYCODE_TV +#define android_view_KeyEvent_KEYCODE_TV 170L +#undef android_view_KeyEvent_KEYCODE_WINDOW +#define android_view_KeyEvent_KEYCODE_WINDOW 171L +#undef android_view_KeyEvent_KEYCODE_GUIDE +#define android_view_KeyEvent_KEYCODE_GUIDE 172L +#undef android_view_KeyEvent_KEYCODE_DVR +#define android_view_KeyEvent_KEYCODE_DVR 173L +#undef android_view_KeyEvent_KEYCODE_BOOKMARK +#define android_view_KeyEvent_KEYCODE_BOOKMARK 174L +#undef android_view_KeyEvent_KEYCODE_CAPTIONS +#define android_view_KeyEvent_KEYCODE_CAPTIONS 175L +#undef android_view_KeyEvent_KEYCODE_SETTINGS +#define android_view_KeyEvent_KEYCODE_SETTINGS 176L +#undef android_view_KeyEvent_KEYCODE_TV_POWER +#define android_view_KeyEvent_KEYCODE_TV_POWER 177L +#undef android_view_KeyEvent_KEYCODE_TV_INPUT +#define android_view_KeyEvent_KEYCODE_TV_INPUT 178L +#undef android_view_KeyEvent_KEYCODE_STB_POWER +#define android_view_KeyEvent_KEYCODE_STB_POWER 179L +#undef android_view_KeyEvent_KEYCODE_STB_INPUT +#define android_view_KeyEvent_KEYCODE_STB_INPUT 180L +#undef android_view_KeyEvent_KEYCODE_AVR_POWER +#define android_view_KeyEvent_KEYCODE_AVR_POWER 181L +#undef android_view_KeyEvent_KEYCODE_AVR_INPUT +#define android_view_KeyEvent_KEYCODE_AVR_INPUT 182L +#undef android_view_KeyEvent_KEYCODE_PROG_RED +#define android_view_KeyEvent_KEYCODE_PROG_RED 183L +#undef android_view_KeyEvent_KEYCODE_PROG_GREEN +#define android_view_KeyEvent_KEYCODE_PROG_GREEN 184L +#undef android_view_KeyEvent_KEYCODE_PROG_YELLOW +#define android_view_KeyEvent_KEYCODE_PROG_YELLOW 185L +#undef android_view_KeyEvent_KEYCODE_PROG_BLUE +#define android_view_KeyEvent_KEYCODE_PROG_BLUE 186L +#undef android_view_KeyEvent_KEYCODE_APP_SWITCH +#define android_view_KeyEvent_KEYCODE_APP_SWITCH 187L +#undef android_view_KeyEvent_KEYCODE_BUTTON_1 +#define android_view_KeyEvent_KEYCODE_BUTTON_1 188L +#undef android_view_KeyEvent_KEYCODE_BUTTON_2 +#define android_view_KeyEvent_KEYCODE_BUTTON_2 189L +#undef android_view_KeyEvent_KEYCODE_BUTTON_3 +#define android_view_KeyEvent_KEYCODE_BUTTON_3 190L +#undef android_view_KeyEvent_KEYCODE_BUTTON_4 +#define android_view_KeyEvent_KEYCODE_BUTTON_4 191L +#undef android_view_KeyEvent_KEYCODE_BUTTON_5 +#define android_view_KeyEvent_KEYCODE_BUTTON_5 192L +#undef android_view_KeyEvent_KEYCODE_BUTTON_6 +#define android_view_KeyEvent_KEYCODE_BUTTON_6 193L +#undef android_view_KeyEvent_KEYCODE_BUTTON_7 +#define android_view_KeyEvent_KEYCODE_BUTTON_7 194L +#undef android_view_KeyEvent_KEYCODE_BUTTON_8 +#define android_view_KeyEvent_KEYCODE_BUTTON_8 195L +#undef android_view_KeyEvent_KEYCODE_BUTTON_9 +#define android_view_KeyEvent_KEYCODE_BUTTON_9 196L +#undef android_view_KeyEvent_KEYCODE_BUTTON_10 +#define android_view_KeyEvent_KEYCODE_BUTTON_10 197L +#undef android_view_KeyEvent_KEYCODE_BUTTON_11 +#define android_view_KeyEvent_KEYCODE_BUTTON_11 198L +#undef android_view_KeyEvent_KEYCODE_BUTTON_12 +#define android_view_KeyEvent_KEYCODE_BUTTON_12 199L +#undef android_view_KeyEvent_KEYCODE_BUTTON_13 +#define android_view_KeyEvent_KEYCODE_BUTTON_13 200L +#undef android_view_KeyEvent_KEYCODE_BUTTON_14 +#define android_view_KeyEvent_KEYCODE_BUTTON_14 201L +#undef android_view_KeyEvent_KEYCODE_BUTTON_15 +#define android_view_KeyEvent_KEYCODE_BUTTON_15 202L +#undef android_view_KeyEvent_KEYCODE_BUTTON_16 +#define android_view_KeyEvent_KEYCODE_BUTTON_16 203L +#undef android_view_KeyEvent_KEYCODE_LANGUAGE_SWITCH +#define android_view_KeyEvent_KEYCODE_LANGUAGE_SWITCH 204L +#undef android_view_KeyEvent_KEYCODE_MANNER_MODE +#define android_view_KeyEvent_KEYCODE_MANNER_MODE 205L +#undef android_view_KeyEvent_KEYCODE_3D_MODE +#define android_view_KeyEvent_KEYCODE_3D_MODE 206L +#undef android_view_KeyEvent_KEYCODE_CONTACTS +#define android_view_KeyEvent_KEYCODE_CONTACTS 207L +#undef android_view_KeyEvent_KEYCODE_CALENDAR +#define android_view_KeyEvent_KEYCODE_CALENDAR 208L +#undef android_view_KeyEvent_KEYCODE_MUSIC +#define android_view_KeyEvent_KEYCODE_MUSIC 209L +#undef android_view_KeyEvent_KEYCODE_CALCULATOR +#define android_view_KeyEvent_KEYCODE_CALCULATOR 210L +#undef android_view_KeyEvent_KEYCODE_ZENKAKU_HANKAKU +#define android_view_KeyEvent_KEYCODE_ZENKAKU_HANKAKU 211L +#undef android_view_KeyEvent_KEYCODE_EISU +#define android_view_KeyEvent_KEYCODE_EISU 212L +#undef android_view_KeyEvent_KEYCODE_MUHENKAN +#define android_view_KeyEvent_KEYCODE_MUHENKAN 213L +#undef android_view_KeyEvent_KEYCODE_HENKAN +#define android_view_KeyEvent_KEYCODE_HENKAN 214L +#undef android_view_KeyEvent_KEYCODE_KATAKANA_HIRAGANA +#define android_view_KeyEvent_KEYCODE_KATAKANA_HIRAGANA 215L +#undef android_view_KeyEvent_KEYCODE_YEN +#define android_view_KeyEvent_KEYCODE_YEN 216L +#undef android_view_KeyEvent_KEYCODE_RO +#define android_view_KeyEvent_KEYCODE_RO 217L +#undef android_view_KeyEvent_KEYCODE_KANA +#define android_view_KeyEvent_KEYCODE_KANA 218L +#undef android_view_KeyEvent_KEYCODE_ASSIST +#define android_view_KeyEvent_KEYCODE_ASSIST 219L +#undef android_view_KeyEvent_KEYCODE_BRIGHTNESS_DOWN +#define android_view_KeyEvent_KEYCODE_BRIGHTNESS_DOWN 220L +#undef android_view_KeyEvent_KEYCODE_BRIGHTNESS_UP +#define android_view_KeyEvent_KEYCODE_BRIGHTNESS_UP 221L +#undef android_view_KeyEvent_KEYCODE_MEDIA_AUDIO_TRACK +#define android_view_KeyEvent_KEYCODE_MEDIA_AUDIO_TRACK 222L +#undef android_view_KeyEvent_LAST_KEYCODE +#define android_view_KeyEvent_LAST_KEYCODE 222L +#undef android_view_KeyEvent_MAX_KEYCODE +#define android_view_KeyEvent_MAX_KEYCODE 84L +#undef android_view_KeyEvent_ACTION_DOWN +#define android_view_KeyEvent_ACTION_DOWN 0L +#undef android_view_KeyEvent_ACTION_UP +#define android_view_KeyEvent_ACTION_UP 1L +#undef android_view_KeyEvent_ACTION_MULTIPLE +#define android_view_KeyEvent_ACTION_MULTIPLE 2L +#undef android_view_KeyEvent_META_CAP_LOCKED +#define android_view_KeyEvent_META_CAP_LOCKED 256L +#undef android_view_KeyEvent_META_ALT_LOCKED +#define android_view_KeyEvent_META_ALT_LOCKED 512L +#undef android_view_KeyEvent_META_SYM_LOCKED +#define android_view_KeyEvent_META_SYM_LOCKED 1024L +#undef android_view_KeyEvent_META_SELECTING +#define android_view_KeyEvent_META_SELECTING 2048L +#undef android_view_KeyEvent_META_ALT_ON +#define android_view_KeyEvent_META_ALT_ON 2L +#undef android_view_KeyEvent_META_ALT_LEFT_ON +#define android_view_KeyEvent_META_ALT_LEFT_ON 16L +#undef android_view_KeyEvent_META_ALT_RIGHT_ON +#define android_view_KeyEvent_META_ALT_RIGHT_ON 32L +#undef android_view_KeyEvent_META_SHIFT_ON +#define android_view_KeyEvent_META_SHIFT_ON 1L +#undef android_view_KeyEvent_META_SHIFT_LEFT_ON +#define android_view_KeyEvent_META_SHIFT_LEFT_ON 64L +#undef android_view_KeyEvent_META_SHIFT_RIGHT_ON +#define android_view_KeyEvent_META_SHIFT_RIGHT_ON 128L +#undef android_view_KeyEvent_META_SYM_ON +#define android_view_KeyEvent_META_SYM_ON 4L +#undef android_view_KeyEvent_META_FUNCTION_ON +#define android_view_KeyEvent_META_FUNCTION_ON 8L +#undef android_view_KeyEvent_META_CTRL_ON +#define android_view_KeyEvent_META_CTRL_ON 4096L +#undef android_view_KeyEvent_META_CTRL_LEFT_ON +#define android_view_KeyEvent_META_CTRL_LEFT_ON 8192L +#undef android_view_KeyEvent_META_CTRL_RIGHT_ON +#define android_view_KeyEvent_META_CTRL_RIGHT_ON 16384L +#undef android_view_KeyEvent_META_META_ON +#define android_view_KeyEvent_META_META_ON 65536L +#undef android_view_KeyEvent_META_META_LEFT_ON +#define android_view_KeyEvent_META_META_LEFT_ON 131072L +#undef android_view_KeyEvent_META_META_RIGHT_ON +#define android_view_KeyEvent_META_META_RIGHT_ON 262144L +#undef android_view_KeyEvent_META_CAPS_LOCK_ON +#define android_view_KeyEvent_META_CAPS_LOCK_ON 1048576L +#undef android_view_KeyEvent_META_NUM_LOCK_ON +#define android_view_KeyEvent_META_NUM_LOCK_ON 2097152L +#undef android_view_KeyEvent_META_SCROLL_LOCK_ON +#define android_view_KeyEvent_META_SCROLL_LOCK_ON 4194304L +#undef android_view_KeyEvent_META_SHIFT_MASK +#define android_view_KeyEvent_META_SHIFT_MASK 193L +#undef android_view_KeyEvent_META_ALT_MASK +#define android_view_KeyEvent_META_ALT_MASK 50L +#undef android_view_KeyEvent_META_CTRL_MASK +#define android_view_KeyEvent_META_CTRL_MASK 28672L +#undef android_view_KeyEvent_META_META_MASK +#define android_view_KeyEvent_META_META_MASK 458752L +#undef android_view_KeyEvent_FLAG_WOKE_HERE +#define android_view_KeyEvent_FLAG_WOKE_HERE 1L +#undef android_view_KeyEvent_FLAG_SOFT_KEYBOARD +#define android_view_KeyEvent_FLAG_SOFT_KEYBOARD 2L +#undef android_view_KeyEvent_FLAG_KEEP_TOUCH_MODE +#define android_view_KeyEvent_FLAG_KEEP_TOUCH_MODE 4L +#undef android_view_KeyEvent_FLAG_FROM_SYSTEM +#define android_view_KeyEvent_FLAG_FROM_SYSTEM 8L +#undef android_view_KeyEvent_FLAG_EDITOR_ACTION +#define android_view_KeyEvent_FLAG_EDITOR_ACTION 16L +#undef android_view_KeyEvent_FLAG_CANCELED +#define android_view_KeyEvent_FLAG_CANCELED 32L +#undef android_view_KeyEvent_FLAG_VIRTUAL_HARD_KEY +#define android_view_KeyEvent_FLAG_VIRTUAL_HARD_KEY 64L +#undef android_view_KeyEvent_FLAG_LONG_PRESS +#define android_view_KeyEvent_FLAG_LONG_PRESS 128L +#undef android_view_KeyEvent_FLAG_CANCELED_LONG_PRESS +#define android_view_KeyEvent_FLAG_CANCELED_LONG_PRESS 256L +#undef android_view_KeyEvent_FLAG_TRACKING +#define android_view_KeyEvent_FLAG_TRACKING 512L +#undef android_view_KeyEvent_FLAG_FALLBACK +#define android_view_KeyEvent_FLAG_FALLBACK 1024L +#undef android_view_KeyEvent_FLAG_PREDISPATCH +#define android_view_KeyEvent_FLAG_PREDISPATCH 536870912L +#undef android_view_KeyEvent_FLAG_START_TRACKING +#define android_view_KeyEvent_FLAG_START_TRACKING 1073741824L +#undef android_view_KeyEvent_FLAG_TAINTED +#define android_view_KeyEvent_FLAG_TAINTED -2147483648L +#undef android_view_KeyEvent_DEBUG +#define android_view_KeyEvent_DEBUG 0L +#undef android_view_KeyEvent_MAX_RECYCLED +#define android_view_KeyEvent_MAX_RECYCLED 10L +#undef android_view_KeyEvent_META_MODIFIER_MASK +#define android_view_KeyEvent_META_MODIFIER_MASK 487679L +#undef android_view_KeyEvent_META_LOCK_MASK +#define android_view_KeyEvent_META_LOCK_MASK 7340032L +#undef android_view_KeyEvent_META_ALL_MASK +#define android_view_KeyEvent_META_ALL_MASK 7827711L +#undef android_view_KeyEvent_META_SYNTHETIC_MASK +#define android_view_KeyEvent_META_SYNTHETIC_MASK 3840L +#undef android_view_KeyEvent_META_INVALID_MODIFIER_MASK +#define android_view_KeyEvent_META_INVALID_MODIFIER_MASK 7343872L +/* + * Class: android_view_KeyEvent + * Method: native_isSystemKey + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_android_view_KeyEvent_native_1isSystemKey + (JNIEnv *, jobject, jint); + +/* + * Class: android_view_KeyEvent + * Method: native_hasDefaultAction + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_android_view_KeyEvent_native_1hasDefaultAction + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/api-impl-jni/generated_headers/android_view_View.h b/src/api-impl-jni/generated_headers/android_view_View.h index 0b4eeeb4..4b0dd984 100644 --- a/src/api-impl-jni/generated_headers/android_view_View.h +++ b/src/api-impl-jni/generated_headers/android_view_View.h @@ -149,6 +149,56 @@ extern "C" { #define android_view_View_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L #undef android_view_View_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK #define android_view_View_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L +#undef android_view_View_STATUS_BAR_HIDDEN +#define android_view_View_STATUS_BAR_HIDDEN 1L +#undef android_view_View_STATUS_BAR_VISIBLE +#define android_view_View_STATUS_BAR_VISIBLE 0L +#undef android_view_View_SYSTEM_UI_FLAG_FULLSCREEN +#define android_view_View_SYSTEM_UI_FLAG_FULLSCREEN 4L +#undef android_view_View_SYSTEM_UI_FLAG_HIDE_NAVIGATION +#define android_view_View_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L +#undef android_view_View_SYSTEM_UI_FLAG_IMMERSIVE +#define android_view_View_SYSTEM_UI_FLAG_IMMERSIVE 2048L +#undef android_view_View_SYSTEM_UI_FLAG_IMMERSIVE_STICKY +#define android_view_View_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L +#undef android_view_View_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +#define android_view_View_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L +#undef android_view_View_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION +#define android_view_View_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L +#undef android_view_View_SYSTEM_UI_FLAG_LAYOUT_STABLE +#define android_view_View_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L +#undef android_view_View_SYSTEM_UI_FLAG_LOW_PROFILE +#define android_view_View_SYSTEM_UI_FLAG_LOW_PROFILE 1L +#undef android_view_View_SYSTEM_UI_FLAG_VISIBLE +#define android_view_View_SYSTEM_UI_FLAG_VISIBLE 0L +#undef android_view_View_SYSTEM_UI_LAYOUT_FLAGS +#define android_view_View_SYSTEM_UI_LAYOUT_FLAGS 1536L +#undef android_view_View_TEXT_ALIGNMENT_CENTER +#define android_view_View_TEXT_ALIGNMENT_CENTER 4L +#undef android_view_View_TEXT_ALIGNMENT_GRAVITY +#define android_view_View_TEXT_ALIGNMENT_GRAVITY 1L +#undef android_view_View_TEXT_ALIGNMENT_INHERIT +#define android_view_View_TEXT_ALIGNMENT_INHERIT 0L +#undef android_view_View_TEXT_ALIGNMENT_TEXT_END +#define android_view_View_TEXT_ALIGNMENT_TEXT_END 3L +#undef android_view_View_TEXT_ALIGNMENT_TEXT_START +#define android_view_View_TEXT_ALIGNMENT_TEXT_START 2L +#undef android_view_View_TEXT_ALIGNMENT_VIEW_END +#define android_view_View_TEXT_ALIGNMENT_VIEW_END 6L +#undef android_view_View_TEXT_ALIGNMENT_VIEW_START +#define android_view_View_TEXT_ALIGNMENT_VIEW_START 5L +#undef android_view_View_TEXT_DIRECTION_ANY_RTL +#define android_view_View_TEXT_DIRECTION_ANY_RTL 2L +#undef android_view_View_TEXT_DIRECTION_FIRST_STRONG +#define android_view_View_TEXT_DIRECTION_FIRST_STRONG 1L +#undef android_view_View_TEXT_DIRECTION_INHERIT +#define android_view_View_TEXT_DIRECTION_INHERIT 0L +#undef android_view_View_TEXT_DIRECTION_LOCALE +#define android_view_View_TEXT_DIRECTION_LOCALE 5L +#undef android_view_View_TEXT_DIRECTION_LTR +#define android_view_View_TEXT_DIRECTION_LTR 3L +#undef android_view_View_TEXT_DIRECTION_RTL +#define android_view_View_TEXT_DIRECTION_RTL 4L /* * Class: android_view_View * Method: setGravity diff --git a/src/api-impl-jni/generated_headers/android_view_ViewGroup.h b/src/api-impl-jni/generated_headers/android_view_ViewGroup.h index d78ffe05..fe825913 100644 --- a/src/api-impl-jni/generated_headers/android_view_ViewGroup.h +++ b/src/api-impl-jni/generated_headers/android_view_ViewGroup.h @@ -149,6 +149,56 @@ extern "C" { #define android_view_ViewGroup_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L #undef android_view_ViewGroup_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK #define android_view_ViewGroup_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L +#undef android_view_ViewGroup_STATUS_BAR_HIDDEN +#define android_view_ViewGroup_STATUS_BAR_HIDDEN 1L +#undef android_view_ViewGroup_STATUS_BAR_VISIBLE +#define android_view_ViewGroup_STATUS_BAR_VISIBLE 0L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_FULLSCREEN +#define android_view_ViewGroup_SYSTEM_UI_FLAG_FULLSCREEN 4L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_HIDE_NAVIGATION +#define android_view_ViewGroup_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_IMMERSIVE +#define android_view_ViewGroup_SYSTEM_UI_FLAG_IMMERSIVE 2048L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_IMMERSIVE_STICKY +#define android_view_ViewGroup_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +#define android_view_ViewGroup_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION +#define android_view_ViewGroup_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_LAYOUT_STABLE +#define android_view_ViewGroup_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_LOW_PROFILE +#define android_view_ViewGroup_SYSTEM_UI_FLAG_LOW_PROFILE 1L +#undef android_view_ViewGroup_SYSTEM_UI_FLAG_VISIBLE +#define android_view_ViewGroup_SYSTEM_UI_FLAG_VISIBLE 0L +#undef android_view_ViewGroup_SYSTEM_UI_LAYOUT_FLAGS +#define android_view_ViewGroup_SYSTEM_UI_LAYOUT_FLAGS 1536L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_CENTER +#define android_view_ViewGroup_TEXT_ALIGNMENT_CENTER 4L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_GRAVITY +#define android_view_ViewGroup_TEXT_ALIGNMENT_GRAVITY 1L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_INHERIT +#define android_view_ViewGroup_TEXT_ALIGNMENT_INHERIT 0L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_TEXT_END +#define android_view_ViewGroup_TEXT_ALIGNMENT_TEXT_END 3L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_TEXT_START +#define android_view_ViewGroup_TEXT_ALIGNMENT_TEXT_START 2L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_VIEW_END +#define android_view_ViewGroup_TEXT_ALIGNMENT_VIEW_END 6L +#undef android_view_ViewGroup_TEXT_ALIGNMENT_VIEW_START +#define android_view_ViewGroup_TEXT_ALIGNMENT_VIEW_START 5L +#undef android_view_ViewGroup_TEXT_DIRECTION_ANY_RTL +#define android_view_ViewGroup_TEXT_DIRECTION_ANY_RTL 2L +#undef android_view_ViewGroup_TEXT_DIRECTION_FIRST_STRONG +#define android_view_ViewGroup_TEXT_DIRECTION_FIRST_STRONG 1L +#undef android_view_ViewGroup_TEXT_DIRECTION_INHERIT +#define android_view_ViewGroup_TEXT_DIRECTION_INHERIT 0L +#undef android_view_ViewGroup_TEXT_DIRECTION_LOCALE +#define android_view_ViewGroup_TEXT_DIRECTION_LOCALE 5L +#undef android_view_ViewGroup_TEXT_DIRECTION_LTR +#define android_view_ViewGroup_TEXT_DIRECTION_LTR 3L +#undef android_view_ViewGroup_TEXT_DIRECTION_RTL +#define android_view_ViewGroup_TEXT_DIRECTION_RTL 4L /* * Class: android_view_ViewGroup * Method: addView diff --git a/src/api-impl-jni/generated_headers/android_widget_TextView.h b/src/api-impl-jni/generated_headers/android_widget_TextView.h index 7503d1f6..c1b07763 100644 --- a/src/api-impl-jni/generated_headers/android_widget_TextView.h +++ b/src/api-impl-jni/generated_headers/android_widget_TextView.h @@ -149,6 +149,56 @@ extern "C" { #define android_widget_TextView_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L #undef android_widget_TextView_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK #define android_widget_TextView_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L +#undef android_widget_TextView_STATUS_BAR_HIDDEN +#define android_widget_TextView_STATUS_BAR_HIDDEN 1L +#undef android_widget_TextView_STATUS_BAR_VISIBLE +#define android_widget_TextView_STATUS_BAR_VISIBLE 0L +#undef android_widget_TextView_SYSTEM_UI_FLAG_FULLSCREEN +#define android_widget_TextView_SYSTEM_UI_FLAG_FULLSCREEN 4L +#undef android_widget_TextView_SYSTEM_UI_FLAG_HIDE_NAVIGATION +#define android_widget_TextView_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L +#undef android_widget_TextView_SYSTEM_UI_FLAG_IMMERSIVE +#define android_widget_TextView_SYSTEM_UI_FLAG_IMMERSIVE 2048L +#undef android_widget_TextView_SYSTEM_UI_FLAG_IMMERSIVE_STICKY +#define android_widget_TextView_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L +#undef android_widget_TextView_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +#define android_widget_TextView_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L +#undef android_widget_TextView_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION +#define android_widget_TextView_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L +#undef android_widget_TextView_SYSTEM_UI_FLAG_LAYOUT_STABLE +#define android_widget_TextView_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L +#undef android_widget_TextView_SYSTEM_UI_FLAG_LOW_PROFILE +#define android_widget_TextView_SYSTEM_UI_FLAG_LOW_PROFILE 1L +#undef android_widget_TextView_SYSTEM_UI_FLAG_VISIBLE +#define android_widget_TextView_SYSTEM_UI_FLAG_VISIBLE 0L +#undef android_widget_TextView_SYSTEM_UI_LAYOUT_FLAGS +#define android_widget_TextView_SYSTEM_UI_LAYOUT_FLAGS 1536L +#undef android_widget_TextView_TEXT_ALIGNMENT_CENTER +#define android_widget_TextView_TEXT_ALIGNMENT_CENTER 4L +#undef android_widget_TextView_TEXT_ALIGNMENT_GRAVITY +#define android_widget_TextView_TEXT_ALIGNMENT_GRAVITY 1L +#undef android_widget_TextView_TEXT_ALIGNMENT_INHERIT +#define android_widget_TextView_TEXT_ALIGNMENT_INHERIT 0L +#undef android_widget_TextView_TEXT_ALIGNMENT_TEXT_END +#define android_widget_TextView_TEXT_ALIGNMENT_TEXT_END 3L +#undef android_widget_TextView_TEXT_ALIGNMENT_TEXT_START +#define android_widget_TextView_TEXT_ALIGNMENT_TEXT_START 2L +#undef android_widget_TextView_TEXT_ALIGNMENT_VIEW_END +#define android_widget_TextView_TEXT_ALIGNMENT_VIEW_END 6L +#undef android_widget_TextView_TEXT_ALIGNMENT_VIEW_START +#define android_widget_TextView_TEXT_ALIGNMENT_VIEW_START 5L +#undef android_widget_TextView_TEXT_DIRECTION_ANY_RTL +#define android_widget_TextView_TEXT_DIRECTION_ANY_RTL 2L +#undef android_widget_TextView_TEXT_DIRECTION_FIRST_STRONG +#define android_widget_TextView_TEXT_DIRECTION_FIRST_STRONG 1L +#undef android_widget_TextView_TEXT_DIRECTION_INHERIT +#define android_widget_TextView_TEXT_DIRECTION_INHERIT 0L +#undef android_widget_TextView_TEXT_DIRECTION_LOCALE +#define android_widget_TextView_TEXT_DIRECTION_LOCALE 5L +#undef android_widget_TextView_TEXT_DIRECTION_LTR +#define android_widget_TextView_TEXT_DIRECTION_LTR 3L +#undef android_widget_TextView_TEXT_DIRECTION_RTL +#define android_widget_TextView_TEXT_DIRECTION_RTL 4L /* * Class: android_widget_TextView * Method: native_constructor diff --git a/src/api-impl-jni/util.c b/src/api-impl-jni/util.c index 90ed7e5c..c621e4fe 100644 --- a/src/api-impl-jni/util.c +++ b/src/api-impl-jni/util.c @@ -106,6 +106,18 @@ void set_up_handle_cache(JNIEnv *env) handle_cache.asset_manager.class = _REF((*env)->FindClass(env, "android/content/res/AssetManager")); handle_cache.asset_manager.extractFromAPK = _STATIC_METHOD(handle_cache.asset_manager.class, "extractFromAPK", "(Ljava/lang/String;Ljava/lang/String;)V"); + + handle_cache.context.class = _REF((*env)->FindClass(env, "android/content/Context")); + if((*env)->ExceptionCheck(env)) + (*env)->ExceptionDescribe(env); + handle_cache.context.get_package_name = _METHOD(handle_cache.context.class, "getPackageName", "()Ljava/lang/String;"); + if((*env)->ExceptionCheck(env)) + (*env)->ExceptionDescribe(env); + + handle_cache.application.class = _REF((*env)->FindClass(env, "android/app/Application")); + handle_cache.application.object = _REF(_GET_STATIC_OBJ_FIELD(handle_cache.context.class, "this_application", "Landroid/app/Application;")); + handle_cache.application.get_app_icon_path = _METHOD(handle_cache.application.class, "get_app_icon_path", "()Ljava/lang/String;"); + } void extract_from_apk(const char *path, const char *target) { diff --git a/src/api-impl-jni/util.h b/src/api-impl-jni/util.h index cd05f15d..8ea57b38 100644 --- a/src/api-impl-jni/util.h +++ b/src/api-impl-jni/util.h @@ -75,6 +75,15 @@ struct handle_cache { jclass class; jmethodID extractFromAPK; } asset_manager; + struct { + jclass class; + jmethodID get_package_name; + } context; + struct { + jclass class; + jobject object; + jmethodID get_app_icon_path; + } application; }; extern struct handle_cache handle_cache; diff --git a/src/api-impl/android/app/SharedPreferencesImpl.java b/src/api-impl/android/app/SharedPreferencesImpl.java index c6ff28f4..485910a0 100644 --- a/src/api-impl/android/app/SharedPreferencesImpl.java +++ b/src/api-impl/android/app/SharedPreferencesImpl.java @@ -250,6 +250,7 @@ public final class SharedPreferencesImpl implements SharedPreferences { } public boolean getBoolean(String key, boolean defValue) { synchronized (this) { + System.out.println("android.app.SharedPreferencesImpl.getBoolean("+key+", "+defValue+")"); awaitLoadedLocked(); Boolean v = (Boolean)mMap.get(key); return v != null ? v : defValue; diff --git a/src/api-impl/android/content/Intent.java b/src/api-impl/android/content/Intent.java index 3fa329bb..53870410 100644 --- a/src/api-impl/android/content/Intent.java +++ b/src/api-impl/android/content/Intent.java @@ -20,6 +20,10 @@ public class Intent { } public Intent(String action, Uri uri, Context packageContext, Class cls) {} + public Intent addFlags(int flags) { + return this; //?? + } + public Intent setFlags(int flags) { return this; //?? } diff --git a/src/api-impl/android/content/IntentFilter.java b/src/api-impl/android/content/IntentFilter.java index f53d5672..607504b7 100644 --- a/src/api-impl/android/content/IntentFilter.java +++ b/src/api-impl/android/content/IntentFilter.java @@ -5,4 +5,5 @@ public class IntentFilter { public IntentFilter(String dummy) {} public void addAction(String action) {} + public int countActions() { return 0; /*maybe?*/ } } diff --git a/src/api-impl/android/net/Uri.java b/src/api-impl/android/net/Uri.java index ce4750c4..e05e32aa 100644 --- a/src/api-impl/android/net/Uri.java +++ b/src/api-impl/android/net/Uri.java @@ -4,4 +4,14 @@ public class Uri { public static Uri parse(String s) { return new Uri(); } + + public Builder buildUpon() { + return new Builder(); + } + + public static final class Builder { + public Builder appendQueryParameter(String key, String value) { + return this; + } + } } diff --git a/src/api-impl/android/os/Build.java b/src/api-impl/android/os/Build.java index 9584b374..c01c8dc1 100644 --- a/src/api-impl/android/os/Build.java +++ b/src/api-impl/android/os/Build.java @@ -63,7 +63,7 @@ public class Build { /** * The manufacturer of the product/hardware. */ - public static final String MANUFACTURER = getString("ro.product.manufacturer"); + public static final String MANUFACTURER = "HTC"/* HTC picked at random; getString("ro.product.manufacturer")*/; /** * The brand (e.g., carrier) the software is customized for, if any. diff --git a/src/api-impl/android/os/Bundle.java b/src/api-impl/android/os/Bundle.java index 98d47351..6c04af98 100644 --- a/src/api-impl/android/os/Bundle.java +++ b/src/api-impl/android/os/Bundle.java @@ -739,6 +739,10 @@ public final class Bundle implements Cloneable { public boolean getBoolean(String key, boolean defaultValue) { Object o = mMap.get(key); System.out.println("bundle.getBoolean(" + key + ", " + defaultValue + ") called"); + /* the default for this is very scummy */ + if(key.equals("com.facebook.sdk.AutoLogAppEventsEnabled")) { + return false; + } if (o == null) { return defaultValue; } diff --git a/src/api-impl/android/os/IInterface.java b/src/api-impl/android/os/IInterface.java new file mode 100644 index 00000000..2d798855 --- /dev/null +++ b/src/api-impl/android/os/IInterface.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.os; + +/** + * Base class for Binder interfaces. When defining a new interface, + * you must derive it from IInterface. + */ +public interface IInterface { + /** + * Retrieve the Binder object associated with this interface. + * You must use this instead of a plain cast, so that proxy objects + * can return the correct result. + */ + public IBinder asBinder(); +} diff --git a/src/api-impl/android/view/InputDevice.java b/src/api-impl/android/view/InputDevice.java index 5daadaa1..3c6b0432 100644 --- a/src/api-impl/android/view/InputDevice.java +++ b/src/api-impl/android/view/InputDevice.java @@ -1,6 +1,10 @@ package android.view; public class InputDevice { + + public static final int SOURCE_CLASS_BUTTON = 0x00000001; + public static final int SOURCE_KEYBOARD = 0x00000100 | SOURCE_CLASS_BUTTON; + public static int[] getDeviceIds() { return new int[] {0}; // might work? } diff --git a/src/api-impl/android/view/KeyCharacterMap.java b/src/api-impl/android/view/KeyCharacterMap.java new file mode 100644 index 00000000..1267de70 --- /dev/null +++ b/src/api-impl/android/view/KeyCharacterMap.java @@ -0,0 +1,740 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view; + +import android.hardware.input.InputManager; +//import android.text.method.MetaKeyKeyListener; +import android.util.AndroidRuntimeException; +import android.util.SparseIntArray; +import java.lang.Character; +import java.text.Normalizer; + +/** + * Describes the keys provided by a keyboard device and their associated labels. + */ +public class KeyCharacterMap { + /** + * The id of the device's primary built in keyboard is always 0. + * + * @deprecated This constant should no longer be used because there is no + * guarantee that a device has a built-in keyboard that can be used for + * typing text. There might not be a built-in keyboard, the built-in keyboard + * might be a {@link #NUMERIC} or {@link #SPECIAL_FUNCTION} keyboard, or there + * might be multiple keyboards installed including external keyboards. + * When interpreting key presses received from the framework, applications should + * use the device id specified in the {@link KeyEvent} received. + * When synthesizing key presses for delivery elsewhere or when translating key presses + * from unknown keyboards, applications should use the special {@link #VIRTUAL_KEYBOARD} + * device id. + */ + @Deprecated + public static final int BUILT_IN_KEYBOARD = 0; + + /** + * The id of a generic virtual keyboard with a full layout that can be used to + * synthesize key events. Typically used with {@link #getEvents}. + */ + public static final int VIRTUAL_KEYBOARD = -1; + + /** + * A numeric (12-key) keyboard. + *

+ * A numeric keyboard supports text entry using a multi-tap approach. + * It may be necessary to tap a key multiple times to generate the desired letter + * or symbol. + *

+ * This type of keyboard is generally designed for thumb typing. + *

+ */ + public static final int NUMERIC = 1; + + /** + * A keyboard with all the letters, but with more than one letter per key. + *

+ * This type of keyboard is generally designed for thumb typing. + *

+ */ + public static final int PREDICTIVE = 2; + + /** + * A keyboard with all the letters, and maybe some numbers. + *

+ * An alphabetic keyboard supports text entry directly but may have a condensed + * layout with a small form factor. In contrast to a {@link #FULL full keyboard}, some + * symbols may only be accessible using special on-screen character pickers. + * In addition, to improve typing speed and accuracy, the framework provides + * special affordances for alphabetic keyboards such as auto-capitalization + * and toggled / locked shift and alt keys. + *

+ * This type of keyboard is generally designed for thumb typing. + *

+ */ + public static final int ALPHA = 3; + + /** + * A full PC-style keyboard. + *

+ * A full keyboard behaves like a PC keyboard. All symbols are accessed directly + * by pressing keys on the keyboard without on-screen support or affordances such + * as auto-capitalization. + *

+ * This type of keyboard is generally designed for full two hand typing. + *

+ */ + public static final int FULL = 4; + + /** + * A keyboard that is only used to control special functions rather than for typing. + *

+ * A special function keyboard consists only of non-printing keys such as + * HOME and POWER that are not actually used for typing. + *

+ */ + public static final int SPECIAL_FUNCTION = 5; + + /** + * This private-use character is used to trigger Unicode character + * input by hex digits. + */ + public static final char HEX_INPUT = '\uEF00'; + + /** + * This private-use character is used to bring up a character picker for + * miscellaneous symbols. + */ + public static final char PICKER_DIALOG_INPUT = '\uEF01'; + + /** + * Modifier keys may be chorded with character keys. + * + * @see {#link #getModifierBehavior()} for more details. + */ + public static final int MODIFIER_BEHAVIOR_CHORDED = 0; + + /** + * Modifier keys may be chorded with character keys or they may toggle + * into latched or locked states when pressed independently. + * + * @see {#link #getModifierBehavior()} for more details. + */ + public static final int MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED = 1; + + /* + * This bit will be set in the return value of {@link #get(int, int)} if the + * key is a "dead key." + */ + public static final int COMBINING_ACCENT = 0x80000000; + + /** + * Mask the return value from {@link #get(int, int)} with this value to get + * a printable representation of the accent character of a "dead key." + */ + public static final int COMBINING_ACCENT_MASK = 0x7FFFFFFF; + + /* Characters used to display placeholders for dead keys. */ + private static final int ACCENT_ACUTE = '\u00B4'; + private static final int ACCENT_BREVE = '\u02D8'; + private static final int ACCENT_CARON = '\u02C7'; + private static final int ACCENT_CEDILLA = '\u00B8'; + private static final int ACCENT_CIRCUMFLEX = '\u02C6'; + private static final int ACCENT_COMMA_ABOVE = '\u1FBD'; + private static final int ACCENT_COMMA_ABOVE_RIGHT = '\u02BC'; + private static final int ACCENT_DOT_ABOVE = '\u02D9'; + private static final int ACCENT_DOT_BELOW = '.'; // approximate + private static final int ACCENT_DOUBLE_ACUTE = '\u02DD'; + private static final int ACCENT_GRAVE = '\u02CB'; + private static final int ACCENT_HOOK_ABOVE = '\u02C0'; + private static final int ACCENT_HORN = '\''; // approximate + private static final int ACCENT_MACRON = '\u00AF'; + private static final int ACCENT_MACRON_BELOW = '\u02CD'; + private static final int ACCENT_OGONEK = '\u02DB'; + private static final int ACCENT_REVERSED_COMMA_ABOVE = '\u02BD'; + private static final int ACCENT_RING_ABOVE = '\u02DA'; + private static final int ACCENT_STROKE = '-'; // approximate + private static final int ACCENT_TILDE = '\u02DC'; + private static final int ACCENT_TURNED_COMMA_ABOVE = '\u02BB'; + private static final int ACCENT_UMLAUT = '\u00A8'; + private static final int ACCENT_VERTICAL_LINE_ABOVE = '\u02C8'; + private static final int ACCENT_VERTICAL_LINE_BELOW = '\u02CC'; + + /* Legacy dead key display characters used in previous versions of the API. + * We still support these characters by mapping them to their non-legacy version. */ + private static final int ACCENT_GRAVE_LEGACY = '`'; + private static final int ACCENT_CIRCUMFLEX_LEGACY = '^'; + private static final int ACCENT_TILDE_LEGACY = '~'; + + private static final int CHAR_SPACE = ' '; + + /** + * Maps Unicode combining diacritical to display-form dead key. + */ + private static final SparseIntArray sCombiningToAccent = new SparseIntArray(); + private static final SparseIntArray sAccentToCombining = new SparseIntArray(); + static { + addCombining('\u0300', ACCENT_GRAVE); + addCombining('\u0301', ACCENT_ACUTE); + addCombining('\u0302', ACCENT_CIRCUMFLEX); + addCombining('\u0303', ACCENT_TILDE); + addCombining('\u0304', ACCENT_MACRON); + addCombining('\u0306', ACCENT_BREVE); + addCombining('\u0307', ACCENT_DOT_ABOVE); + addCombining('\u0308', ACCENT_UMLAUT); + addCombining('\u0309', ACCENT_HOOK_ABOVE); + addCombining('\u030A', ACCENT_RING_ABOVE); + addCombining('\u030B', ACCENT_DOUBLE_ACUTE); + addCombining('\u030C', ACCENT_CARON); + addCombining('\u030D', ACCENT_VERTICAL_LINE_ABOVE); + // addCombining('\u030E', ACCENT_DOUBLE_VERTICAL_LINE_ABOVE); + // addCombining('\u030F', ACCENT_DOUBLE_GRAVE); + // addCombining('\u0310', ACCENT_CANDRABINDU); + // addCombining('\u0311', ACCENT_INVERTED_BREVE); + addCombining('\u0312', ACCENT_TURNED_COMMA_ABOVE); + addCombining('\u0313', ACCENT_COMMA_ABOVE); + addCombining('\u0314', ACCENT_REVERSED_COMMA_ABOVE); + addCombining('\u0315', ACCENT_COMMA_ABOVE_RIGHT); + addCombining('\u031B', ACCENT_HORN); + addCombining('\u0323', ACCENT_DOT_BELOW); + // addCombining('\u0326', ACCENT_COMMA_BELOW); + addCombining('\u0327', ACCENT_CEDILLA); + addCombining('\u0328', ACCENT_OGONEK); + addCombining('\u0329', ACCENT_VERTICAL_LINE_BELOW); + addCombining('\u0331', ACCENT_MACRON_BELOW); + addCombining('\u0335', ACCENT_STROKE); + // addCombining('\u0342', ACCENT_PERISPOMENI); + // addCombining('\u0344', ACCENT_DIALYTIKA_TONOS); + // addCombining('\u0345', ACCENT_YPOGEGRAMMENI); + + // One-way mappings to equivalent preferred accents. + sCombiningToAccent.append('\u0340', ACCENT_GRAVE); + sCombiningToAccent.append('\u0341', ACCENT_ACUTE); + sCombiningToAccent.append('\u0343', ACCENT_COMMA_ABOVE); + + // One-way legacy mappings to preserve compatibility with older applications. + sAccentToCombining.append(ACCENT_GRAVE_LEGACY, '\u0300'); + sAccentToCombining.append(ACCENT_CIRCUMFLEX_LEGACY, '\u0302'); + sAccentToCombining.append(ACCENT_TILDE_LEGACY, '\u0303'); + } + + private static void addCombining(int combining, int accent) { + sCombiningToAccent.append(combining, accent); + sAccentToCombining.append(accent, combining); + } + + /** + * Maps combinations of (display-form) combining key and second character + * to combined output character. + * These mappings are derived from the Unicode NFC tables as needed. + */ + private static final SparseIntArray sDeadKeyCache = new SparseIntArray(); + private static final StringBuilder sDeadKeyBuilder = new StringBuilder(); + static { + // Non-standard decompositions. + // Stroke modifier for Finnish multilingual keyboard and others. + addDeadKey(ACCENT_STROKE, 'D', '\u0110'); + addDeadKey(ACCENT_STROKE, 'G', '\u01e4'); + addDeadKey(ACCENT_STROKE, 'H', '\u0126'); + addDeadKey(ACCENT_STROKE, 'I', '\u0197'); + addDeadKey(ACCENT_STROKE, 'L', '\u0141'); + addDeadKey(ACCENT_STROKE, 'O', '\u00d8'); + addDeadKey(ACCENT_STROKE, 'T', '\u0166'); + addDeadKey(ACCENT_STROKE, 'd', '\u0111'); + addDeadKey(ACCENT_STROKE, 'g', '\u01e5'); + addDeadKey(ACCENT_STROKE, 'h', '\u0127'); + addDeadKey(ACCENT_STROKE, 'i', '\u0268'); + addDeadKey(ACCENT_STROKE, 'l', '\u0142'); + addDeadKey(ACCENT_STROKE, 'o', '\u00f8'); + addDeadKey(ACCENT_STROKE, 't', '\u0167'); + } + + private static void addDeadKey(int accent, int c, int result) { + final int combining = sAccentToCombining.get(accent); + if (combining == 0) { + throw new IllegalStateException("Invalid dead key declaration."); + } + final int combination = (combining << 16) | c; + sDeadKeyCache.put(combination, result); + } + + private int mPtr; + + private static native void nativeDispose(int ptr); + + private static native char nativeGetCharacter(int ptr, int keyCode, int metaState); + private static native boolean nativeGetFallbackAction(int ptr, int keyCode, int metaState, + FallbackAction outFallbackAction); + private static native char nativeGetNumber(int ptr, int keyCode); + private static native char nativeGetMatch(int ptr, int keyCode, char[] chars, int metaState); + private static native char nativeGetDisplayLabel(int ptr, int keyCode); + private static native int nativeGetKeyboardType(int ptr); + private static native KeyEvent[] nativeGetEvents(int ptr, char[] chars); + + // Called from native + private KeyCharacterMap(int ptr) { + mPtr = ptr; + } + + /** + * Loads the key character maps for the keyboard with the specified device id. + * + * @param deviceId The device id of the keyboard. + * @return The associated key character map. + * @throws {@link UnavailableException} if the key character map + * could not be loaded because it was malformed or the default key character map + * is missing from the system. + */ + public static KeyCharacterMap load(int deviceId) { +/* final InputManager im = InputManager.getInstance(); + InputDevice inputDevice = im.getInputDevice(deviceId); + if (inputDevice == null) { + inputDevice = im.getInputDevice(VIRTUAL_KEYBOARD); + if (inputDevice == null) { + throw new UnavailableException( + "Could not load key character map for device " + deviceId); + } + } + return inputDevice.getKeyCharacterMap();*/ + return null; + } + + /** + * Gets the Unicode character generated by the specified key and meta + * key state combination. + *

+ * Returns the Unicode character that the specified key would produce + * when the specified meta bits (see {@link MetaKeyKeyListener}) + * were active. + *

+ * Returns 0 if the key is not one that is used to type Unicode + * characters. + *

+ * If the return value has bit {@link #COMBINING_ACCENT} set, the + * key is a "dead key" that should be combined with another to + * actually produce a character -- see {@link #getDeadChar} -- + * after masking with {@link #COMBINING_ACCENT_MASK}. + *

+ * + * @param keyCode The key code. + * @param metaState The meta key modifier state. + * @return The associated character or combining accent, or 0 if none. + */ + public int get(int keyCode, int metaState) { + metaState = KeyEvent.normalizeMetaState(metaState); + char ch = nativeGetCharacter(mPtr, keyCode, metaState); + + int map = sCombiningToAccent.get(ch); + if (map != 0) { + return map | COMBINING_ACCENT; + } else { + return ch; + } + } + + /** + * Gets the fallback action to perform if the application does not + * handle the specified key. + *

+ * When an application does not handle a particular key, the system may + * translate the key to an alternate fallback key (specified in the + * fallback action) and dispatch it to the application. + * The event containing the fallback key is flagged + * with {@link KeyEvent#FLAG_FALLBACK}. + *

+ * + * @param keyCode The key code. + * @param metaState The meta key modifier state. + * @return The fallback action, or null if none. Remember to recycle the fallback action. + * + * @hide + */ + public FallbackAction getFallbackAction(int keyCode, int metaState) { + FallbackAction action = FallbackAction.obtain(); + metaState = KeyEvent.normalizeMetaState(metaState); + if (nativeGetFallbackAction(mPtr, keyCode, metaState, action)) { + action.metaState = KeyEvent.normalizeMetaState(action.metaState); + return action; + } + action.recycle(); + return null; + } + + /** + * Gets the number or symbol associated with the key. + *

+ * The character value is returned, not the numeric value. + * If the key is not a number, but is a symbol, the symbol is retuned. + *

+ * This method is intended to to support dial pads and other numeric or + * symbolic entry on keyboards where certain keys serve dual function + * as alphabetic and symbolic keys. This method returns the number + * or symbol associated with the key independent of whether the user + * has pressed the required modifier. + *

+ * For example, on one particular keyboard the keys on the top QWERTY row generate + * numbers when ALT is pressed such that ALT-Q maps to '1'. So for that keyboard + * when {@link #getNumber} is called with {@link KeyEvent#KEYCODE_Q} it returns '1' + * so that the user can type numbers without pressing ALT when it makes sense. + *

+ * + * @param keyCode The key code. + * @return The associated numeric or symbolic character, or 0 if none. + */ + public char getNumber(int keyCode) { + return nativeGetNumber(mPtr, keyCode); + } + + /** + * Gets the first character in the character array that can be generated + * by the specified key code. + *

+ * This is a convenience function that returns the same value as + * {@link #getMatch(int,char[],int) getMatch(keyCode, chars, 0)}. + *

+ * + * @param keyCode The keycode. + * @param chars The array of matching characters to consider. + * @return The matching associated character, or 0 if none. + */ + public char getMatch(int keyCode, char[] chars) { + return getMatch(keyCode, chars, 0); + } + + /** + * Gets the first character in the character array that can be generated + * by the specified key code. If there are multiple choices, prefers + * the one that would be generated with the specified meta key modifier state. + * + * @param keyCode The key code. + * @param chars The array of matching characters to consider. + * @param metaState The preferred meta key modifier state. + * @return The matching associated character, or 0 if none. + */ + public char getMatch(int keyCode, char[] chars, int metaState) { + if (chars == null) { + throw new IllegalArgumentException("chars must not be null."); + } + + metaState = KeyEvent.normalizeMetaState(metaState); + return nativeGetMatch(mPtr, keyCode, chars, metaState); + } + + /** + * Gets the primary character for this key. + * In other words, the label that is physically printed on it. + * + * @param keyCode The key code. + * @return The display label character, or 0 if none (eg. for non-printing keys). + */ + public char getDisplayLabel(int keyCode) { + return nativeGetDisplayLabel(mPtr, keyCode); + } + + /** + * Get the character that is produced by combining the dead key producing accent + * with the key producing character c. + * For example, getDeadChar('`', 'e') returns è. + * getDeadChar('^', ' ') returns '^' and getDeadChar('^', '^') returns '^'. + * + * @param accent The accent character. eg. '`' + * @param c The basic character. + * @return The combined character, or 0 if the characters cannot be combined. + */ + public static int getDeadChar(int accent, int c) { + if (c == accent || CHAR_SPACE == c) { + // The same dead character typed twice or a dead character followed by a + // space should both produce the non-combining version of the combining char. + // In this case we don't even need to compute the combining character. + return accent; + } + + int combining = sAccentToCombining.get(accent); + if (combining == 0) { + return 0; + } + + final int combination = (combining << 16) | c; + int combined; + synchronized (sDeadKeyCache) { + combined = sDeadKeyCache.get(combination, -1); + if (combined == -1) { + sDeadKeyBuilder.setLength(0); + sDeadKeyBuilder.append((char)c); + sDeadKeyBuilder.append((char)combining); + String result = Normalizer.normalize(sDeadKeyBuilder, Normalizer.Form.NFC); + combined = result.codePointCount(0, result.length()) == 1 + ? result.codePointAt(0) + : 0; + sDeadKeyCache.put(combination, combined); + } + } + return combined; + } + + /** + * Describes the character mappings associated with a key. + * + * @deprecated instead use {@link KeyCharacterMap#getDisplayLabel(int)}, + * {@link KeyCharacterMap#getNumber(int)} and {@link KeyCharacterMap#get(int, int)}. + */ + @Deprecated + public static class KeyData { + public static final int META_LENGTH = 4; + + /** + * The display label (see {@link #getDisplayLabel}). + */ + public char displayLabel; + /** + * The "number" value (see {@link #getNumber}). + */ + public char number; + /** + * The character that will be generated in various meta states + * (the same ones used for {@link #get} and defined as + * {@link KeyEvent#META_SHIFT_ON} and {@link KeyEvent#META_ALT_ON}). + * + * + * + * + * + * + *
IndexValue
0no modifiers
1caps
2alt
3caps + alt
+ */ + public char[] meta = new char[META_LENGTH]; + } + + /** + * Get the character conversion data for a given key code. + * + * @param keyCode The keyCode to query. + * @param results A {@link KeyData} instance that will be filled with the results. + * @return True if the key was mapped. If the key was not mapped, results is not modified. + * + * @deprecated instead use {@link KeyCharacterMap#getDisplayLabel(int)}, + * {@link KeyCharacterMap#getNumber(int)} or {@link KeyCharacterMap#get(int, int)}. + */ + @Deprecated + public boolean getKeyData(int keyCode, KeyData results) { + if (results.meta.length < KeyData.META_LENGTH) { + throw new IndexOutOfBoundsException( + "results.meta.length must be >= " + KeyData.META_LENGTH); + } + + char displayLabel = nativeGetDisplayLabel(mPtr, keyCode); + if (displayLabel == 0) { + return false; + } + + results.displayLabel = displayLabel; + results.number = nativeGetNumber(mPtr, keyCode); + results.meta[0] = nativeGetCharacter(mPtr, keyCode, 0); + results.meta[1] = nativeGetCharacter(mPtr, keyCode, KeyEvent.META_SHIFT_ON); + results.meta[2] = nativeGetCharacter(mPtr, keyCode, KeyEvent.META_ALT_ON); + results.meta[3] = nativeGetCharacter(mPtr, keyCode, + KeyEvent.META_ALT_ON | KeyEvent.META_SHIFT_ON); + return true; + } + + /** + * Get an array of KeyEvent objects that if put into the input stream + * could plausibly generate the provided sequence of characters. It is + * not guaranteed that the sequence is the only way to generate these + * events or that it is optimal. + *

+ * This function is primarily offered for instrumentation and testing purposes. + * It may fail to map characters to key codes. In particular, the key character + * map for the {@link #BUILT_IN_KEYBOARD built-in keyboard} device id may be empty. + * Consider using the key character map associated with the + * {@link #VIRTUAL_KEYBOARD virtual keyboard} device id instead. + *

+ * For robust text entry, do not use this function. Instead construct a + * {@link KeyEvent} with action code {@link KeyEvent#ACTION_MULTIPLE} that contains + * the desired string using {@link KeyEvent#KeyEvent(long, String, int, int)}. + *

+ * + * @param chars The sequence of characters to generate. + * @return An array of {@link KeyEvent} objects, or null if the given char array + * can not be generated using the current key character map. + */ + public KeyEvent[] getEvents(char[] chars) { + if (chars == null) { + throw new IllegalArgumentException("chars must not be null."); + } + return nativeGetEvents(mPtr, chars); + } + + /** + * Returns true if the specified key produces a glyph. + * + * @param keyCode The key code. + * @return True if the key is a printing key. + */ + public boolean isPrintingKey(int keyCode) { + int type = Character.getType(nativeGetDisplayLabel(mPtr, keyCode)); + + switch (type) { + case Character.SPACE_SEPARATOR: + case Character.LINE_SEPARATOR: + case Character.PARAGRAPH_SEPARATOR: + case Character.CONTROL: + case Character.FORMAT: + return false; + default: + return true; + } + } + + /** + * Gets the keyboard type. + * Returns {@link #NUMERIC}, {@link #PREDICTIVE}, {@link #ALPHA}, {@link #FULL} + * or {@link #SPECIAL_FUNCTION}. + *

+ * Different keyboard types have different semantics. Refer to the documentation + * associated with the keyboard type constants for details. + *

+ * + * @return The keyboard type. + */ + public int getKeyboardType() { + return nativeGetKeyboardType(mPtr); + } + + /** + * Gets a constant that describes the behavior of this keyboard's modifier keys + * such as {@link KeyEvent#KEYCODE_SHIFT_LEFT}. + *

+ * Currently there are two behaviors that may be combined: + *

+ * + *

+ * This function currently returns {@link #MODIFIER_BEHAVIOR_CHORDED} when the + * {@link #getKeyboardType() keyboard type} is {@link #FULL} or {@link #SPECIAL_FUNCTION} and + * {@link #MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED} otherwise. + * In the future, the function may also take into account global keyboard + * accessibility settings, other user preferences, or new device capabilities. + *

+ * + * @return The modifier behavior for this keyboard. + * + * @see {@link #MODIFIER_BEHAVIOR_CHORDED} + * @see {@link #MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED} + */ + public int getModifierBehavior() { + switch (getKeyboardType()) { + case FULL: + case SPECIAL_FUNCTION: + return MODIFIER_BEHAVIOR_CHORDED; + default: + return MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED; + } + } + + /** + * Queries the framework about whether any physical keys exist on the + * any keyboard attached to the device that are capable of producing the given key code. + * + * @param keyCode The key code to query. + * @return True if at least one attached keyboard supports the specified key code. + */ + public static boolean deviceHasKey(int keyCode) { +// return InputManager.getInstance().deviceHasKeys(new int[] {keyCode})[0]; + return false; + } + + /** + * Queries the framework about whether any physical keys exist on the + * any keyboard attached to the device that are capable of producing the given + * array of key codes. + * + * @param keyCodes The array of key codes to query. + * @return A new array of the same size as the key codes array whose elements + * are set to true if at least one attached keyboard supports the corresponding key code + * at the same index in the key codes array. + */ + public static boolean[] deviceHasKeys(int[] keyCodes) { +// return InputManager.getInstance().deviceHasKeys(keyCodes); + System.out.println("deviceHasKeys: FIXME"); + return null; + } + + /** + * Thrown by {@link KeyCharacterMap#load} when a key character map could not be loaded. + */ + public static class UnavailableException extends AndroidRuntimeException { + public UnavailableException(String msg) { + super(msg); + } + } + + /** + * Specifies a substitute key code and meta state as a fallback action + * for an unhandled key. + * @hide + */ + public static final class FallbackAction { + private static final int MAX_RECYCLED = 10; + private static final Object sRecycleLock = new Object(); + private static FallbackAction sRecycleBin; + private static int sRecycledCount; + + private FallbackAction next; + + public int keyCode; + public int metaState; + + private FallbackAction() { + } + + public static FallbackAction obtain() { + final FallbackAction target; + synchronized (sRecycleLock) { + if (sRecycleBin == null) { + target = new FallbackAction(); + } else { + target = sRecycleBin; + sRecycleBin = target.next; + sRecycledCount--; + target.next = null; + } + } + return target; + } + + public void recycle() { + synchronized (sRecycleLock) { + if (sRecycledCount < MAX_RECYCLED) { + next = sRecycleBin; + sRecycleBin = this; + sRecycledCount += 1; + } else { + next = null; + } + } + } + } +} diff --git a/src/api-impl/android/view/KeyEvent.java b/src/api-impl/android/view/KeyEvent.java new file mode 100644 index 00000000..5704214b --- /dev/null +++ b/src/api-impl/android/view/KeyEvent.java @@ -0,0 +1,3361 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view; + +//import android.text.method.MetaKeyKeyListener; +import android.util.Log; +import android.util.Slog; +import android.util.SparseArray; +import android.util.SparseIntArray; +import android.view.KeyCharacterMap; +import android.view.KeyCharacterMap.KeyData; + +/** + * Object used to report key and button events. + *

+ * Each key press is described by a sequence of key events. A key press + * starts with a key event with {@link #ACTION_DOWN}. If the key is held + * sufficiently long that it repeats, then the initial down is followed + * additional key events with {@link #ACTION_DOWN} and a non-zero value for + * {@link #getRepeatCount()}. The last key event is a {@link #ACTION_UP} + * for the key up. If the key press is canceled, the key up event will have the + * {@link #FLAG_CANCELED} flag set. + *

+ * Key events are generally accompanied by a key code ({@link #getKeyCode()}), + * scan code ({@link #getScanCode()}) and meta state ({@link #getMetaState()}). + * Key code constants are defined in this class. Scan code constants are raw + * device-specific codes obtained from the OS and so are not generally meaningful + * to applications unless interpreted using the {@link KeyCharacterMap}. + * Meta states describe the pressed state of key modifiers + * such as {@link #META_SHIFT_ON} or {@link #META_ALT_ON}. + *

+ * Key codes typically correspond one-to-one with individual keys on an input device. + * Many keys and key combinations serve quite different functions on different + * input devices so care must be taken when interpreting them. Always use the + * {@link KeyCharacterMap} associated with the input device when mapping keys + * to characters. Be aware that there may be multiple key input devices active + * at the same time and each will have its own key character map. + *

+ * As soft input methods can use multiple and inventive ways of inputting text, + * there is no guarantee that any key press on a soft keyboard will generate a key + * event: this is left to the IME's discretion, and in fact sending such events is + * discouraged. You should never rely on receiving KeyEvents for any key on a soft + * input method. In particular, the default software keyboard will never send any + * key event to any application targetting Jelly Bean or later, and will only send + * events for some presses of the delete and return keys to applications targetting + * Ice Cream Sandwich or earlier. Be aware that other software input methods may + * never send key events regardless of the version. Consider using editor actions + * like {@link android.view.inputmethod.EditorInfo#IME_ACTION_DONE} if you need + * specific interaction with the software keyboard, as it gives more visibility to + * the user as to how your application will react to key presses. + *

+ * When interacting with an IME, the framework may deliver key events + * with the special action {@link #ACTION_MULTIPLE} that either specifies + * that single repeated key code or a sequence of characters to insert. + *

+ * In general, the framework cannot guarantee that the key events it delivers + * to a view always constitute complete key sequences since some events may be dropped + * or modified by containing views before they are delivered. The view implementation + * should be prepared to handle {@link #FLAG_CANCELED} and should tolerate anomalous + * situations such as receiving a new {@link #ACTION_DOWN} without first having + * received an {@link #ACTION_UP} for the prior key press. + *

+ * Refer to {@link InputDevice} for more information about how different kinds of + * input devices and sources represent keys and buttons. + *

+ */ +public class KeyEvent extends InputEvent { + /** + * Key code constant: Unknown key code. + */ + public static final int KEYCODE_UNKNOWN = 0; + /** + * Key code constant: Soft Left key. + * Usually situated below the display on phones and used as a multi-function + * feature key for selecting a software defined function shown on the bottom left + * of the display. + */ + public static final int KEYCODE_SOFT_LEFT = 1; + /** + * Key code constant: Soft Right key. + * Usually situated below the display on phones and used as a multi-function + * feature key for selecting a software defined function shown on the bottom right + * of the display. + */ + public static final int KEYCODE_SOFT_RIGHT = 2; + /** + * Key code constant: Home key. + * This key is handled by the framework and is never delivered to applications. + */ + public static final int KEYCODE_HOME = 3; + /** + * Key code constant: Back key. + */ + public static final int KEYCODE_BACK = 4; + /** + * Key code constant: Call key. + */ + public static final int KEYCODE_CALL = 5; + /** + * Key code constant: End Call key. + */ + public static final int KEYCODE_ENDCALL = 6; + /** + * Key code constant: '0' key. + */ + public static final int KEYCODE_0 = 7; + /** + * Key code constant: '1' key. + */ + public static final int KEYCODE_1 = 8; + /** + * Key code constant: '2' key. + */ + public static final int KEYCODE_2 = 9; + /** + * Key code constant: '3' key. + */ + public static final int KEYCODE_3 = 10; + /** + * Key code constant: '4' key. + */ + public static final int KEYCODE_4 = 11; + /** + * Key code constant: '5' key. + */ + public static final int KEYCODE_5 = 12; + /** + * Key code constant: '6' key. + */ + public static final int KEYCODE_6 = 13; + /** + * Key code constant: '7' key. + */ + public static final int KEYCODE_7 = 14; + /** + * Key code constant: '8' key. + */ + public static final int KEYCODE_8 = 15; + /** + * Key code constant: '9' key. + */ + public static final int KEYCODE_9 = 16; + /** + * Key code constant: '*' key. + */ + public static final int KEYCODE_STAR = 17; + /** + * Key code constant: '#' key. + */ + public static final int KEYCODE_POUND = 18; + /** + * Key code constant: Directional Pad Up key. + * May also be synthesized from trackball motions. + */ + public static final int KEYCODE_DPAD_UP = 19; + /** + * Key code constant: Directional Pad Down key. + * May also be synthesized from trackball motions. + */ + public static final int KEYCODE_DPAD_DOWN = 20; + /** + * Key code constant: Directional Pad Left key. + * May also be synthesized from trackball motions. + */ + public static final int KEYCODE_DPAD_LEFT = 21; + /** + * Key code constant: Directional Pad Right key. + * May also be synthesized from trackball motions. + */ + public static final int KEYCODE_DPAD_RIGHT = 22; + /** + * Key code constant: Directional Pad Center key. + * May also be synthesized from trackball motions. + */ + public static final int KEYCODE_DPAD_CENTER = 23; + /** + * Key code constant: Volume Up key. + * Adjusts the speaker volume up. + */ + public static final int KEYCODE_VOLUME_UP = 24; + /** + * Key code constant: Volume Down key. + * Adjusts the speaker volume down. + */ + public static final int KEYCODE_VOLUME_DOWN = 25; + /** + * Key code constant: Power key. + */ + public static final int KEYCODE_POWER = 26; + /** + * Key code constant: Camera key. + * Used to launch a camera application or take pictures. + */ + public static final int KEYCODE_CAMERA = 27; + /** + * Key code constant: Clear key. + */ + public static final int KEYCODE_CLEAR = 28; + /** + * Key code constant: 'A' key. + */ + public static final int KEYCODE_A = 29; + /** + * Key code constant: 'B' key. + */ + public static final int KEYCODE_B = 30; + /** + * Key code constant: 'C' key. + */ + public static final int KEYCODE_C = 31; + /** + * Key code constant: 'D' key. + */ + public static final int KEYCODE_D = 32; + /** + * Key code constant: 'E' key. + */ + public static final int KEYCODE_E = 33; + /** + * Key code constant: 'F' key. + */ + public static final int KEYCODE_F = 34; + /** + * Key code constant: 'G' key. + */ + public static final int KEYCODE_G = 35; + /** + * Key code constant: 'H' key. + */ + public static final int KEYCODE_H = 36; + /** + * Key code constant: 'I' key. + */ + public static final int KEYCODE_I = 37; + /** + * Key code constant: 'J' key. + */ + public static final int KEYCODE_J = 38; + /** + * Key code constant: 'K' key. + */ + public static final int KEYCODE_K = 39; + /** + * Key code constant: 'L' key. + */ + public static final int KEYCODE_L = 40; + /** + * Key code constant: 'M' key. + */ + public static final int KEYCODE_M = 41; + /** + * Key code constant: 'N' key. + */ + public static final int KEYCODE_N = 42; + /** + * Key code constant: 'O' key. + */ + public static final int KEYCODE_O = 43; + /** + * Key code constant: 'P' key. + */ + public static final int KEYCODE_P = 44; + /** + * Key code constant: 'Q' key. + */ + public static final int KEYCODE_Q = 45; + /** + * Key code constant: 'R' key. + */ + public static final int KEYCODE_R = 46; + /** + * Key code constant: 'S' key. + */ + public static final int KEYCODE_S = 47; + /** + * Key code constant: 'T' key. + */ + public static final int KEYCODE_T = 48; + /** + * Key code constant: 'U' key. + */ + public static final int KEYCODE_U = 49; + /** + * Key code constant: 'V' key. + */ + public static final int KEYCODE_V = 50; + /** + * Key code constant: 'W' key. + */ + public static final int KEYCODE_W = 51; + /** + * Key code constant: 'X' key. + */ + public static final int KEYCODE_X = 52; + /** + * Key code constant: 'Y' key. + */ + public static final int KEYCODE_Y = 53; + /** + * Key code constant: 'Z' key. + */ + public static final int KEYCODE_Z = 54; + /** + * Key code constant: ',' key. + */ + public static final int KEYCODE_COMMA = 55; + /** + * Key code constant: '.' key. + */ + public static final int KEYCODE_PERIOD = 56; + /** + * Key code constant: Left Alt modifier key. + */ + public static final int KEYCODE_ALT_LEFT = 57; + /** + * Key code constant: Right Alt modifier key. + */ + public static final int KEYCODE_ALT_RIGHT = 58; + /** + * Key code constant: Left Shift modifier key. + */ + public static final int KEYCODE_SHIFT_LEFT = 59; + /** + * Key code constant: Right Shift modifier key. + */ + public static final int KEYCODE_SHIFT_RIGHT = 60; + /** + * Key code constant: Tab key. + */ + public static final int KEYCODE_TAB = 61; + /** + * Key code constant: Space key. + */ + public static final int KEYCODE_SPACE = 62; + /** + * Key code constant: Symbol modifier key. + * Used to enter alternate symbols. + */ + public static final int KEYCODE_SYM = 63; + /** + * Key code constant: Explorer special function key. + * Used to launch a browser application. + */ + public static final int KEYCODE_EXPLORER = 64; + /** + * Key code constant: Envelope special function key. + * Used to launch a mail application. + */ + public static final int KEYCODE_ENVELOPE = 65; + /** + * Key code constant: Enter key. + */ + public static final int KEYCODE_ENTER = 66; + /** + * Key code constant: Backspace key. + * Deletes characters before the insertion point, unlike {@link #KEYCODE_FORWARD_DEL}. + */ + public static final int KEYCODE_DEL = 67; + /** + * Key code constant: '`' (backtick) key. + */ + public static final int KEYCODE_GRAVE = 68; + /** + * Key code constant: '-'. + */ + public static final int KEYCODE_MINUS = 69; + /** + * Key code constant: '=' key. + */ + public static final int KEYCODE_EQUALS = 70; + /** + * Key code constant: '[' key. + */ + public static final int KEYCODE_LEFT_BRACKET = 71; + /** + * Key code constant: ']' key. + */ + public static final int KEYCODE_RIGHT_BRACKET = 72; + /** + * Key code constant: '\' key. + */ + public static final int KEYCODE_BACKSLASH = 73; + /** + * Key code constant: ';' key. + */ + public static final int KEYCODE_SEMICOLON = 74; + /** + * Key code constant: ''' (apostrophe) key. + */ + public static final int KEYCODE_APOSTROPHE = 75; + /** + * Key code constant: '/' key. + */ + public static final int KEYCODE_SLASH = 76; + /** + * Key code constant: '@' key. + */ + public static final int KEYCODE_AT = 77; + /** + * Key code constant: Number modifier key. + * Used to enter numeric symbols. + * This key is not Num Lock; it is more like {@link #KEYCODE_ALT_LEFT} and is + * interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}. + */ + public static final int KEYCODE_NUM = 78; + /** + * Key code constant: Headset Hook key. + * Used to hang up calls and stop media. + */ + public static final int KEYCODE_HEADSETHOOK = 79; + /** + * Key code constant: Camera Focus key. + * Used to focus the camera. + */ + public static final int KEYCODE_FOCUS = 80; // *Camera* focus + /** + * Key code constant: '+' key. + */ + public static final int KEYCODE_PLUS = 81; + /** + * Key code constant: Menu key. + */ + public static final int KEYCODE_MENU = 82; + /** + * Key code constant: Notification key. + */ + public static final int KEYCODE_NOTIFICATION = 83; + /** + * Key code constant: Search key. + */ + public static final int KEYCODE_SEARCH = 84; + /** + * Key code constant: Play/Pause media key. + */ + public static final int KEYCODE_MEDIA_PLAY_PAUSE = 85; + /** + * Key code constant: Stop media key. + */ + public static final int KEYCODE_MEDIA_STOP = 86; + /** + * Key code constant: Play Next media key. + */ + public static final int KEYCODE_MEDIA_NEXT = 87; + /** + * Key code constant: Play Previous media key. + */ + public static final int KEYCODE_MEDIA_PREVIOUS = 88; + /** + * Key code constant: Rewind media key. + */ + public static final int KEYCODE_MEDIA_REWIND = 89; + /** + * Key code constant: Fast Forward media key. + */ + public static final int KEYCODE_MEDIA_FAST_FORWARD = 90; + /** + * Key code constant: Mute key. + * Mutes the microphone, unlike {@link #KEYCODE_VOLUME_MUTE}. + */ + public static final int KEYCODE_MUTE = 91; + /** + * Key code constant: Page Up key. + */ + public static final int KEYCODE_PAGE_UP = 92; + /** + * Key code constant: Page Down key. + */ + public static final int KEYCODE_PAGE_DOWN = 93; + /** + * Key code constant: Picture Symbols modifier key. + * Used to switch symbol sets (Emoji, Kao-moji). + */ + public static final int KEYCODE_PICTSYMBOLS = 94; // switch symbol-sets (Emoji,Kao-moji) + /** + * Key code constant: Switch Charset modifier key. + * Used to switch character sets (Kanji, Katakana). + */ + public static final int KEYCODE_SWITCH_CHARSET = 95; // switch char-sets (Kanji,Katakana) + /** + * Key code constant: A Button key. + * On a game controller, the A button should be either the button labeled A + * or the first button on the bottom row of controller buttons. + */ + public static final int KEYCODE_BUTTON_A = 96; + /** + * Key code constant: B Button key. + * On a game controller, the B button should be either the button labeled B + * or the second button on the bottom row of controller buttons. + */ + public static final int KEYCODE_BUTTON_B = 97; + /** + * Key code constant: C Button key. + * On a game controller, the C button should be either the button labeled C + * or the third button on the bottom row of controller buttons. + */ + public static final int KEYCODE_BUTTON_C = 98; + /** + * Key code constant: X Button key. + * On a game controller, the X button should be either the button labeled X + * or the first button on the upper row of controller buttons. + */ + public static final int KEYCODE_BUTTON_X = 99; + /** + * Key code constant: Y Button key. + * On a game controller, the Y button should be either the button labeled Y + * or the second button on the upper row of controller buttons. + */ + public static final int KEYCODE_BUTTON_Y = 100; + /** + * Key code constant: Z Button key. + * On a game controller, the Z button should be either the button labeled Z + * or the third button on the upper row of controller buttons. + */ + public static final int KEYCODE_BUTTON_Z = 101; + /** + * Key code constant: L1 Button key. + * On a game controller, the L1 button should be either the button labeled L1 (or L) + * or the top left trigger button. + */ + public static final int KEYCODE_BUTTON_L1 = 102; + /** + * Key code constant: R1 Button key. + * On a game controller, the R1 button should be either the button labeled R1 (or R) + * or the top right trigger button. + */ + public static final int KEYCODE_BUTTON_R1 = 103; + /** + * Key code constant: L2 Button key. + * On a game controller, the L2 button should be either the button labeled L2 + * or the bottom left trigger button. + */ + public static final int KEYCODE_BUTTON_L2 = 104; + /** + * Key code constant: R2 Button key. + * On a game controller, the R2 button should be either the button labeled R2 + * or the bottom right trigger button. + */ + public static final int KEYCODE_BUTTON_R2 = 105; + /** + * Key code constant: Left Thumb Button key. + * On a game controller, the left thumb button indicates that the left (or only) + * joystick is pressed. + */ + public static final int KEYCODE_BUTTON_THUMBL = 106; + /** + * Key code constant: Right Thumb Button key. + * On a game controller, the right thumb button indicates that the right + * joystick is pressed. + */ + public static final int KEYCODE_BUTTON_THUMBR = 107; + /** + * Key code constant: Start Button key. + * On a game controller, the button labeled Start. + */ + public static final int KEYCODE_BUTTON_START = 108; + /** + * Key code constant: Select Button key. + * On a game controller, the button labeled Select. + */ + public static final int KEYCODE_BUTTON_SELECT = 109; + /** + * Key code constant: Mode Button key. + * On a game controller, the button labeled Mode. + */ + public static final int KEYCODE_BUTTON_MODE = 110; + /** + * Key code constant: Escape key. + */ + public static final int KEYCODE_ESCAPE = 111; + /** + * Key code constant: Forward Delete key. + * Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}. + */ + public static final int KEYCODE_FORWARD_DEL = 112; + /** + * Key code constant: Left Control modifier key. + */ + public static final int KEYCODE_CTRL_LEFT = 113; + /** + * Key code constant: Right Control modifier key. + */ + public static final int KEYCODE_CTRL_RIGHT = 114; + /** + * Key code constant: Caps Lock key. + */ + public static final int KEYCODE_CAPS_LOCK = 115; + /** + * Key code constant: Scroll Lock key. + */ + public static final int KEYCODE_SCROLL_LOCK = 116; + /** + * Key code constant: Left Meta modifier key. + */ + public static final int KEYCODE_META_LEFT = 117; + /** + * Key code constant: Right Meta modifier key. + */ + public static final int KEYCODE_META_RIGHT = 118; + /** + * Key code constant: Function modifier key. + */ + public static final int KEYCODE_FUNCTION = 119; + /** + * Key code constant: System Request / Print Screen key. + */ + public static final int KEYCODE_SYSRQ = 120; + /** + * Key code constant: Break / Pause key. + */ + public static final int KEYCODE_BREAK = 121; + /** + * Key code constant: Home Movement key. + * Used for scrolling or moving the cursor around to the start of a line + * or to the top of a list. + */ + public static final int KEYCODE_MOVE_HOME = 122; + /** + * Key code constant: End Movement key. + * Used for scrolling or moving the cursor around to the end of a line + * or to the bottom of a list. + */ + public static final int KEYCODE_MOVE_END = 123; + /** + * Key code constant: Insert key. + * Toggles insert / overwrite edit mode. + */ + public static final int KEYCODE_INSERT = 124; + /** + * Key code constant: Forward key. + * Navigates forward in the history stack. Complement of {@link #KEYCODE_BACK}. + */ + public static final int KEYCODE_FORWARD = 125; + /** + * Key code constant: Play media key. + */ + public static final int KEYCODE_MEDIA_PLAY = 126; + /** + * Key code constant: Pause media key. + */ + public static final int KEYCODE_MEDIA_PAUSE = 127; + /** + * Key code constant: Close media key. + * May be used to close a CD tray, for example. + */ + public static final int KEYCODE_MEDIA_CLOSE = 128; + /** + * Key code constant: Eject media key. + * May be used to eject a CD tray, for example. + */ + public static final int KEYCODE_MEDIA_EJECT = 129; + /** + * Key code constant: Record media key. + */ + public static final int KEYCODE_MEDIA_RECORD = 130; + /** + * Key code constant: F1 key. + */ + public static final int KEYCODE_F1 = 131; + /** + * Key code constant: F2 key. + */ + public static final int KEYCODE_F2 = 132; + /** + * Key code constant: F3 key. + */ + public static final int KEYCODE_F3 = 133; + /** + * Key code constant: F4 key. + */ + public static final int KEYCODE_F4 = 134; + /** + * Key code constant: F5 key. + */ + public static final int KEYCODE_F5 = 135; + /** + * Key code constant: F6 key. + */ + public static final int KEYCODE_F6 = 136; + /** + * Key code constant: F7 key. + */ + public static final int KEYCODE_F7 = 137; + /** + * Key code constant: F8 key. + */ + public static final int KEYCODE_F8 = 138; + /** + * Key code constant: F9 key. + */ + public static final int KEYCODE_F9 = 139; + /** + * Key code constant: F10 key. + */ + public static final int KEYCODE_F10 = 140; + /** + * Key code constant: F11 key. + */ + public static final int KEYCODE_F11 = 141; + /** + * Key code constant: F12 key. + */ + public static final int KEYCODE_F12 = 142; + /** + * Key code constant: Num Lock key. + * This is the Num Lock key; it is different from {@link #KEYCODE_NUM}. + * This key alters the behavior of other keys on the numeric keypad. + */ + public static final int KEYCODE_NUM_LOCK = 143; + /** + * Key code constant: Numeric keypad '0' key. + */ + public static final int KEYCODE_NUMPAD_0 = 144; + /** + * Key code constant: Numeric keypad '1' key. + */ + public static final int KEYCODE_NUMPAD_1 = 145; + /** + * Key code constant: Numeric keypad '2' key. + */ + public static final int KEYCODE_NUMPAD_2 = 146; + /** + * Key code constant: Numeric keypad '3' key. + */ + public static final int KEYCODE_NUMPAD_3 = 147; + /** + * Key code constant: Numeric keypad '4' key. + */ + public static final int KEYCODE_NUMPAD_4 = 148; + /** + * Key code constant: Numeric keypad '5' key. + */ + public static final int KEYCODE_NUMPAD_5 = 149; + /** + * Key code constant: Numeric keypad '6' key. + */ + public static final int KEYCODE_NUMPAD_6 = 150; + /** + * Key code constant: Numeric keypad '7' key. + */ + public static final int KEYCODE_NUMPAD_7 = 151; + /** + * Key code constant: Numeric keypad '8' key. + */ + public static final int KEYCODE_NUMPAD_8 = 152; + /** + * Key code constant: Numeric keypad '9' key. + */ + public static final int KEYCODE_NUMPAD_9 = 153; + /** + * Key code constant: Numeric keypad '/' key (for division). + */ + public static final int KEYCODE_NUMPAD_DIVIDE = 154; + /** + * Key code constant: Numeric keypad '*' key (for multiplication). + */ + public static final int KEYCODE_NUMPAD_MULTIPLY = 155; + /** + * Key code constant: Numeric keypad '-' key (for subtraction). + */ + public static final int KEYCODE_NUMPAD_SUBTRACT = 156; + /** + * Key code constant: Numeric keypad '+' key (for addition). + */ + public static final int KEYCODE_NUMPAD_ADD = 157; + /** + * Key code constant: Numeric keypad '.' key (for decimals or digit grouping). + */ + public static final int KEYCODE_NUMPAD_DOT = 158; + /** + * Key code constant: Numeric keypad ',' key (for decimals or digit grouping). + */ + public static final int KEYCODE_NUMPAD_COMMA = 159; + /** + * Key code constant: Numeric keypad Enter key. + */ + public static final int KEYCODE_NUMPAD_ENTER = 160; + /** + * Key code constant: Numeric keypad '=' key. + */ + public static final int KEYCODE_NUMPAD_EQUALS = 161; + /** + * Key code constant: Numeric keypad '(' key. + */ + public static final int KEYCODE_NUMPAD_LEFT_PAREN = 162; + /** + * Key code constant: Numeric keypad ')' key. + */ + public static final int KEYCODE_NUMPAD_RIGHT_PAREN = 163; + /** + * Key code constant: Volume Mute key. + * Mutes the speaker, unlike {@link #KEYCODE_MUTE}. + * This key should normally be implemented as a toggle such that the first press + * mutes the speaker and the second press restores the original volume. + */ + public static final int KEYCODE_VOLUME_MUTE = 164; + /** + * Key code constant: Info key. + * Common on TV remotes to show additional information related to what is + * currently being viewed. + */ + public static final int KEYCODE_INFO = 165; + /** + * Key code constant: Channel up key. + * On TV remotes, increments the television channel. + */ + public static final int KEYCODE_CHANNEL_UP = 166; + /** + * Key code constant: Channel down key. + * On TV remotes, decrements the television channel. + */ + public static final int KEYCODE_CHANNEL_DOWN = 167; + /** + * Key code constant: Zoom in key. + */ + public static final int KEYCODE_ZOOM_IN = 168; + /** + * Key code constant: Zoom out key. + */ + public static final int KEYCODE_ZOOM_OUT = 169; + /** + * Key code constant: TV key. + * On TV remotes, switches to viewing live TV. + */ + public static final int KEYCODE_TV = 170; + /** + * Key code constant: Window key. + * On TV remotes, toggles picture-in-picture mode or other windowing functions. + */ + public static final int KEYCODE_WINDOW = 171; + /** + * Key code constant: Guide key. + * On TV remotes, shows a programming guide. + */ + public static final int KEYCODE_GUIDE = 172; + /** + * Key code constant: DVR key. + * On some TV remotes, switches to a DVR mode for recorded shows. + */ + public static final int KEYCODE_DVR = 173; + /** + * Key code constant: Bookmark key. + * On some TV remotes, bookmarks content or web pages. + */ + public static final int KEYCODE_BOOKMARK = 174; + /** + * Key code constant: Toggle captions key. + * Switches the mode for closed-captioning text, for example during television shows. + */ + public static final int KEYCODE_CAPTIONS = 175; + /** + * Key code constant: Settings key. + * Starts the system settings activity. + */ + public static final int KEYCODE_SETTINGS = 176; + /** + * Key code constant: TV power key. + * On TV remotes, toggles the power on a television screen. + */ + public static final int KEYCODE_TV_POWER = 177; + /** + * Key code constant: TV input key. + * On TV remotes, switches the input on a television screen. + */ + public static final int KEYCODE_TV_INPUT = 178; + /** + * Key code constant: Set-top-box power key. + * On TV remotes, toggles the power on an external Set-top-box. + */ + public static final int KEYCODE_STB_POWER = 179; + /** + * Key code constant: Set-top-box input key. + * On TV remotes, switches the input mode on an external Set-top-box. + */ + public static final int KEYCODE_STB_INPUT = 180; + /** + * Key code constant: A/V Receiver power key. + * On TV remotes, toggles the power on an external A/V Receiver. + */ + public static final int KEYCODE_AVR_POWER = 181; + /** + * Key code constant: A/V Receiver input key. + * On TV remotes, switches the input mode on an external A/V Receiver. + */ + public static final int KEYCODE_AVR_INPUT = 182; + /** + * Key code constant: Red "programmable" key. + * On TV remotes, acts as a contextual/programmable key. + */ + public static final int KEYCODE_PROG_RED = 183; + /** + * Key code constant: Green "programmable" key. + * On TV remotes, actsas a contextual/programmable key. + */ + public static final int KEYCODE_PROG_GREEN = 184; + /** + * Key code constant: Yellow "programmable" key. + * On TV remotes, acts as a contextual/programmable key. + */ + public static final int KEYCODE_PROG_YELLOW = 185; + /** + * Key code constant: Blue "programmable" key. + * On TV remotes, acts as a contextual/programmable key. + */ + public static final int KEYCODE_PROG_BLUE = 186; + /** + * Key code constant: App switch key. + * Should bring up the application switcher dialog. + */ + public static final int KEYCODE_APP_SWITCH = 187; + /** + * Key code constant: Generic Game Pad Button #1. + */ + public static final int KEYCODE_BUTTON_1 = 188; + /** + * Key code constant: Generic Game Pad Button #2. + */ + public static final int KEYCODE_BUTTON_2 = 189; + /** + * Key code constant: Generic Game Pad Button #3. + */ + public static final int KEYCODE_BUTTON_3 = 190; + /** + * Key code constant: Generic Game Pad Button #4. + */ + public static final int KEYCODE_BUTTON_4 = 191; + /** + * Key code constant: Generic Game Pad Button #5. + */ + public static final int KEYCODE_BUTTON_5 = 192; + /** + * Key code constant: Generic Game Pad Button #6. + */ + public static final int KEYCODE_BUTTON_6 = 193; + /** + * Key code constant: Generic Game Pad Button #7. + */ + public static final int KEYCODE_BUTTON_7 = 194; + /** + * Key code constant: Generic Game Pad Button #8. + */ + public static final int KEYCODE_BUTTON_8 = 195; + /** + * Key code constant: Generic Game Pad Button #9. + */ + public static final int KEYCODE_BUTTON_9 = 196; + /** + * Key code constant: Generic Game Pad Button #10. + */ + public static final int KEYCODE_BUTTON_10 = 197; + /** + * Key code constant: Generic Game Pad Button #11. + */ + public static final int KEYCODE_BUTTON_11 = 198; + /** + * Key code constant: Generic Game Pad Button #12. + */ + public static final int KEYCODE_BUTTON_12 = 199; + /** + * Key code constant: Generic Game Pad Button #13. + */ + public static final int KEYCODE_BUTTON_13 = 200; + /** + * Key code constant: Generic Game Pad Button #14. + */ + public static final int KEYCODE_BUTTON_14 = 201; + /** + * Key code constant: Generic Game Pad Button #15. + */ + public static final int KEYCODE_BUTTON_15 = 202; + /** + * Key code constant: Generic Game Pad Button #16. + */ + public static final int KEYCODE_BUTTON_16 = 203; + /** + * Key code constant: Language Switch key. + * Toggles the current input language such as switching between English and Japanese on + * a QWERTY keyboard. On some devices, the same function may be performed by + * pressing Shift+Spacebar. + */ + public static final int KEYCODE_LANGUAGE_SWITCH = 204; + /** + * Key code constant: Manner Mode key. + * Toggles silent or vibrate mode on and off to make the device behave more politely + * in certain settings such as on a crowded train. On some devices, the key may only + * operate when long-pressed. + */ + public static final int KEYCODE_MANNER_MODE = 205; + /** + * Key code constant: 3D Mode key. + * Toggles the display between 2D and 3D mode. + */ + public static final int KEYCODE_3D_MODE = 206; + /** + * Key code constant: Contacts special function key. + * Used to launch an address book application. + */ + public static final int KEYCODE_CONTACTS = 207; + /** + * Key code constant: Calendar special function key. + * Used to launch a calendar application. + */ + public static final int KEYCODE_CALENDAR = 208; + /** + * Key code constant: Music special function key. + * Used to launch a music player application. + */ + public static final int KEYCODE_MUSIC = 209; + /** + * Key code constant: Calculator special function key. + * Used to launch a calculator application. + */ + public static final int KEYCODE_CALCULATOR = 210; + /** + * Key code constant: Japanese full-width / half-width key. + */ + public static final int KEYCODE_ZENKAKU_HANKAKU = 211; + /** + * Key code constant: Japanese alphanumeric key. + */ + public static final int KEYCODE_EISU = 212; + /** + * Key code constant: Japanese non-conversion key. + */ + public static final int KEYCODE_MUHENKAN = 213; + /** + * Key code constant: Japanese conversion key. + */ + public static final int KEYCODE_HENKAN = 214; + /** + * Key code constant: Japanese katakana / hiragana key. + */ + public static final int KEYCODE_KATAKANA_HIRAGANA = 215; + /** + * Key code constant: Japanese Yen key. + */ + public static final int KEYCODE_YEN = 216; + /** + * Key code constant: Japanese Ro key. + */ + public static final int KEYCODE_RO = 217; + /** + * Key code constant: Japanese kana key. + */ + public static final int KEYCODE_KANA = 218; + /** + * Key code constant: Assist key. + * Launches the global assist activity. Not delivered to applications. + */ + public static final int KEYCODE_ASSIST = 219; + /** + * Key code constant: Brightness Down key. + * Adjusts the screen brightness down. + */ + public static final int KEYCODE_BRIGHTNESS_DOWN = 220; + /** + * Key code constant: Brightness Up key. + * Adjusts the screen brightness up. + */ + public static final int KEYCODE_BRIGHTNESS_UP = 221; + /** + * Key code constant: Audio Track key + * Switches the audio tracks. + */ + public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222; + + private static final int LAST_KEYCODE = KEYCODE_MEDIA_AUDIO_TRACK; + + // NOTE: If you add a new keycode here you must also add it to: + // isSystem() + // frameworks/native/include/android/keycodes.h + // frameworks/base/include/androidfw/KeycodeLabels.h + // external/webkit/WebKit/android/plugins/ANPKeyCodes.h + // frameworks/base/core/res/res/values/attrs.xml + // emulator? + // LAST_KEYCODE + // KEYCODE_SYMBOLIC_NAMES + // + // Also Android currently does not reserve code ranges for vendor- + // specific key codes. If you have new key codes to have, you + // MUST contribute a patch to the open source project to define + // those new codes. This is intended to maintain a consistent + // set of key code definitions across all Android devices. + + // Symbolic names of all key codes. + private static final SparseArray KEYCODE_SYMBOLIC_NAMES = new SparseArray(); + private static void populateKeycodeSymbolicNames() { + SparseArray names = KEYCODE_SYMBOLIC_NAMES; + names.append(KEYCODE_UNKNOWN, "KEYCODE_UNKNOWN"); + names.append(KEYCODE_SOFT_LEFT, "KEYCODE_SOFT_LEFT"); + names.append(KEYCODE_SOFT_RIGHT, "KEYCODE_SOFT_RIGHT"); + names.append(KEYCODE_HOME, "KEYCODE_HOME"); + names.append(KEYCODE_BACK, "KEYCODE_BACK"); + names.append(KEYCODE_CALL, "KEYCODE_CALL"); + names.append(KEYCODE_ENDCALL, "KEYCODE_ENDCALL"); + names.append(KEYCODE_0, "KEYCODE_0"); + names.append(KEYCODE_1, "KEYCODE_1"); + names.append(KEYCODE_2, "KEYCODE_2"); + names.append(KEYCODE_3, "KEYCODE_3"); + names.append(KEYCODE_4, "KEYCODE_4"); + names.append(KEYCODE_5, "KEYCODE_5"); + names.append(KEYCODE_6, "KEYCODE_6"); + names.append(KEYCODE_7, "KEYCODE_7"); + names.append(KEYCODE_8, "KEYCODE_8"); + names.append(KEYCODE_9, "KEYCODE_9"); + names.append(KEYCODE_STAR, "KEYCODE_STAR"); + names.append(KEYCODE_POUND, "KEYCODE_POUND"); + names.append(KEYCODE_DPAD_UP, "KEYCODE_DPAD_UP"); + names.append(KEYCODE_DPAD_DOWN, "KEYCODE_DPAD_DOWN"); + names.append(KEYCODE_DPAD_LEFT, "KEYCODE_DPAD_LEFT"); + names.append(KEYCODE_DPAD_RIGHT, "KEYCODE_DPAD_RIGHT"); + names.append(KEYCODE_DPAD_CENTER, "KEYCODE_DPAD_CENTER"); + names.append(KEYCODE_VOLUME_UP, "KEYCODE_VOLUME_UP"); + names.append(KEYCODE_VOLUME_DOWN, "KEYCODE_VOLUME_DOWN"); + names.append(KEYCODE_POWER, "KEYCODE_POWER"); + names.append(KEYCODE_CAMERA, "KEYCODE_CAMERA"); + names.append(KEYCODE_CLEAR, "KEYCODE_CLEAR"); + names.append(KEYCODE_A, "KEYCODE_A"); + names.append(KEYCODE_B, "KEYCODE_B"); + names.append(KEYCODE_C, "KEYCODE_C"); + names.append(KEYCODE_D, "KEYCODE_D"); + names.append(KEYCODE_E, "KEYCODE_E"); + names.append(KEYCODE_F, "KEYCODE_F"); + names.append(KEYCODE_G, "KEYCODE_G"); + names.append(KEYCODE_H, "KEYCODE_H"); + names.append(KEYCODE_I, "KEYCODE_I"); + names.append(KEYCODE_J, "KEYCODE_J"); + names.append(KEYCODE_K, "KEYCODE_K"); + names.append(KEYCODE_L, "KEYCODE_L"); + names.append(KEYCODE_M, "KEYCODE_M"); + names.append(KEYCODE_N, "KEYCODE_N"); + names.append(KEYCODE_O, "KEYCODE_O"); + names.append(KEYCODE_P, "KEYCODE_P"); + names.append(KEYCODE_Q, "KEYCODE_Q"); + names.append(KEYCODE_R, "KEYCODE_R"); + names.append(KEYCODE_S, "KEYCODE_S"); + names.append(KEYCODE_T, "KEYCODE_T"); + names.append(KEYCODE_U, "KEYCODE_U"); + names.append(KEYCODE_V, "KEYCODE_V"); + names.append(KEYCODE_W, "KEYCODE_W"); + names.append(KEYCODE_X, "KEYCODE_X"); + names.append(KEYCODE_Y, "KEYCODE_Y"); + names.append(KEYCODE_Z, "KEYCODE_Z"); + names.append(KEYCODE_COMMA, "KEYCODE_COMMA"); + names.append(KEYCODE_PERIOD, "KEYCODE_PERIOD"); + names.append(KEYCODE_ALT_LEFT, "KEYCODE_ALT_LEFT"); + names.append(KEYCODE_ALT_RIGHT, "KEYCODE_ALT_RIGHT"); + names.append(KEYCODE_SHIFT_LEFT, "KEYCODE_SHIFT_LEFT"); + names.append(KEYCODE_SHIFT_RIGHT, "KEYCODE_SHIFT_RIGHT"); + names.append(KEYCODE_TAB, "KEYCODE_TAB"); + names.append(KEYCODE_SPACE, "KEYCODE_SPACE"); + names.append(KEYCODE_SYM, "KEYCODE_SYM"); + names.append(KEYCODE_EXPLORER, "KEYCODE_EXPLORER"); + names.append(KEYCODE_ENVELOPE, "KEYCODE_ENVELOPE"); + names.append(KEYCODE_ENTER, "KEYCODE_ENTER"); + names.append(KEYCODE_DEL, "KEYCODE_DEL"); + names.append(KEYCODE_GRAVE, "KEYCODE_GRAVE"); + names.append(KEYCODE_MINUS, "KEYCODE_MINUS"); + names.append(KEYCODE_EQUALS, "KEYCODE_EQUALS"); + names.append(KEYCODE_LEFT_BRACKET, "KEYCODE_LEFT_BRACKET"); + names.append(KEYCODE_RIGHT_BRACKET, "KEYCODE_RIGHT_BRACKET"); + names.append(KEYCODE_BACKSLASH, "KEYCODE_BACKSLASH"); + names.append(KEYCODE_SEMICOLON, "KEYCODE_SEMICOLON"); + names.append(KEYCODE_APOSTROPHE, "KEYCODE_APOSTROPHE"); + names.append(KEYCODE_SLASH, "KEYCODE_SLASH"); + names.append(KEYCODE_AT, "KEYCODE_AT"); + names.append(KEYCODE_NUM, "KEYCODE_NUM"); + names.append(KEYCODE_HEADSETHOOK, "KEYCODE_HEADSETHOOK"); + names.append(KEYCODE_FOCUS, "KEYCODE_FOCUS"); + names.append(KEYCODE_PLUS, "KEYCODE_PLUS"); + names.append(KEYCODE_MENU, "KEYCODE_MENU"); + names.append(KEYCODE_NOTIFICATION, "KEYCODE_NOTIFICATION"); + names.append(KEYCODE_SEARCH, "KEYCODE_SEARCH"); + names.append(KEYCODE_MEDIA_PLAY_PAUSE, "KEYCODE_MEDIA_PLAY_PAUSE"); + names.append(KEYCODE_MEDIA_STOP, "KEYCODE_MEDIA_STOP"); + names.append(KEYCODE_MEDIA_NEXT, "KEYCODE_MEDIA_NEXT"); + names.append(KEYCODE_MEDIA_PREVIOUS, "KEYCODE_MEDIA_PREVIOUS"); + names.append(KEYCODE_MEDIA_REWIND, "KEYCODE_MEDIA_REWIND"); + names.append(KEYCODE_MEDIA_FAST_FORWARD, "KEYCODE_MEDIA_FAST_FORWARD"); + names.append(KEYCODE_MUTE, "KEYCODE_MUTE"); + names.append(KEYCODE_PAGE_UP, "KEYCODE_PAGE_UP"); + names.append(KEYCODE_PAGE_DOWN, "KEYCODE_PAGE_DOWN"); + names.append(KEYCODE_PICTSYMBOLS, "KEYCODE_PICTSYMBOLS"); + names.append(KEYCODE_SWITCH_CHARSET, "KEYCODE_SWITCH_CHARSET"); + names.append(KEYCODE_BUTTON_A, "KEYCODE_BUTTON_A"); + names.append(KEYCODE_BUTTON_B, "KEYCODE_BUTTON_B"); + names.append(KEYCODE_BUTTON_C, "KEYCODE_BUTTON_C"); + names.append(KEYCODE_BUTTON_X, "KEYCODE_BUTTON_X"); + names.append(KEYCODE_BUTTON_Y, "KEYCODE_BUTTON_Y"); + names.append(KEYCODE_BUTTON_Z, "KEYCODE_BUTTON_Z"); + names.append(KEYCODE_BUTTON_L1, "KEYCODE_BUTTON_L1"); + names.append(KEYCODE_BUTTON_R1, "KEYCODE_BUTTON_R1"); + names.append(KEYCODE_BUTTON_L2, "KEYCODE_BUTTON_L2"); + names.append(KEYCODE_BUTTON_R2, "KEYCODE_BUTTON_R2"); + names.append(KEYCODE_BUTTON_THUMBL, "KEYCODE_BUTTON_THUMBL"); + names.append(KEYCODE_BUTTON_THUMBR, "KEYCODE_BUTTON_THUMBR"); + names.append(KEYCODE_BUTTON_START, "KEYCODE_BUTTON_START"); + names.append(KEYCODE_BUTTON_SELECT, "KEYCODE_BUTTON_SELECT"); + names.append(KEYCODE_BUTTON_MODE, "KEYCODE_BUTTON_MODE"); + names.append(KEYCODE_ESCAPE, "KEYCODE_ESCAPE"); + names.append(KEYCODE_FORWARD_DEL, "KEYCODE_FORWARD_DEL"); + names.append(KEYCODE_CTRL_LEFT, "KEYCODE_CTRL_LEFT"); + names.append(KEYCODE_CTRL_RIGHT, "KEYCODE_CTRL_RIGHT"); + names.append(KEYCODE_CAPS_LOCK, "KEYCODE_CAPS_LOCK"); + names.append(KEYCODE_SCROLL_LOCK, "KEYCODE_SCROLL_LOCK"); + names.append(KEYCODE_META_LEFT, "KEYCODE_META_LEFT"); + names.append(KEYCODE_META_RIGHT, "KEYCODE_META_RIGHT"); + names.append(KEYCODE_FUNCTION, "KEYCODE_FUNCTION"); + names.append(KEYCODE_SYSRQ, "KEYCODE_SYSRQ"); + names.append(KEYCODE_BREAK, "KEYCODE_BREAK"); + names.append(KEYCODE_MOVE_HOME, "KEYCODE_MOVE_HOME"); + names.append(KEYCODE_MOVE_END, "KEYCODE_MOVE_END"); + names.append(KEYCODE_INSERT, "KEYCODE_INSERT"); + names.append(KEYCODE_FORWARD, "KEYCODE_FORWARD"); + names.append(KEYCODE_MEDIA_PLAY, "KEYCODE_MEDIA_PLAY"); + names.append(KEYCODE_MEDIA_PAUSE, "KEYCODE_MEDIA_PAUSE"); + names.append(KEYCODE_MEDIA_CLOSE, "KEYCODE_MEDIA_CLOSE"); + names.append(KEYCODE_MEDIA_EJECT, "KEYCODE_MEDIA_EJECT"); + names.append(KEYCODE_MEDIA_RECORD, "KEYCODE_MEDIA_RECORD"); + names.append(KEYCODE_F1, "KEYCODE_F1"); + names.append(KEYCODE_F2, "KEYCODE_F2"); + names.append(KEYCODE_F3, "KEYCODE_F3"); + names.append(KEYCODE_F4, "KEYCODE_F4"); + names.append(KEYCODE_F5, "KEYCODE_F5"); + names.append(KEYCODE_F6, "KEYCODE_F6"); + names.append(KEYCODE_F7, "KEYCODE_F7"); + names.append(KEYCODE_F8, "KEYCODE_F8"); + names.append(KEYCODE_F9, "KEYCODE_F9"); + names.append(KEYCODE_F10, "KEYCODE_F10"); + names.append(KEYCODE_F11, "KEYCODE_F11"); + names.append(KEYCODE_F12, "KEYCODE_F12"); + names.append(KEYCODE_NUM_LOCK, "KEYCODE_NUM_LOCK"); + names.append(KEYCODE_NUMPAD_0, "KEYCODE_NUMPAD_0"); + names.append(KEYCODE_NUMPAD_1, "KEYCODE_NUMPAD_1"); + names.append(KEYCODE_NUMPAD_2, "KEYCODE_NUMPAD_2"); + names.append(KEYCODE_NUMPAD_3, "KEYCODE_NUMPAD_3"); + names.append(KEYCODE_NUMPAD_4, "KEYCODE_NUMPAD_4"); + names.append(KEYCODE_NUMPAD_5, "KEYCODE_NUMPAD_5"); + names.append(KEYCODE_NUMPAD_6, "KEYCODE_NUMPAD_6"); + names.append(KEYCODE_NUMPAD_7, "KEYCODE_NUMPAD_7"); + names.append(KEYCODE_NUMPAD_8, "KEYCODE_NUMPAD_8"); + names.append(KEYCODE_NUMPAD_9, "KEYCODE_NUMPAD_9"); + names.append(KEYCODE_NUMPAD_DIVIDE, "KEYCODE_NUMPAD_DIVIDE"); + names.append(KEYCODE_NUMPAD_MULTIPLY, "KEYCODE_NUMPAD_MULTIPLY"); + names.append(KEYCODE_NUMPAD_SUBTRACT, "KEYCODE_NUMPAD_SUBTRACT"); + names.append(KEYCODE_NUMPAD_ADD, "KEYCODE_NUMPAD_ADD"); + names.append(KEYCODE_NUMPAD_DOT, "KEYCODE_NUMPAD_DOT"); + names.append(KEYCODE_NUMPAD_COMMA, "KEYCODE_NUMPAD_COMMA"); + names.append(KEYCODE_NUMPAD_ENTER, "KEYCODE_NUMPAD_ENTER"); + names.append(KEYCODE_NUMPAD_EQUALS, "KEYCODE_NUMPAD_EQUALS"); + names.append(KEYCODE_NUMPAD_LEFT_PAREN, "KEYCODE_NUMPAD_LEFT_PAREN"); + names.append(KEYCODE_NUMPAD_RIGHT_PAREN, "KEYCODE_NUMPAD_RIGHT_PAREN"); + names.append(KEYCODE_VOLUME_MUTE, "KEYCODE_VOLUME_MUTE"); + names.append(KEYCODE_INFO, "KEYCODE_INFO"); + names.append(KEYCODE_CHANNEL_UP, "KEYCODE_CHANNEL_UP"); + names.append(KEYCODE_CHANNEL_DOWN, "KEYCODE_CHANNEL_DOWN"); + names.append(KEYCODE_ZOOM_IN, "KEYCODE_ZOOM_IN"); + names.append(KEYCODE_ZOOM_OUT, "KEYCODE_ZOOM_OUT"); + names.append(KEYCODE_TV, "KEYCODE_TV"); + names.append(KEYCODE_WINDOW, "KEYCODE_WINDOW"); + names.append(KEYCODE_GUIDE, "KEYCODE_GUIDE"); + names.append(KEYCODE_DVR, "KEYCODE_DVR"); + names.append(KEYCODE_BOOKMARK, "KEYCODE_BOOKMARK"); + names.append(KEYCODE_CAPTIONS, "KEYCODE_CAPTIONS"); + names.append(KEYCODE_SETTINGS, "KEYCODE_SETTINGS"); + names.append(KEYCODE_TV_POWER, "KEYCODE_TV_POWER"); + names.append(KEYCODE_TV_INPUT, "KEYCODE_TV_INPUT"); + names.append(KEYCODE_STB_INPUT, "KEYCODE_STB_INPUT"); + names.append(KEYCODE_STB_POWER, "KEYCODE_STB_POWER"); + names.append(KEYCODE_AVR_POWER, "KEYCODE_AVR_POWER"); + names.append(KEYCODE_AVR_INPUT, "KEYCODE_AVR_INPUT"); + names.append(KEYCODE_PROG_RED, "KEYCODE_PROG_RED"); + names.append(KEYCODE_PROG_GREEN, "KEYCODE_PROG_GREEN"); + names.append(KEYCODE_PROG_YELLOW, "KEYCODE_PROG_YELLOW"); + names.append(KEYCODE_PROG_BLUE, "KEYCODE_PROG_BLUE"); + names.append(KEYCODE_APP_SWITCH, "KEYCODE_APP_SWITCH"); + names.append(KEYCODE_BUTTON_1, "KEYCODE_BUTTON_1"); + names.append(KEYCODE_BUTTON_2, "KEYCODE_BUTTON_2"); + names.append(KEYCODE_BUTTON_3, "KEYCODE_BUTTON_3"); + names.append(KEYCODE_BUTTON_4, "KEYCODE_BUTTON_4"); + names.append(KEYCODE_BUTTON_5, "KEYCODE_BUTTON_5"); + names.append(KEYCODE_BUTTON_6, "KEYCODE_BUTTON_6"); + names.append(KEYCODE_BUTTON_7, "KEYCODE_BUTTON_7"); + names.append(KEYCODE_BUTTON_8, "KEYCODE_BUTTON_8"); + names.append(KEYCODE_BUTTON_9, "KEYCODE_BUTTON_9"); + names.append(KEYCODE_BUTTON_10, "KEYCODE_BUTTON_10"); + names.append(KEYCODE_BUTTON_11, "KEYCODE_BUTTON_11"); + names.append(KEYCODE_BUTTON_12, "KEYCODE_BUTTON_12"); + names.append(KEYCODE_BUTTON_13, "KEYCODE_BUTTON_13"); + names.append(KEYCODE_BUTTON_14, "KEYCODE_BUTTON_14"); + names.append(KEYCODE_BUTTON_15, "KEYCODE_BUTTON_15"); + names.append(KEYCODE_BUTTON_16, "KEYCODE_BUTTON_16"); + names.append(KEYCODE_LANGUAGE_SWITCH, "KEYCODE_LANGUAGE_SWITCH"); + names.append(KEYCODE_MANNER_MODE, "KEYCODE_MANNER_MODE"); + names.append(KEYCODE_3D_MODE, "KEYCODE_3D_MODE"); + names.append(KEYCODE_CONTACTS, "KEYCODE_CONTACTS"); + names.append(KEYCODE_CALENDAR, "KEYCODE_CALENDAR"); + names.append(KEYCODE_MUSIC, "KEYCODE_MUSIC"); + names.append(KEYCODE_CALCULATOR, "KEYCODE_CALCULATOR"); + names.append(KEYCODE_ZENKAKU_HANKAKU, "KEYCODE_ZENKAKU_HANKAKU"); + names.append(KEYCODE_EISU, "KEYCODE_EISU"); + names.append(KEYCODE_MUHENKAN, "KEYCODE_MUHENKAN"); + names.append(KEYCODE_HENKAN, "KEYCODE_HENKAN"); + names.append(KEYCODE_KATAKANA_HIRAGANA, "KEYCODE_KATAKANA_HIRAGANA"); + names.append(KEYCODE_YEN, "KEYCODE_YEN"); + names.append(KEYCODE_RO, "KEYCODE_RO"); + names.append(KEYCODE_KANA, "KEYCODE_KANA"); + names.append(KEYCODE_ASSIST, "KEYCODE_ASSIST"); + names.append(KEYCODE_BRIGHTNESS_DOWN, "KEYCODE_BRIGHTNESS_DOWN"); + names.append(KEYCODE_BRIGHTNESS_UP, "KEYCODE_BRIGHTNESS_UP"); + names.append(KEYCODE_MEDIA_AUDIO_TRACK, "KEYCODE_MEDIA_AUDIO_TRACK"); + }; + + // Symbolic names of all metakeys in bit order from least significant to most significant. + // Accordingly there are exactly 32 values in this table. + private static final String[] META_SYMBOLIC_NAMES = new String[] { + "META_SHIFT_ON", + "META_ALT_ON", + "META_SYM_ON", + "META_FUNCTION_ON", + "META_ALT_LEFT_ON", + "META_ALT_RIGHT_ON", + "META_SHIFT_LEFT_ON", + "META_SHIFT_RIGHT_ON", + "META_CAP_LOCKED", + "META_ALT_LOCKED", + "META_SYM_LOCKED", + "0x00000800", + "META_CTRL_ON", + "META_CTRL_LEFT_ON", + "META_CTRL_RIGHT_ON", + "0x00008000", + "META_META_ON", + "META_META_LEFT_ON", + "META_META_RIGHT_ON", + "0x00080000", + "META_CAPS_LOCK_ON", + "META_NUM_LOCK_ON", + "META_SCROLL_LOCK_ON", + "0x00800000", + "0x01000000", + "0x02000000", + "0x04000000", + "0x08000000", + "0x10000000", + "0x20000000", + "0x40000000", + "0x80000000", + }; + + /** + * @deprecated There are now more than MAX_KEYCODE keycodes. + * Use {@link #getMaxKeyCode()} instead. + */ + @Deprecated + public static final int MAX_KEYCODE = 84; + + /** + * {@link #getAction} value: the key has been pressed down. + */ + public static final int ACTION_DOWN = 0; + /** + * {@link #getAction} value: the key has been released. + */ + public static final int ACTION_UP = 1; + /** + * {@link #getAction} value: multiple duplicate key events have + * occurred in a row, or a complex string is being delivered. If the + * key code is not {#link {@link #KEYCODE_UNKNOWN} then the + * {#link {@link #getRepeatCount()} method returns the number of times + * the given key code should be executed. + * Otherwise, if the key code is {@link #KEYCODE_UNKNOWN}, then + * this is a sequence of characters as returned by {@link #getCharacters}. + */ + public static final int ACTION_MULTIPLE = 2; + + /** + * SHIFT key locked in CAPS mode. + * Reserved for use by {@link MetaKeyKeyListener} for a published constant in its API. + * @hide + */ + public static final int META_CAP_LOCKED = 0x100; + + /** + * ALT key locked. + * Reserved for use by {@link MetaKeyKeyListener} for a published constant in its API. + * @hide + */ + public static final int META_ALT_LOCKED = 0x200; + + /** + * SYM key locked. + * Reserved for use by {@link MetaKeyKeyListener} for a published constant in its API. + * @hide + */ + public static final int META_SYM_LOCKED = 0x400; + + /** + * Text is in selection mode. + * Reserved for use by {@link MetaKeyKeyListener} for a private unpublished constant + * in its API that is currently being retained for legacy reasons. + * @hide + */ + public static final int META_SELECTING = 0x800; + + /** + *

This mask is used to check whether one of the ALT meta keys is pressed.

+ * + * @see #isAltPressed() + * @see #getMetaState() + * @see #KEYCODE_ALT_LEFT + * @see #KEYCODE_ALT_RIGHT + */ + public static final int META_ALT_ON = 0x02; + + /** + *

This mask is used to check whether the left ALT meta key is pressed.

+ * + * @see #isAltPressed() + * @see #getMetaState() + * @see #KEYCODE_ALT_LEFT + */ + public static final int META_ALT_LEFT_ON = 0x10; + + /** + *

This mask is used to check whether the right the ALT meta key is pressed.

+ * + * @see #isAltPressed() + * @see #getMetaState() + * @see #KEYCODE_ALT_RIGHT + */ + public static final int META_ALT_RIGHT_ON = 0x20; + + /** + *

This mask is used to check whether one of the SHIFT meta keys is pressed.

+ * + * @see #isShiftPressed() + * @see #getMetaState() + * @see #KEYCODE_SHIFT_LEFT + * @see #KEYCODE_SHIFT_RIGHT + */ + public static final int META_SHIFT_ON = 0x1; + + /** + *

This mask is used to check whether the left SHIFT meta key is pressed.

+ * + * @see #isShiftPressed() + * @see #getMetaState() + * @see #KEYCODE_SHIFT_LEFT + */ + public static final int META_SHIFT_LEFT_ON = 0x40; + + /** + *

This mask is used to check whether the right SHIFT meta key is pressed.

+ * + * @see #isShiftPressed() + * @see #getMetaState() + * @see #KEYCODE_SHIFT_RIGHT + */ + public static final int META_SHIFT_RIGHT_ON = 0x80; + + /** + *

This mask is used to check whether the SYM meta key is pressed.

+ * + * @see #isSymPressed() + * @see #getMetaState() + */ + public static final int META_SYM_ON = 0x4; + + /** + *

This mask is used to check whether the FUNCTION meta key is pressed.

+ * + * @see #isFunctionPressed() + * @see #getMetaState() + */ + public static final int META_FUNCTION_ON = 0x8; + + /** + *

This mask is used to check whether one of the CTRL meta keys is pressed.

+ * + * @see #isCtrlPressed() + * @see #getMetaState() + * @see #KEYCODE_CTRL_LEFT + * @see #KEYCODE_CTRL_RIGHT + */ + public static final int META_CTRL_ON = 0x1000; + + /** + *

This mask is used to check whether the left CTRL meta key is pressed.

+ * + * @see #isCtrlPressed() + * @see #getMetaState() + * @see #KEYCODE_CTRL_LEFT + */ + public static final int META_CTRL_LEFT_ON = 0x2000; + + /** + *

This mask is used to check whether the right CTRL meta key is pressed.

+ * + * @see #isCtrlPressed() + * @see #getMetaState() + * @see #KEYCODE_CTRL_RIGHT + */ + public static final int META_CTRL_RIGHT_ON = 0x4000; + + /** + *

This mask is used to check whether one of the META meta keys is pressed.

+ * + * @see #isMetaPressed() + * @see #getMetaState() + * @see #KEYCODE_META_LEFT + * @see #KEYCODE_META_RIGHT + */ + public static final int META_META_ON = 0x10000; + + /** + *

This mask is used to check whether the left META meta key is pressed.

+ * + * @see #isMetaPressed() + * @see #getMetaState() + * @see #KEYCODE_META_LEFT + */ + public static final int META_META_LEFT_ON = 0x20000; + + /** + *

This mask is used to check whether the right META meta key is pressed.

+ * + * @see #isMetaPressed() + * @see #getMetaState() + * @see #KEYCODE_META_RIGHT + */ + public static final int META_META_RIGHT_ON = 0x40000; + + /** + *

This mask is used to check whether the CAPS LOCK meta key is on.

+ * + * @see #isCapsLockOn() + * @see #getMetaState() + * @see #KEYCODE_CAPS_LOCK + */ + public static final int META_CAPS_LOCK_ON = 0x100000; + + /** + *

This mask is used to check whether the NUM LOCK meta key is on.

+ * + * @see #isNumLockOn() + * @see #getMetaState() + * @see #KEYCODE_NUM_LOCK + */ + public static final int META_NUM_LOCK_ON = 0x200000; + + /** + *

This mask is used to check whether the SCROLL LOCK meta key is on.

+ * + * @see #isScrollLockOn() + * @see #getMetaState() + * @see #KEYCODE_SCROLL_LOCK + */ + public static final int META_SCROLL_LOCK_ON = 0x400000; + + /** + * This mask is a combination of {@link #META_SHIFT_ON}, {@link #META_SHIFT_LEFT_ON} + * and {@link #META_SHIFT_RIGHT_ON}. + */ + public static final int META_SHIFT_MASK = META_SHIFT_ON | META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON; + + /** + * This mask is a combination of {@link #META_ALT_ON}, {@link #META_ALT_LEFT_ON} + * and {@link #META_ALT_RIGHT_ON}. + */ + public static final int META_ALT_MASK = META_ALT_ON | META_ALT_LEFT_ON | META_ALT_RIGHT_ON; + + /** + * This mask is a combination of {@link #META_CTRL_ON}, {@link #META_CTRL_LEFT_ON} + * and {@link #META_CTRL_RIGHT_ON}. + */ + public static final int META_CTRL_MASK = META_CTRL_ON | META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON; + + /** + * This mask is a combination of {@link #META_META_ON}, {@link #META_META_LEFT_ON} + * and {@link #META_META_RIGHT_ON}. + */ + public static final int META_META_MASK = META_META_ON | META_META_LEFT_ON | META_META_RIGHT_ON; + + /** + * This mask is set if the device woke because of this key event. + */ + public static final int FLAG_WOKE_HERE = 0x1; + + /** + * This mask is set if the key event was generated by a software keyboard. + */ + public static final int FLAG_SOFT_KEYBOARD = 0x2; + + /** + * This mask is set if we don't want the key event to cause us to leave + * touch mode. + */ + public static final int FLAG_KEEP_TOUCH_MODE = 0x4; + + /** + * This mask is set if an event was known to come from a trusted part + * of the system. That is, the event is known to come from the user, + * and could not have been spoofed by a third party component. + */ + public static final int FLAG_FROM_SYSTEM = 0x8; + + /** + * This mask is used for compatibility, to identify enter keys that are + * coming from an IME whose enter key has been auto-labelled "next" or + * "done". This allows TextView to dispatch these as normal enter keys + * for old applications, but still do the appropriate action when + * receiving them. + */ + public static final int FLAG_EDITOR_ACTION = 0x10; + + /** + * When associated with up key events, this indicates that the key press + * has been canceled. Typically this is used with virtual touch screen + * keys, where the user can slide from the virtual key area on to the + * display: in that case, the application will receive a canceled up + * event and should not perform the action normally associated with the + * key. Note that for this to work, the application can not perform an + * action for a key until it receives an up or the long press timeout has + * expired. + */ + public static final int FLAG_CANCELED = 0x20; + + /** + * This key event was generated by a virtual (on-screen) hard key area. + * Typically this is an area of the touchscreen, outside of the regular + * display, dedicated to "hardware" buttons. + */ + public static final int FLAG_VIRTUAL_HARD_KEY = 0x40; + + /** + * This flag is set for the first key repeat that occurs after the + * long press timeout. + */ + public static final int FLAG_LONG_PRESS = 0x80; + + /** + * Set when a key event has {@link #FLAG_CANCELED} set because a long + * press action was executed while it was down. + */ + public static final int FLAG_CANCELED_LONG_PRESS = 0x100; + + /** + * Set for {@link #ACTION_UP} when this event's key code is still being + * tracked from its initial down. That is, somebody requested that tracking + * started on the key down and a long press has not caused + * the tracking to be canceled. + */ + public static final int FLAG_TRACKING = 0x200; + + /** + * Set when a key event has been synthesized to implement default behavior + * for an event that the application did not handle. + * Fallback key events are generated by unhandled trackball motions + * (to emulate a directional keypad) and by certain unhandled key presses + * that are declared in the key map (such as special function numeric keypad + * keys when numlock is off). + */ + public static final int FLAG_FALLBACK = 0x400; + + /** + * Signifies that the key is being predispatched. + * @hide + */ + public static final int FLAG_PREDISPATCH = 0x20000000; + + /** + * Private control to determine when an app is tracking a key sequence. + * @hide + */ + public static final int FLAG_START_TRACKING = 0x40000000; + + /** + * Private flag that indicates when the system has detected that this key event + * may be inconsistent with respect to the sequence of previously delivered key events, + * such as when a key up event is sent but the key was not down. + * + * @hide + * @see #isTainted + * @see #setTainted + */ + public static final int FLAG_TAINTED = 0x80000000; + + /** + * Returns the maximum keycode. + */ + public static int getMaxKeyCode() { + return LAST_KEYCODE; + } + + /** + * Get the character that is produced by putting accent on the character + * c. + * For example, getDeadChar('`', 'e') returns è. + */ + public static int getDeadChar(int accent, int c) { + return KeyCharacterMap.getDeadChar(accent, c); + } + + static final boolean DEBUG = false; + static final String TAG = "KeyEvent"; + + private static final int MAX_RECYCLED = 10; + private static final Object gRecyclerLock = new Object(); + private static int gRecyclerUsed; + private static KeyEvent gRecyclerTop; + + private KeyEvent mNext; + + private int mDeviceId; + private int mSource; + private int mMetaState; + private int mAction; + private int mKeyCode; + private int mScanCode; + private int mRepeatCount; + private int mFlags; + private long mDownTime; + private long mEventTime; + private String mCharacters; + + public interface Callback { + /** + * Called when a key down event has occurred. If you return true, + * you can first call {@link KeyEvent#startTracking() + * KeyEvent.startTracking()} to have the framework track the event + * through its {@link #onKeyUp(int, KeyEvent)} and also call your + * {@link #onKeyLongPress(int, KeyEvent)} if it occurs. + * + * @param keyCode The value in event.getKeyCode(). + * @param event Description of the key event. + * + * @return If you handled the event, return true. If you want to allow + * the event to be handled by the next receiver, return false. + */ + boolean onKeyDown(int keyCode, KeyEvent event); + + /** + * Called when a long press has occurred. If you return true, + * the final key up will have {@link KeyEvent#FLAG_CANCELED} and + * {@link KeyEvent#FLAG_CANCELED_LONG_PRESS} set. Note that in + * order to receive this callback, someone in the event change + * must return true from {@link #onKeyDown} and + * call {@link KeyEvent#startTracking()} on the event. + * + * @param keyCode The value in event.getKeyCode(). + * @param event Description of the key event. + * + * @return If you handled the event, return true. If you want to allow + * the event to be handled by the next receiver, return false. + */ + boolean onKeyLongPress(int keyCode, KeyEvent event); + + /** + * Called when a key up event has occurred. + * + * @param keyCode The value in event.getKeyCode(). + * @param event Description of the key event. + * + * @return If you handled the event, return true. If you want to allow + * the event to be handled by the next receiver, return false. + */ + boolean onKeyUp(int keyCode, KeyEvent event); + + /** + * Called when multiple down/up pairs of the same key have occurred + * in a row. + * + * @param keyCode The value in event.getKeyCode(). + * @param count Number of pairs as returned by event.getRepeatCount(). + * @param event Description of the key event. + * + * @return If you handled the event, return true. If you want to allow + * the event to be handled by the next receiver, return false. + */ + boolean onKeyMultiple(int keyCode, int count, KeyEvent event); + } + + static { + populateKeycodeSymbolicNames(); + } + + private KeyEvent() { + } + + /** + * Create a new key event. + * + * @param action Action code: either {@link #ACTION_DOWN}, + * {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * @param code The key code. + */ + public KeyEvent(int action, int code) { + mAction = action; + mKeyCode = code; + mRepeatCount = 0; + mDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; + } + + /** + * Create a new key event. + * + * @param downTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this key code originally went down. + * @param eventTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this event happened. + * @param action Action code: either {@link #ACTION_DOWN}, + * {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * @param code The key code. + * @param repeat A repeat count for down events (> 0 if this is after the + * initial down) or event count for multiple events. + */ + public KeyEvent(long downTime, long eventTime, int action, + int code, int repeat) { + mDownTime = downTime; + mEventTime = eventTime; + mAction = action; + mKeyCode = code; + mRepeatCount = repeat; + mDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; + } + + /** + * Create a new key event. + * + * @param downTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this key code originally went down. + * @param eventTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this event happened. + * @param action Action code: either {@link #ACTION_DOWN}, + * {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * @param code The key code. + * @param repeat A repeat count for down events (> 0 if this is after the + * initial down) or event count for multiple events. + * @param metaState Flags indicating which meta keys are currently pressed. + */ + public KeyEvent(long downTime, long eventTime, int action, + int code, int repeat, int metaState) { + mDownTime = downTime; + mEventTime = eventTime; + mAction = action; + mKeyCode = code; + mRepeatCount = repeat; + mMetaState = metaState; + mDeviceId = KeyCharacterMap.VIRTUAL_KEYBOARD; + } + + /** + * Create a new key event. + * + * @param downTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this key code originally went down. + * @param eventTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this event happened. + * @param action Action code: either {@link #ACTION_DOWN}, + * {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * @param code The key code. + * @param repeat A repeat count for down events (> 0 if this is after the + * initial down) or event count for multiple events. + * @param metaState Flags indicating which meta keys are currently pressed. + * @param deviceId The device ID that generated the key event. + * @param scancode Raw device scan code of the event. + */ + public KeyEvent(long downTime, long eventTime, int action, + int code, int repeat, int metaState, + int deviceId, int scancode) { + mDownTime = downTime; + mEventTime = eventTime; + mAction = action; + mKeyCode = code; + mRepeatCount = repeat; + mMetaState = metaState; + mDeviceId = deviceId; + mScanCode = scancode; + } + + /** + * Create a new key event. + * + * @param downTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this key code originally went down. + * @param eventTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this event happened. + * @param action Action code: either {@link #ACTION_DOWN}, + * {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * @param code The key code. + * @param repeat A repeat count for down events (> 0 if this is after the + * initial down) or event count for multiple events. + * @param metaState Flags indicating which meta keys are currently pressed. + * @param deviceId The device ID that generated the key event. + * @param scancode Raw device scan code of the event. + * @param flags The flags for this key event + */ + public KeyEvent(long downTime, long eventTime, int action, + int code, int repeat, int metaState, + int deviceId, int scancode, int flags) { + mDownTime = downTime; + mEventTime = eventTime; + mAction = action; + mKeyCode = code; + mRepeatCount = repeat; + mMetaState = metaState; + mDeviceId = deviceId; + mScanCode = scancode; + mFlags = flags; + } + + /** + * Create a new key event. + * + * @param downTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this key code originally went down. + * @param eventTime The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this event happened. + * @param action Action code: either {@link #ACTION_DOWN}, + * {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * @param code The key code. + * @param repeat A repeat count for down events (> 0 if this is after the + * initial down) or event count for multiple events. + * @param metaState Flags indicating which meta keys are currently pressed. + * @param deviceId The device ID that generated the key event. + * @param scancode Raw device scan code of the event. + * @param flags The flags for this key event + * @param source The input source such as {@link InputDevice#SOURCE_KEYBOARD}. + */ + public KeyEvent(long downTime, long eventTime, int action, + int code, int repeat, int metaState, + int deviceId, int scancode, int flags, int source) { + mDownTime = downTime; + mEventTime = eventTime; + mAction = action; + mKeyCode = code; + mRepeatCount = repeat; + mMetaState = metaState; + mDeviceId = deviceId; + mScanCode = scancode; + mFlags = flags; + mSource = source; + } + + /** + * Create a new key event for a string of characters. The key code, + * action, repeat count and source will automatically be set to + * {@link #KEYCODE_UNKNOWN}, {@link #ACTION_MULTIPLE}, 0, and + * {@link InputDevice#SOURCE_KEYBOARD} for you. + * + * @param time The time (in {@link android.os.SystemClock#uptimeMillis}) + * at which this event occured. + * @param characters The string of characters. + * @param deviceId The device ID that generated the key event. + * @param flags The flags for this key event + */ + public KeyEvent(long time, String characters, int deviceId, int flags) { + mDownTime = time; + mEventTime = time; + mCharacters = characters; + mAction = ACTION_MULTIPLE; + mKeyCode = KEYCODE_UNKNOWN; + mRepeatCount = 0; + mDeviceId = deviceId; + mFlags = flags; + mSource = InputDevice.SOURCE_KEYBOARD; + } + + /** + * Make an exact copy of an existing key event. + */ + public KeyEvent(KeyEvent origEvent) { + mDownTime = origEvent.mDownTime; + mEventTime = origEvent.mEventTime; + mAction = origEvent.mAction; + mKeyCode = origEvent.mKeyCode; + mRepeatCount = origEvent.mRepeatCount; + mMetaState = origEvent.mMetaState; + mDeviceId = origEvent.mDeviceId; + mSource = origEvent.mSource; + mScanCode = origEvent.mScanCode; + mFlags = origEvent.mFlags; + mCharacters = origEvent.mCharacters; + } + + /** + * Copy an existing key event, modifying its time and repeat count. + * + * @deprecated Use {@link #changeTimeRepeat(KeyEvent, long, int)} + * instead. + * + * @param origEvent The existing event to be copied. + * @param eventTime The new event time + * (in {@link android.os.SystemClock#uptimeMillis}) of the event. + * @param newRepeat The new repeat count of the event. + */ + @Deprecated + public KeyEvent(KeyEvent origEvent, long eventTime, int newRepeat) { + mDownTime = origEvent.mDownTime; + mEventTime = eventTime; + mAction = origEvent.mAction; + mKeyCode = origEvent.mKeyCode; + mRepeatCount = newRepeat; + mMetaState = origEvent.mMetaState; + mDeviceId = origEvent.mDeviceId; + mSource = origEvent.mSource; + mScanCode = origEvent.mScanCode; + mFlags = origEvent.mFlags; + mCharacters = origEvent.mCharacters; + } + + private static KeyEvent obtain() { + final KeyEvent ev; + synchronized (gRecyclerLock) { + ev = gRecyclerTop; + if (ev == null) { + return new KeyEvent(); + } + gRecyclerTop = ev.mNext; + gRecyclerUsed -= 1; + } + ev.mNext = null; + ev.prepareForReuse(); + return ev; + } + + /** + * Obtains a (potentially recycled) key event. + * + * @hide + */ + public static KeyEvent obtain(long downTime, long eventTime, int action, + int code, int repeat, int metaState, + int deviceId, int scancode, int flags, int source, String characters) { + KeyEvent ev = obtain(); + ev.mDownTime = downTime; + ev.mEventTime = eventTime; + ev.mAction = action; + ev.mKeyCode = code; + ev.mRepeatCount = repeat; + ev.mMetaState = metaState; + ev.mDeviceId = deviceId; + ev.mScanCode = scancode; + ev.mFlags = flags; + ev.mSource = source; + ev.mCharacters = characters; + return ev; + } + + /** + * Obtains a (potentially recycled) copy of another key event. + * + * @hide + */ + public static KeyEvent obtain(KeyEvent other) { + KeyEvent ev = obtain(); + ev.mDownTime = other.mDownTime; + ev.mEventTime = other.mEventTime; + ev.mAction = other.mAction; + ev.mKeyCode = other.mKeyCode; + ev.mRepeatCount = other.mRepeatCount; + ev.mMetaState = other.mMetaState; + ev.mDeviceId = other.mDeviceId; + ev.mScanCode = other.mScanCode; + ev.mFlags = other.mFlags; + ev.mSource = other.mSource; + ev.mCharacters = other.mCharacters; + return ev; + } + + /** + * @hide + */ + @Override + public KeyEvent copy() { + return obtain(this); + } + + /** + * Recycles a key event. + * Key events should only be recycled if they are owned by the system since user + * code expects them to be essentially immutable, "tracking" notwithstanding. + * + * @hide + */ + @Override + public final void recycle() { + super.recycle(); + mCharacters = null; + + synchronized (gRecyclerLock) { + if (gRecyclerUsed < MAX_RECYCLED) { + gRecyclerUsed++; + mNext = gRecyclerTop; + gRecyclerTop = this; + } + } + } + + /** + * @hide + */ + @Override + public final void recycleIfNeededAfterDispatch() { + // Do nothing. + } + + /** + * Create a new key event that is the same as the given one, but whose + * event time and repeat count are replaced with the given value. + * + * @param event The existing event to be copied. This is not modified. + * @param eventTime The new event time + * (in {@link android.os.SystemClock#uptimeMillis}) of the event. + * @param newRepeat The new repeat count of the event. + */ + public static KeyEvent changeTimeRepeat(KeyEvent event, long eventTime, + int newRepeat) { + return new KeyEvent(event, eventTime, newRepeat); + } + + /** + * Create a new key event that is the same as the given one, but whose + * event time and repeat count are replaced with the given value. + * + * @param event The existing event to be copied. This is not modified. + * @param eventTime The new event time + * (in {@link android.os.SystemClock#uptimeMillis}) of the event. + * @param newRepeat The new repeat count of the event. + * @param newFlags New flags for the event, replacing the entire value + * in the original event. + */ + public static KeyEvent changeTimeRepeat(KeyEvent event, long eventTime, + int newRepeat, int newFlags) { + KeyEvent ret = new KeyEvent(event); + ret.mEventTime = eventTime; + ret.mRepeatCount = newRepeat; + ret.mFlags = newFlags; + return ret; + } + + /** + * Copy an existing key event, modifying its action. + * + * @param origEvent The existing event to be copied. + * @param action The new action code of the event. + */ + private KeyEvent(KeyEvent origEvent, int action) { + mDownTime = origEvent.mDownTime; + mEventTime = origEvent.mEventTime; + mAction = action; + mKeyCode = origEvent.mKeyCode; + mRepeatCount = origEvent.mRepeatCount; + mMetaState = origEvent.mMetaState; + mDeviceId = origEvent.mDeviceId; + mSource = origEvent.mSource; + mScanCode = origEvent.mScanCode; + mFlags = origEvent.mFlags; + // Don't copy mCharacters, since one way or the other we'll lose it + // when changing the action. + } + + /** + * Create a new key event that is the same as the given one, but whose + * action is replaced with the given value. + * + * @param event The existing event to be copied. This is not modified. + * @param action The new action code of the event. + */ + public static KeyEvent changeAction(KeyEvent event, int action) { + return new KeyEvent(event, action); + } + + /** + * Create a new key event that is the same as the given one, but whose + * flags are replaced with the given value. + * + * @param event The existing event to be copied. This is not modified. + * @param flags The new flags constant. + */ + public static KeyEvent changeFlags(KeyEvent event, int flags) { + event = new KeyEvent(event); + event.mFlags = flags; + return event; + } + + /** + * @hide + */ + @Override + public final boolean isTainted() { + return (mFlags & FLAG_TAINTED) != 0; + } + + /** + * @hide + */ + @Override + public final void setTainted(boolean tainted) { + mFlags = tainted ? mFlags | FLAG_TAINTED : mFlags & ~FLAG_TAINTED; + } + + /** + * Don't use in new code, instead explicitly check + * {@link #getAction()}. + * + * @return If the action is ACTION_DOWN, returns true; else false. + * + * @deprecated + * @hide + */ + @Deprecated + public final boolean isDown() { + return mAction == ACTION_DOWN; + } + + /** + * Is this a system key? System keys can not be used for menu shortcuts. + * + * TODO: this information should come from a table somewhere. + * TODO: should the dpad keys be here? arguably, because they also shouldn't be menu shortcuts + */ + public final boolean isSystem() { + return native_isSystemKey(mKeyCode); + } + + /** + * @hide + */ + public final boolean hasDefaultAction() { + return native_hasDefaultAction(mKeyCode); + } + + /** + * Returns true if the specified keycode is a gamepad button. + * @return True if the keycode is a gamepad button, such as {@link #KEYCODE_BUTTON_A}. + */ + public static final boolean isGamepadButton(int keyCode) { + switch (keyCode) { + case KeyEvent.KEYCODE_BUTTON_A: + case KeyEvent.KEYCODE_BUTTON_B: + case KeyEvent.KEYCODE_BUTTON_C: + case KeyEvent.KEYCODE_BUTTON_X: + case KeyEvent.KEYCODE_BUTTON_Y: + case KeyEvent.KEYCODE_BUTTON_Z: + case KeyEvent.KEYCODE_BUTTON_L1: + case KeyEvent.KEYCODE_BUTTON_R1: + case KeyEvent.KEYCODE_BUTTON_L2: + case KeyEvent.KEYCODE_BUTTON_R2: + case KeyEvent.KEYCODE_BUTTON_THUMBL: + case KeyEvent.KEYCODE_BUTTON_THUMBR: + case KeyEvent.KEYCODE_BUTTON_START: + case KeyEvent.KEYCODE_BUTTON_SELECT: + case KeyEvent.KEYCODE_BUTTON_MODE: + case KeyEvent.KEYCODE_BUTTON_1: + case KeyEvent.KEYCODE_BUTTON_2: + case KeyEvent.KEYCODE_BUTTON_3: + case KeyEvent.KEYCODE_BUTTON_4: + case KeyEvent.KEYCODE_BUTTON_5: + case KeyEvent.KEYCODE_BUTTON_6: + case KeyEvent.KEYCODE_BUTTON_7: + case KeyEvent.KEYCODE_BUTTON_8: + case KeyEvent.KEYCODE_BUTTON_9: + case KeyEvent.KEYCODE_BUTTON_10: + case KeyEvent.KEYCODE_BUTTON_11: + case KeyEvent.KEYCODE_BUTTON_12: + case KeyEvent.KEYCODE_BUTTON_13: + case KeyEvent.KEYCODE_BUTTON_14: + case KeyEvent.KEYCODE_BUTTON_15: + case KeyEvent.KEYCODE_BUTTON_16: + return true; + default: + return false; + } + } + + /** + * Whether key will, by default, trigger a click on the focused view. + * @hide + */ + public static final boolean isConfirmKey(int keyCode) { + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + return true; + default: + return false; + } + } + + /** + * {@inheritDoc} + */ + @Override + public final int getDeviceId() { + return mDeviceId; + } + + /** + * {@inheritDoc} + */ + @Override + public final int getSource() { + return mSource; + } + + /** + * {@inheritDoc} + */ + @Override + public final void setSource(int source) { + mSource = source; + } + + /** + *

Returns the state of the meta keys.

+ * + * @return an integer in which each bit set to 1 represents a pressed + * meta key + * + * @see #isAltPressed() + * @see #isShiftPressed() + * @see #isSymPressed() + * @see #isCtrlPressed() + * @see #isMetaPressed() + * @see #isFunctionPressed() + * @see #isCapsLockOn() + * @see #isNumLockOn() + * @see #isScrollLockOn() + * @see #META_ALT_ON + * @see #META_ALT_LEFT_ON + * @see #META_ALT_RIGHT_ON + * @see #META_SHIFT_ON + * @see #META_SHIFT_LEFT_ON + * @see #META_SHIFT_RIGHT_ON + * @see #META_SYM_ON + * @see #META_FUNCTION_ON + * @see #META_CTRL_ON + * @see #META_CTRL_LEFT_ON + * @see #META_CTRL_RIGHT_ON + * @see #META_META_ON + * @see #META_META_LEFT_ON + * @see #META_META_RIGHT_ON + * @see #META_CAPS_LOCK_ON + * @see #META_NUM_LOCK_ON + * @see #META_SCROLL_LOCK_ON + * @see #getModifiers + */ + public final int getMetaState() { + return mMetaState; + } + + /** + * Returns the state of the modifier keys. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, this function specifically masks out + * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}. + *

+ * The value returned consists of the meta state (from {@link #getMetaState}) + * normalized using {@link #normalizeMetaState(int)} and then masked with + * {@link #getModifierMetaStateMask} so that only valid modifier bits are retained. + *

+ * + * @return An integer in which each bit set to 1 represents a pressed modifier key. + * @see #getMetaState + */ + public final int getModifiers() { + return normalizeMetaState(mMetaState) & META_MODIFIER_MASK; + } + + /** + * Returns the flags for this key event. + * + * @see #FLAG_WOKE_HERE + */ + public final int getFlags() { + return mFlags; + } + + // Mask of all modifier key meta states. Specifically excludes locked keys like caps lock. + private static final int META_MODIFIER_MASK = + META_SHIFT_ON | META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON | META_ALT_ON | META_ALT_LEFT_ON | META_ALT_RIGHT_ON | META_CTRL_ON | META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON | META_META_ON | META_META_LEFT_ON | META_META_RIGHT_ON | META_SYM_ON | META_FUNCTION_ON; + + // Mask of all lock key meta states. + private static final int META_LOCK_MASK = + META_CAPS_LOCK_ON | META_NUM_LOCK_ON | META_SCROLL_LOCK_ON; + + // Mask of all valid meta states. + private static final int META_ALL_MASK = META_MODIFIER_MASK | META_LOCK_MASK; + + // Mask of all synthetic meta states that are reserved for API compatibility with + // historical uses in MetaKeyKeyListener. + private static final int META_SYNTHETIC_MASK = + META_CAP_LOCKED | META_ALT_LOCKED | META_SYM_LOCKED | META_SELECTING; + + // Mask of all meta states that are not valid use in specifying a modifier key. + // These bits are known to be used for purposes other than specifying modifiers. + private static final int META_INVALID_MODIFIER_MASK = + META_LOCK_MASK | META_SYNTHETIC_MASK; + + /** + * Gets a mask that includes all valid modifier key meta state bits. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, the mask specifically excludes + * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}. + *

+ * + * @return The modifier meta state mask which is a combination of + * {@link #META_SHIFT_ON}, {@link #META_SHIFT_LEFT_ON}, {@link #META_SHIFT_RIGHT_ON}, + * {@link #META_ALT_ON}, {@link #META_ALT_LEFT_ON}, {@link #META_ALT_RIGHT_ON}, + * {@link #META_CTRL_ON}, {@link #META_CTRL_LEFT_ON}, {@link #META_CTRL_RIGHT_ON}, + * {@link #META_META_ON}, {@link #META_META_LEFT_ON}, {@link #META_META_RIGHT_ON}, + * {@link #META_SYM_ON}, {@link #META_FUNCTION_ON}. + */ + public static int getModifierMetaStateMask() { + return META_MODIFIER_MASK; + } + + /** + * Returns true if this key code is a modifier key. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, this function return false + * for those keys. + *

+ * + * @return True if the key code is one of + * {@link #KEYCODE_SHIFT_LEFT} {@link #KEYCODE_SHIFT_RIGHT}, + * {@link #KEYCODE_ALT_LEFT}, {@link #KEYCODE_ALT_RIGHT}, + * {@link #KEYCODE_CTRL_LEFT}, {@link #KEYCODE_CTRL_RIGHT}, + * {@link #KEYCODE_META_LEFT}, or {@link #KEYCODE_META_RIGHT}, + * {@link #KEYCODE_SYM}, {@link #KEYCODE_NUM}, {@link #KEYCODE_FUNCTION}. + */ + public static boolean isModifierKey(int keyCode) { + switch (keyCode) { + case KEYCODE_SHIFT_LEFT: + case KEYCODE_SHIFT_RIGHT: + case KEYCODE_ALT_LEFT: + case KEYCODE_ALT_RIGHT: + case KEYCODE_CTRL_LEFT: + case KEYCODE_CTRL_RIGHT: + case KEYCODE_META_LEFT: + case KEYCODE_META_RIGHT: + case KEYCODE_SYM: + case KEYCODE_NUM: + case KEYCODE_FUNCTION: + return true; + default: + return false; + } + } + + /** + * Normalizes the specified meta state. + *

+ * The meta state is normalized such that if either the left or right modifier meta state + * bits are set then the result will also include the universal bit for that modifier. + *

+ * If the specified meta state contains {@link #META_ALT_LEFT_ON} then + * the result will also contain {@link #META_ALT_ON} in addition to {@link #META_ALT_LEFT_ON} + * and the other bits that were specified in the input. The same is process is + * performed for shift, control and meta. + *

+ * If the specified meta state contains synthetic meta states defined by + * {@link MetaKeyKeyListener}, then those states are translated here and the original + * synthetic meta states are removed from the result. + * {@link MetaKeyKeyListener#META_CAP_LOCKED} is translated to {@link #META_CAPS_LOCK_ON}. + * {@link MetaKeyKeyListener#META_ALT_LOCKED} is translated to {@link #META_ALT_ON}. + * {@link MetaKeyKeyListener#META_SYM_LOCKED} is translated to {@link #META_SYM_ON}. + *

+ * Undefined meta state bits are removed. + *

+ * + * @param metaState The meta state. + * @return The normalized meta state. + */ + public static int normalizeMetaState(int metaState) { + if ((metaState & (META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON)) != 0) { + metaState |= META_SHIFT_ON; + } + if ((metaState & (META_ALT_LEFT_ON | META_ALT_RIGHT_ON)) != 0) { + metaState |= META_ALT_ON; + } + if ((metaState & (META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON)) != 0) { + metaState |= META_CTRL_ON; + } + if ((metaState & (META_META_LEFT_ON | META_META_RIGHT_ON)) != 0) { + metaState |= META_META_ON; + } +/* if ((metaState & MetaKeyKeyListener.META_CAP_LOCKED) != 0) { + metaState |= META_CAPS_LOCK_ON; + } + if ((metaState & MetaKeyKeyListener.META_ALT_LOCKED) != 0) { + metaState |= META_ALT_ON; + } + if ((metaState & MetaKeyKeyListener.META_SYM_LOCKED) != 0) { + metaState |= META_SYM_ON; + }*/ + return metaState & META_ALL_MASK; + } + + /** + * Returns true if no modifiers keys are pressed according to the specified meta state. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, this function ignores + * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}. + *

+ * The meta state is normalized prior to comparison using {@link #normalizeMetaState(int)}. + *

+ * + * @param metaState The meta state to consider. + * @return True if no modifier keys are pressed. + * @see #hasNoModifiers() + */ + public static boolean metaStateHasNoModifiers(int metaState) { + return (normalizeMetaState(metaState) & META_MODIFIER_MASK) == 0; + } + + /** + * Returns true if only the specified modifier keys are pressed according to + * the specified meta state. Returns false if a different combination of modifier + * keys are pressed. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, this function ignores + * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}. + *

+ * If the specified modifier mask includes directional modifiers, such as + * {@link #META_SHIFT_LEFT_ON}, then this method ensures that the + * modifier is pressed on that side. + * If the specified modifier mask includes non-directional modifiers, such as + * {@link #META_SHIFT_ON}, then this method ensures that the modifier + * is pressed on either side. + * If the specified modifier mask includes both directional and non-directional modifiers + * for the same type of key, such as {@link #META_SHIFT_ON} and {@link #META_SHIFT_LEFT_ON}, + * then this method throws an illegal argument exception. + *

+ * + * @param metaState The meta state to consider. + * @param modifiers The meta state of the modifier keys to check. May be a combination + * of modifier meta states as defined by {@link #getModifierMetaStateMask()}. May be 0 to + * ensure that no modifier keys are pressed. + * @return True if only the specified modifier keys are pressed. + * @throws IllegalArgumentException if the modifiers parameter contains invalid modifiers + * @see #hasModifiers + */ + public static boolean metaStateHasModifiers(int metaState, int modifiers) { + // Note: For forward compatibility, we allow the parameter to contain meta states + // that we do not recognize but we explicitly disallow meta states that + // are not valid modifiers. + if ((modifiers & META_INVALID_MODIFIER_MASK) != 0) { + throw new IllegalArgumentException("modifiers must not contain " + + "META_CAPS_LOCK_ON, META_NUM_LOCK_ON, META_SCROLL_LOCK_ON, " + + "META_CAP_LOCKED, META_ALT_LOCKED, META_SYM_LOCKED, " + + "or META_SELECTING"); + } + + metaState = normalizeMetaState(metaState) & META_MODIFIER_MASK; + metaState = metaStateFilterDirectionalModifiers(metaState, modifiers, + META_SHIFT_ON, META_SHIFT_LEFT_ON, META_SHIFT_RIGHT_ON); + metaState = metaStateFilterDirectionalModifiers(metaState, modifiers, + META_ALT_ON, META_ALT_LEFT_ON, META_ALT_RIGHT_ON); + metaState = metaStateFilterDirectionalModifiers(metaState, modifiers, + META_CTRL_ON, META_CTRL_LEFT_ON, META_CTRL_RIGHT_ON); + metaState = metaStateFilterDirectionalModifiers(metaState, modifiers, + META_META_ON, META_META_LEFT_ON, META_META_RIGHT_ON); + return metaState == modifiers; + } + + private static int metaStateFilterDirectionalModifiers(int metaState, + int modifiers, int basic, int left, int right) { + final boolean wantBasic = (modifiers & basic) != 0; + final int directional = left | right; + final boolean wantLeftOrRight = (modifiers & directional) != 0; + + if (wantBasic) { + if (wantLeftOrRight) { + throw new IllegalArgumentException("modifiers must not contain " + metaStateToString(basic) + " combined with " + metaStateToString(left) + " or " + metaStateToString(right)); + } + return metaState & ~directional; + } else if (wantLeftOrRight) { + return metaState & ~basic; + } else { + return metaState; + } + } + + /** + * Returns true if no modifier keys are pressed. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, this function ignores + * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}. + *

+ * The meta state is normalized prior to comparison using {@link #normalizeMetaState(int)}. + *

+ * + * @return True if no modifier keys are pressed. + * @see #metaStateHasNoModifiers + */ + public final boolean hasNoModifiers() { + return metaStateHasNoModifiers(mMetaState); + } + + /** + * Returns true if only the specified modifiers keys are pressed. + * Returns false if a different combination of modifier keys are pressed. + *

+ * For the purposes of this function, {@link #KEYCODE_CAPS_LOCK}, + * {@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are + * not considered modifier keys. Consequently, this function ignores + * {@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}. + *

+ * If the specified modifier mask includes directional modifiers, such as + * {@link #META_SHIFT_LEFT_ON}, then this method ensures that the + * modifier is pressed on that side. + * If the specified modifier mask includes non-directional modifiers, such as + * {@link #META_SHIFT_ON}, then this method ensures that the modifier + * is pressed on either side. + * If the specified modifier mask includes both directional and non-directional modifiers + * for the same type of key, such as {@link #META_SHIFT_ON} and {@link #META_SHIFT_LEFT_ON}, + * then this method throws an illegal argument exception. + *

+ * + * @param modifiers The meta state of the modifier keys to check. May be a combination + * of modifier meta states as defined by {@link #getModifierMetaStateMask()}. May be 0 to + * ensure that no modifier keys are pressed. + * @return True if only the specified modifier keys are pressed. + * @throws IllegalArgumentException if the modifiers parameter contains invalid modifiers + * @see #metaStateHasModifiers + */ + public final boolean hasModifiers(int modifiers) { + return metaStateHasModifiers(mMetaState, modifiers); + } + + /** + *

Returns the pressed state of the ALT meta key.

+ * + * @return true if the ALT key is pressed, false otherwise + * + * @see #KEYCODE_ALT_LEFT + * @see #KEYCODE_ALT_RIGHT + * @see #META_ALT_ON + */ + public final boolean isAltPressed() { + return (mMetaState & META_ALT_ON) != 0; + } + + /** + *

Returns the pressed state of the SHIFT meta key.

+ * + * @return true if the SHIFT key is pressed, false otherwise + * + * @see #KEYCODE_SHIFT_LEFT + * @see #KEYCODE_SHIFT_RIGHT + * @see #META_SHIFT_ON + */ + public final boolean isShiftPressed() { + return (mMetaState & META_SHIFT_ON) != 0; + } + + /** + *

Returns the pressed state of the SYM meta key.

+ * + * @return true if the SYM key is pressed, false otherwise + * + * @see #KEYCODE_SYM + * @see #META_SYM_ON + */ + public final boolean isSymPressed() { + return (mMetaState & META_SYM_ON) != 0; + } + + /** + *

Returns the pressed state of the CTRL meta key.

+ * + * @return true if the CTRL key is pressed, false otherwise + * + * @see #KEYCODE_CTRL_LEFT + * @see #KEYCODE_CTRL_RIGHT + * @see #META_CTRL_ON + */ + public final boolean isCtrlPressed() { + return (mMetaState & META_CTRL_ON) != 0; + } + + /** + *

Returns the pressed state of the META meta key.

+ * + * @return true if the META key is pressed, false otherwise + * + * @see #KEYCODE_META_LEFT + * @see #KEYCODE_META_RIGHT + * @see #META_META_ON + */ + public final boolean isMetaPressed() { + return (mMetaState & META_META_ON) != 0; + } + + /** + *

Returns the pressed state of the FUNCTION meta key.

+ * + * @return true if the FUNCTION key is pressed, false otherwise + * + * @see #KEYCODE_FUNCTION + * @see #META_FUNCTION_ON + */ + public final boolean isFunctionPressed() { + return (mMetaState & META_FUNCTION_ON) != 0; + } + + /** + *

Returns the locked state of the CAPS LOCK meta key.

+ * + * @return true if the CAPS LOCK key is on, false otherwise + * + * @see #KEYCODE_CAPS_LOCK + * @see #META_CAPS_LOCK_ON + */ + public final boolean isCapsLockOn() { + return (mMetaState & META_CAPS_LOCK_ON) != 0; + } + + /** + *

Returns the locked state of the NUM LOCK meta key.

+ * + * @return true if the NUM LOCK key is on, false otherwise + * + * @see #KEYCODE_NUM_LOCK + * @see #META_NUM_LOCK_ON + */ + public final boolean isNumLockOn() { + return (mMetaState & META_NUM_LOCK_ON) != 0; + } + + /** + *

Returns the locked state of the SCROLL LOCK meta key.

+ * + * @return true if the SCROLL LOCK key is on, false otherwise + * + * @see #KEYCODE_SCROLL_LOCK + * @see #META_SCROLL_LOCK_ON + */ + public final boolean isScrollLockOn() { + return (mMetaState & META_SCROLL_LOCK_ON) != 0; + } + + /** + * Retrieve the action of this key event. May be either + * {@link #ACTION_DOWN}, {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}. + * + * @return The event action: ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. + */ + public final int getAction() { + return mAction; + } + + /** + * For {@link #ACTION_UP} events, indicates that the event has been + * canceled as per {@link #FLAG_CANCELED}. + */ + public final boolean isCanceled() { + return (mFlags & FLAG_CANCELED) != 0; + } + + /** + * Call this during {@link Callback#onKeyDown} to have the system track + * the key through its final up (possibly including a long press). Note + * that only one key can be tracked at a time -- if another key down + * event is received while a previous one is being tracked, tracking is + * stopped on the previous event. + */ + public final void startTracking() { + mFlags |= FLAG_START_TRACKING; + } + + /** + * For {@link #ACTION_UP} events, indicates that the event is still being + * tracked from its initial down event as per + * {@link #FLAG_TRACKING}. + */ + public final boolean isTracking() { + return (mFlags & FLAG_TRACKING) != 0; + } + + /** + * For {@link #ACTION_DOWN} events, indicates that the event has been + * canceled as per {@link #FLAG_LONG_PRESS}. + */ + public final boolean isLongPress() { + return (mFlags & FLAG_LONG_PRESS) != 0; + } + + /** + * Retrieve the key code of the key event. This is the physical key that + * was pressed, not the Unicode character. + * + * @return The key code of the event. + */ + public final int getKeyCode() { + return mKeyCode; + } + + /** + * For the special case of a {@link #ACTION_MULTIPLE} event with key + * code of {@link #KEYCODE_UNKNOWN}, this is a raw string of characters + * associated with the event. In all other cases it is null. + * + * @return Returns a String of 1 or more characters associated with + * the event. + */ + public final String getCharacters() { + return mCharacters; + } + + /** + * Retrieve the hardware key id of this key event. These values are not + * reliable and vary from device to device. + * + * {@more} + * Mostly this is here for debugging purposes. + */ + public final int getScanCode() { + return mScanCode; + } + + /** + * Retrieve the repeat count of the event. For both key up and key down + * events, this is the number of times the key has repeated with the first + * down starting at 0 and counting up from there. For multiple key + * events, this is the number of down/up pairs that have occurred. + * + * @return The number of times the key has repeated. + */ + public final int getRepeatCount() { + return mRepeatCount; + } + + /** + * Retrieve the time of the most recent key down event, + * in the {@link android.os.SystemClock#uptimeMillis} time base. If this + * is a down event, this will be the same as {@link #getEventTime()}. + * Note that when chording keys, this value is the down time of the + * most recently pressed key, which may not be the same physical + * key of this event. + * + * @return Returns the most recent key down time, in the + * {@link android.os.SystemClock#uptimeMillis} time base + */ + public final long getDownTime() { + return mDownTime; + } + + /** + * Retrieve the time this event occurred, + * in the {@link android.os.SystemClock#uptimeMillis} time base. + * + * @return Returns the time this event occurred, + * in the {@link android.os.SystemClock#uptimeMillis} time base. + */ + @Override + public final long getEventTime() { + return mEventTime; + } + + /** + * Retrieve the time this event occurred, + * in the {@link android.os.SystemClock#uptimeMillis} time base but with + * nanosecond (instead of millisecond) precision. + *

+ * The value is in nanosecond precision but it may not have nanosecond accuracy. + *

+ * + * @return Returns the time this event occurred, + * in the {@link android.os.SystemClock#uptimeMillis} time base but with + * nanosecond (instead of millisecond) precision. + * + * @hide + */ + @Override + public final long getEventTimeNano() { + return mEventTime * 1000000L; + } + + /** + * Renamed to {@link #getDeviceId}. + * + * @hide + * @deprecated use {@link #getDeviceId()} instead. + */ + @Deprecated + public final int getKeyboardDevice() { + return mDeviceId; + } + + /** + * Gets the {@link KeyCharacterMap} associated with the keyboard device. + * + * @return The associated key character map. + * @throws {@link KeyCharacterMap.UnavailableException} if the key character map + * could not be loaded because it was malformed or the default key character map + * is missing from the system. + * + * @see KeyCharacterMap#load + */ + public final KeyCharacterMap getKeyCharacterMap() { + return KeyCharacterMap.load(mDeviceId); + } + + /** + * Gets the primary character for this key. + * In other words, the label that is physically printed on it. + * + * @return The display label character, or 0 if none (eg. for non-printing keys). + */ + public char getDisplayLabel() { + return getKeyCharacterMap().getDisplayLabel(mKeyCode); + } + + /** + * Gets the Unicode character generated by the specified key and meta + * key state combination. + *

+ * Returns the Unicode character that the specified key would produce + * when the specified meta bits (see {@link MetaKeyKeyListener}) + * were active. + *

+ * Returns 0 if the key is not one that is used to type Unicode + * characters. + *

+ * If the return value has bit {@link KeyCharacterMap#COMBINING_ACCENT} set, the + * key is a "dead key" that should be combined with another to + * actually produce a character -- see {@link KeyCharacterMap#getDeadChar} -- + * after masking with {@link KeyCharacterMap#COMBINING_ACCENT_MASK}. + *

+ * + * @return The associated character or combining accent, or 0 if none. + */ + public int getUnicodeChar() { + return getUnicodeChar(mMetaState); + } + + /** + * Gets the Unicode character generated by the specified key and meta + * key state combination. + *

+ * Returns the Unicode character that the specified key would produce + * when the specified meta bits (see {@link MetaKeyKeyListener}) + * were active. + *

+ * Returns 0 if the key is not one that is used to type Unicode + * characters. + *

+ * If the return value has bit {@link KeyCharacterMap#COMBINING_ACCENT} set, the + * key is a "dead key" that should be combined with another to + * actually produce a character -- see {@link KeyCharacterMap#getDeadChar} -- + * after masking with {@link KeyCharacterMap#COMBINING_ACCENT_MASK}. + *

+ * + * @param metaState The meta key modifier state. + * @return The associated character or combining accent, or 0 if none. + */ + public int getUnicodeChar(int metaState) { + return getKeyCharacterMap().get(mKeyCode, metaState); + } + + /** + * Get the character conversion data for a given key code. + * + * @param results A {@link KeyCharacterMap.KeyData} instance that will be + * filled with the results. + * @return True if the key was mapped. If the key was not mapped, results is not modified. + * + * @deprecated instead use {@link #getDisplayLabel()}, + * {@link #getNumber()} or {@link #getUnicodeChar(int)}. + */ + @Deprecated + public boolean getKeyData(KeyData results) { + return getKeyCharacterMap().getKeyData(mKeyCode, results); + } + + /** + * Gets the first character in the character array that can be generated + * by the specified key code. + *

+ * This is a convenience function that returns the same value as + * {@link #getMatch(char[],int) getMatch(chars, 0)}. + *

+ * + * @param chars The array of matching characters to consider. + * @return The matching associated character, or 0 if none. + */ + public char getMatch(char[] chars) { + return getMatch(chars, 0); + } + + /** + * Gets the first character in the character array that can be generated + * by the specified key code. If there are multiple choices, prefers + * the one that would be generated with the specified meta key modifier state. + * + * @param chars The array of matching characters to consider. + * @param metaState The preferred meta key modifier state. + * @return The matching associated character, or 0 if none. + */ + public char getMatch(char[] chars, int metaState) { + return getKeyCharacterMap().getMatch(mKeyCode, chars, metaState); + } + + /** + * Gets the number or symbol associated with the key. + *

+ * The character value is returned, not the numeric value. + * If the key is not a number, but is a symbol, the symbol is retuned. + *

+ * This method is intended to to support dial pads and other numeric or + * symbolic entry on keyboards where certain keys serve dual function + * as alphabetic and symbolic keys. This method returns the number + * or symbol associated with the key independent of whether the user + * has pressed the required modifier. + *

+ * For example, on one particular keyboard the keys on the top QWERTY row generate + * numbers when ALT is pressed such that ALT-Q maps to '1'. So for that keyboard + * when {@link #getNumber} is called with {@link KeyEvent#KEYCODE_Q} it returns '1' + * so that the user can type numbers without pressing ALT when it makes sense. + *

+ * + * @return The associated numeric or symbolic character, or 0 if none. + */ + public char getNumber() { + return getKeyCharacterMap().getNumber(mKeyCode); + } + + /** + * Returns true if this key produces a glyph. + * + * @return True if the key is a printing key. + */ + public boolean isPrintingKey() { + return getKeyCharacterMap().isPrintingKey(mKeyCode); + } + + /** + * @deprecated Use {@link #dispatch(Callback, DispatcherState, Object)} instead. + */ + @Deprecated + public final boolean dispatch(Callback receiver) { + return dispatch(receiver, null, null); + } + + /** + * Deliver this key event to a {@link Callback} interface. If this is + * an ACTION_MULTIPLE event and it is not handled, then an attempt will + * be made to deliver a single normal event. + * + * @param receiver The Callback that will be given the event. + * @param state State information retained across events. + * @param target The target of the dispatch, for use in tracking. + * + * @return The return value from the Callback method that was called. + */ + public final boolean dispatch(Callback receiver, DispatcherState state, + Object target) { + switch (mAction) { + case ACTION_DOWN: { + mFlags &= ~FLAG_START_TRACKING; + if (DEBUG) + Log.v(TAG, "Key down to " + target + " in " + state + ": " + this); + boolean res = receiver.onKeyDown(mKeyCode, this); + if (state != null) { + if (res && mRepeatCount == 0 && (mFlags & FLAG_START_TRACKING) != 0) { + if (DEBUG) + Log.v(TAG, " Start tracking!"); + state.startTracking(this, target); + } else if (isLongPress() && state.isTracking(this)) { + try { + if (receiver.onKeyLongPress(mKeyCode, this)) { + if (DEBUG) + Log.v(TAG, " Clear from long press!"); + state.performedLongPress(this); + res = true; + } + } catch (AbstractMethodError e) { + } + } + } + return res; + } + case ACTION_UP: + if (DEBUG) + Log.v(TAG, "Key up to " + target + " in " + state + ": " + this); + if (state != null) { + state.handleUpEvent(this); + } + return receiver.onKeyUp(mKeyCode, this); + case ACTION_MULTIPLE: + final int count = mRepeatCount; + final int code = mKeyCode; + if (receiver.onKeyMultiple(code, count, this)) { + return true; + } + if (code != KeyEvent.KEYCODE_UNKNOWN) { + mAction = ACTION_DOWN; + mRepeatCount = 0; + boolean handled = receiver.onKeyDown(code, this); + if (handled) { + mAction = ACTION_UP; + receiver.onKeyUp(code, this); + } + mAction = ACTION_MULTIPLE; + mRepeatCount = count; + return handled; + } + return false; + } + return false; + } + + /** + * Use with {@link KeyEvent#dispatch(Callback, DispatcherState, Object)} + * for more advanced key dispatching, such as long presses. + */ + public static class DispatcherState { + int mDownKeyCode; + Object mDownTarget; + SparseIntArray mActiveLongPresses = new SparseIntArray(); + + /** + * Reset back to initial state. + */ + public void reset() { + if (DEBUG) + Log.v(TAG, "Reset: " + this); + mDownKeyCode = 0; + mDownTarget = null; + mActiveLongPresses.clear(); + } + + /** + * Stop any tracking associated with this target. + */ + public void reset(Object target) { + if (mDownTarget == target) { + if (DEBUG) + Log.v(TAG, "Reset in " + target + ": " + this); + mDownKeyCode = 0; + mDownTarget = null; + } + } + + /** + * Start tracking the key code associated with the given event. This + * can only be called on a key down. It will allow you to see any + * long press associated with the key, and will result in + * {@link KeyEvent#isTracking} return true on the long press and up + * events. + * + *

This is only needed if you are directly dispatching events, rather + * than handling them in {@link Callback#onKeyDown}. + */ + public void startTracking(KeyEvent event, Object target) { + if (event.getAction() != ACTION_DOWN) { + throw new IllegalArgumentException( + "Can only start tracking on a down event"); + } + if (DEBUG) + Log.v(TAG, "Start trackingt in " + target + ": " + this); + mDownKeyCode = event.getKeyCode(); + mDownTarget = target; + } + + /** + * Return true if the key event is for a key code that is currently + * being tracked by the dispatcher. + */ + public boolean isTracking(KeyEvent event) { + return mDownKeyCode == event.getKeyCode(); + } + + /** + * Keep track of the given event's key code as having performed an + * action with a long press, so no action should occur on the up. + *

This is only needed if you are directly dispatching events, rather + * than handling them in {@link Callback#onKeyLongPress}. + */ + public void performedLongPress(KeyEvent event) { + mActiveLongPresses.put(event.getKeyCode(), 1); + } + + /** + * Handle key up event to stop tracking. This resets the dispatcher state, + * and updates the key event state based on it. + *

This is only needed if you are directly dispatching events, rather + * than handling them in {@link Callback#onKeyUp}. + */ + public void handleUpEvent(KeyEvent event) { + final int keyCode = event.getKeyCode(); + if (DEBUG) + Log.v(TAG, "Handle key up " + event + ": " + this); + int index = mActiveLongPresses.indexOfKey(keyCode); + if (index >= 0) { + if (DEBUG) + Log.v(TAG, " Index: " + index); + event.mFlags |= FLAG_CANCELED | FLAG_CANCELED_LONG_PRESS; + mActiveLongPresses.removeAt(index); + } + if (mDownKeyCode == keyCode) { + if (DEBUG) + Log.v(TAG, " Tracking!"); + event.mFlags |= FLAG_TRACKING; + mDownKeyCode = 0; + mDownTarget = null; + } + } + } + + @Override + public String toString() { + StringBuilder msg = new StringBuilder(); + msg.append("KeyEvent { action=").append(actionToString(mAction)); + msg.append(", keyCode=").append(keyCodeToString(mKeyCode)); + msg.append(", scanCode=").append(mScanCode); + if (mCharacters != null) { + msg.append(", characters=\"").append(mCharacters).append("\""); + } + msg.append(", metaState=").append(metaStateToString(mMetaState)); + msg.append(", flags=0x").append(Integer.toHexString(mFlags)); + msg.append(", repeatCount=").append(mRepeatCount); + msg.append(", eventTime=").append(mEventTime); + msg.append(", downTime=").append(mDownTime); + msg.append(", deviceId=").append(mDeviceId); + msg.append(", source=0x").append(Integer.toHexString(mSource)); + msg.append(" }"); + return msg.toString(); + } + + /** + * Returns a string that represents the symbolic name of the specified action + * such as "ACTION_DOWN", or an equivalent numeric constant such as "35" if unknown. + * + * @param action The action. + * @return The symbolic name of the specified action. + * @hide + */ + public static String actionToString(int action) { + switch (action) { + case ACTION_DOWN: + return "ACTION_DOWN"; + case ACTION_UP: + return "ACTION_UP"; + case ACTION_MULTIPLE: + return "ACTION_MULTIPLE"; + default: + return Integer.toString(action); + } + } + + /** + * Returns a string that represents the symbolic name of the specified keycode + * such as "KEYCODE_A", "KEYCODE_DPAD_UP", or an equivalent numeric constant + * such as "1001" if unknown. + * + * @param keyCode The key code. + * @return The symbolic name of the specified keycode. + * + * @see KeyCharacterMap#getDisplayLabel + */ + public static String keyCodeToString(int keyCode) { + String symbolicName = KEYCODE_SYMBOLIC_NAMES.get(keyCode); + return symbolicName != null ? symbolicName : Integer.toString(keyCode); + } + + /** + * Gets a keycode by its symbolic name such as "KEYCODE_A" or an equivalent + * numeric constant such as "1001". + * + * @param symbolicName The symbolic name of the keycode. + * @return The keycode or {@link #KEYCODE_UNKNOWN} if not found. + * @see #keycodeToString(int) + */ + public static int keyCodeFromString(String symbolicName) { + if (symbolicName == null) { + throw new IllegalArgumentException("symbolicName must not be null"); + } + + final int count = KEYCODE_SYMBOLIC_NAMES.size(); + for (int i = 0; i < count; i++) { + if (symbolicName.equals(KEYCODE_SYMBOLIC_NAMES.valueAt(i))) { + return i; + } + } + + try { + return Integer.parseInt(symbolicName, 10); + } catch (NumberFormatException ex) { + return KEYCODE_UNKNOWN; + } + } + + /** + * Returns a string that represents the symbolic name of the specified combined meta + * key modifier state flags such as "0", "META_SHIFT_ON", + * "META_ALT_ON|META_SHIFT_ON" or an equivalent numeric constant such as "0x10000000" + * if unknown. + * + * @param metaState The meta state. + * @return The symbolic name of the specified combined meta state flags. + * @hide + */ + public static String metaStateToString(int metaState) { + if (metaState == 0) { + return "0"; + } + StringBuilder result = null; + int i = 0; + while (metaState != 0) { + final boolean isSet = (metaState & 1) != 0; + metaState >>>= 1; // unsigned shift! + if (isSet) { + final String name = META_SYMBOLIC_NAMES[i]; + if (result == null) { + if (metaState == 0) { + return name; + } + result = new StringBuilder(name); + } else { + result.append('|'); + result.append(name); + } + } + i += 1; + } + return result.toString(); + } + + private native boolean native_isSystemKey(int keyCode); + private native boolean native_hasDefaultAction(int keyCode); +} diff --git a/src/api-impl/android/view/View.java b/src/api-impl/android/view/View.java index 74ab6833..6625a7cf 100644 --- a/src/api-impl/android/view/View.java +++ b/src/api-impl/android/view/View.java @@ -501,6 +501,58 @@ public class View extends Object { */ static final int PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK = 0x0000000C << PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT; + // --- apparently there's more... + + @Deprecated public static final int STATUS_BAR_HIDDEN = 1; // 0x1 + + @Deprecated public static final int STATUS_BAR_VISIBLE = 0; // 0x0 + + public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4 + + public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2 + + public static final int SYSTEM_UI_FLAG_IMMERSIVE = 2048; // 0x800 + + public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 4096; // 0x1000 + + public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 + + public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 + + public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 + + public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 + + public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 + + public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 + + public static final int TEXT_ALIGNMENT_CENTER = 4; // 0x4 + + public static final int TEXT_ALIGNMENT_GRAVITY = 1; // 0x1 + + public static final int TEXT_ALIGNMENT_INHERIT = 0; // 0x0 + + public static final int TEXT_ALIGNMENT_TEXT_END = 3; // 0x3 + + public static final int TEXT_ALIGNMENT_TEXT_START = 2; // 0x2 + + public static final int TEXT_ALIGNMENT_VIEW_END = 6; // 0x6 + + public static final int TEXT_ALIGNMENT_VIEW_START = 5; // 0x5 + + public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2 + + public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1 + + public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0 + + public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5 + + public static final int TEXT_DIRECTION_LTR = 3; // 0x3 + + public static final int TEXT_DIRECTION_RTL = 4; // 0x4 + // --- end of constants from android source // --- interfaces from android source @@ -538,6 +590,19 @@ public class View extends Object { // boolean onKey(View v, int keyCode, KeyEvent event); } + public interface OnCreateContextMenuListener { + /** + * Called when the context menu for this view is being built. It is not + * safe to hold onto the menu after this method returns. + * + * @param menu The context menu that is being built + * @param v The view for which the context menu is being built + * @param menuInfo Extra information about the item for which the + * context menu should be shown. This information will vary + * depending on the class of v. + */ +// void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo); + } // --- end of interfaces // --- subclasses @@ -677,6 +742,7 @@ public class View extends Object { // --- end of subclasses public int id; + private int system_ui_visibility = 0; public ViewGroup parent; public AttributeSet attrs; protected ViewGroup.LayoutParams layout_params; @@ -787,7 +853,12 @@ public class View extends Object { return true; } - public void setSystemUiVisibility(int visibility) {} + public void setSystemUiVisibility(int visibility) { + system_ui_visibility = visibility; + } + public int getSystemUiVisibility() { + return system_ui_visibility; + }; protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {} diff --git a/src/api-impl/com/google/android/vending/expansion/downloader/IDownloaderClient.java b/src/api-impl/com/google/android/vending/expansion/downloader/IDownloaderClient.java new file mode 100644 index 00000000..e4e1ffc9 --- /dev/null +++ b/src/api-impl/com/google/android/vending/expansion/downloader/IDownloaderClient.java @@ -0,0 +1,3 @@ +package com.google.android.vending.expansion.downloader; + +public interface IDownloaderClient {} diff --git a/src/api-impl/com/google/android/vending/expansion/downloader/impl/DownloaderService.java b/src/api-impl/com/google/android/vending/expansion/downloader/impl/DownloaderService.java new file mode 100644 index 00000000..b28ef284 --- /dev/null +++ b/src/api-impl/com/google/android/vending/expansion/downloader/impl/DownloaderService.java @@ -0,0 +1,5 @@ +package com.google.android.vending.expansion.downloader.impl; + +public abstract class DownloaderService { + +} diff --git a/src/api-impl/meson.build b/src/api-impl/meson.build index 4b853470..606cb8bc 100644 --- a/src/api-impl/meson.build +++ b/src/api-impl/meson.build @@ -131,6 +131,7 @@ hax_jar = jar('hax', [ 'android/os/Handler.java', 'android/os/HandlerThread.java', 'android/os/IBinder.java', + 'android/os/IInterface.java', 'android/os/IMessenger.java', 'android/os/Looper.java', 'android/os/MemoryFile.java', @@ -204,6 +205,8 @@ hax_jar = jar('hax', [ 'android/view/InputQueue.java', 'android/view/inputmethod/BaseInputConnection.java', 'android/view/inputmethod/InputConnection.java', + 'android/view/KeyCharacterMap.java', + 'android/view/KeyEvent.java', 'android/view/LayoutInflater.java', 'android/view/Menu.java', 'android/view/MotionEvent.java', @@ -241,6 +244,8 @@ hax_jar = jar('hax', [ 'com/android/internal/util/XmlUtils.java', 'com/google/android/gles_jni/EGLImpl.java', 'com/google/android/gles_jni/GLImpl.java', + 'com/google/android/vending/expansion/downloader/IDownloaderClient.java', + 'com/google/android/vending/expansion/downloader/impl/DownloaderService.java', 'com/google/android/vending/licensing/LicenseCheckerCallback.java', 'com/google/android/vending/licensing/LicenseChecker.java', 'com/google/android/vending/licensing/Policy.java',