Add initial gamepad support.

Change-Id: Ide1922ea36f8b64100b4dba57e718479b8a0bec5
diff --git a/ndk/platforms/android-9/arch-arm/usr/include/android/input.h b/ndk/platforms/android-9/arch-arm/usr/include/android/input.h
index 014b6a3..25dd68e 100644
--- a/ndk/platforms/android-9/arch-arm/usr/include/android/input.h
+++ b/ndk/platforms/android-9/arch-arm/usr/include/android/input.h
@@ -68,7 +68,10 @@
     INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010,
 
     /* The input device is a directional pad. */
-    INPUT_DEVICE_CLASS_DPAD          = 0x00000020
+    INPUT_DEVICE_CLASS_DPAD          = 0x00000020,
+
+    /* The input device is a gamepad (implies keyboard). */
+    INPUT_DEVICE_CLASS_GAMEPAD       = 0x00000040
 };
 
 /*
diff --git a/ndk/platforms/android-9/arch-arm/usr/include/android/keycodes.h b/ndk/platforms/android-9/arch-arm/usr/include/android/keycodes.h
index 36855c5..496eccc 100644
--- a/ndk/platforms/android-9/arch-arm/usr/include/android/keycodes.h
+++ b/ndk/platforms/android-9/arch-arm/usr/include/android/keycodes.h
@@ -41,114 +41,122 @@
 
 /*
  * Key codes.
- *
- * XXX: The declarations in <ui/KeycodeLabel.h> should be updated to use these instead.
- *      We should probably move this into android/keycodes.h and add some new API for
- *      getting labels so that we can remove the other tables also in KeycodeLabel.h.
  */
 enum {
-    KEYCODE_UNKNOWN         = 0,
-    KEYCODE_SOFT_LEFT       = 1,
-    KEYCODE_SOFT_RIGHT      = 2,
-    KEYCODE_HOME            = 3,
-    KEYCODE_BACK            = 4,
-    KEYCODE_CALL            = 5,
-    KEYCODE_ENDCALL         = 6,
-    KEYCODE_0               = 7,
-    KEYCODE_1               = 8,
-    KEYCODE_2               = 9,
-    KEYCODE_3               = 10,
-    KEYCODE_4               = 11,
-    KEYCODE_5               = 12,
-    KEYCODE_6               = 13,
-    KEYCODE_7               = 14,
-    KEYCODE_8               = 15,
-    KEYCODE_9               = 16,
-    KEYCODE_STAR            = 17,
-    KEYCODE_POUND           = 18,
-    KEYCODE_DPAD_UP         = 19,
-    KEYCODE_DPAD_DOWN       = 20,
-    KEYCODE_DPAD_LEFT       = 21,
-    KEYCODE_DPAD_RIGHT      = 22,
-    KEYCODE_DPAD_CENTER     = 23,
-    KEYCODE_VOLUME_UP       = 24,
-    KEYCODE_VOLUME_DOWN     = 25,
-    KEYCODE_POWER           = 26,
-    KEYCODE_CAMERA          = 27,
-    KEYCODE_CLEAR           = 28,
-    KEYCODE_A               = 29,
-    KEYCODE_B               = 30,
-    KEYCODE_C               = 31,
-    KEYCODE_D               = 32,
-    KEYCODE_E               = 33,
-    KEYCODE_F               = 34,
-    KEYCODE_G               = 35,
-    KEYCODE_H               = 36,
-    KEYCODE_I               = 37,
-    KEYCODE_J               = 38,
-    KEYCODE_K               = 39,
-    KEYCODE_L               = 40,
-    KEYCODE_M               = 41,
-    KEYCODE_N               = 42,
-    KEYCODE_O               = 43,
-    KEYCODE_P               = 44,
-    KEYCODE_Q               = 45,
-    KEYCODE_R               = 46,
-    KEYCODE_S               = 47,
-    KEYCODE_T               = 48,
-    KEYCODE_U               = 49,
-    KEYCODE_V               = 50,
-    KEYCODE_W               = 51,
-    KEYCODE_X               = 52,
-    KEYCODE_Y               = 53,
-    KEYCODE_Z               = 54,
-    KEYCODE_COMMA           = 55,
-    KEYCODE_PERIOD          = 56,
-    KEYCODE_ALT_LEFT        = 57,
-    KEYCODE_ALT_RIGHT       = 58,
-    KEYCODE_SHIFT_LEFT      = 59,
-    KEYCODE_SHIFT_RIGHT     = 60,
-    KEYCODE_TAB             = 61,
-    KEYCODE_SPACE           = 62,
-    KEYCODE_SYM             = 63,
-    KEYCODE_EXPLORER        = 64,
-    KEYCODE_ENVELOPE        = 65,
-    KEYCODE_ENTER           = 66,
-    KEYCODE_DEL             = 67,
-    KEYCODE_GRAVE           = 68,
-    KEYCODE_MINUS           = 69,
-    KEYCODE_EQUALS          = 70,
-    KEYCODE_LEFT_BRACKET    = 71,
-    KEYCODE_RIGHT_BRACKET   = 72,
-    KEYCODE_BACKSLASH       = 73,
-    KEYCODE_SEMICOLON       = 74,
-    KEYCODE_APOSTROPHE      = 75,
-    KEYCODE_SLASH           = 76,
-    KEYCODE_AT              = 77,
-    KEYCODE_NUM             = 78,
-    KEYCODE_HEADSETHOOK     = 79,
-    KEYCODE_FOCUS           = 80,   // *Camera* focus
-    KEYCODE_PLUS            = 81,
-    KEYCODE_MENU            = 82,
-    KEYCODE_NOTIFICATION    = 83,
-    KEYCODE_SEARCH          = 84,
-    KEYCODE_MEDIA_PLAY_PAUSE= 85,
-    KEYCODE_MEDIA_STOP      = 86,
-    KEYCODE_MEDIA_NEXT      = 87,
-    KEYCODE_MEDIA_PREVIOUS  = 88,
-    KEYCODE_MEDIA_REWIND    = 89,
-    KEYCODE_MEDIA_FAST_FORWARD = 90,
-    KEYCODE_MUTE            = 91,
-    KEYCODE_PAGE_UP         = 92,
-    KEYCODE_PAGE_DOWN       = 93
+    AKEYCODE_UNKNOWN         = 0,
+    AKEYCODE_SOFT_LEFT       = 1,
+    AKEYCODE_SOFT_RIGHT      = 2,
+    AKEYCODE_HOME            = 3,
+    AKEYCODE_BACK            = 4,
+    AKEYCODE_CALL            = 5,
+    AKEYCODE_ENDCALL         = 6,
+    AKEYCODE_0               = 7,
+    AKEYCODE_1               = 8,
+    AKEYCODE_2               = 9,
+    AKEYCODE_3               = 10,
+    AKEYCODE_4               = 11,
+    AKEYCODE_5               = 12,
+    AKEYCODE_6               = 13,
+    AKEYCODE_7               = 14,
+    AKEYCODE_8               = 15,
+    AKEYCODE_9               = 16,
+    AKEYCODE_STAR            = 17,
+    AKEYCODE_POUND           = 18,
+    AKEYCODE_DPAD_UP         = 19,
+    AKEYCODE_DPAD_DOWN       = 20,
+    AKEYCODE_DPAD_LEFT       = 21,
+    AKEYCODE_DPAD_RIGHT      = 22,
+    AKEYCODE_DPAD_CENTER     = 23,
+    AKEYCODE_VOLUME_UP       = 24,
+    AKEYCODE_VOLUME_DOWN     = 25,
+    AKEYCODE_POWER           = 26,
+    AKEYCODE_CAMERA          = 27,
+    AKEYCODE_CLEAR           = 28,
+    AKEYCODE_A               = 29,
+    AKEYCODE_B               = 30,
+    AKEYCODE_C               = 31,
+    AKEYCODE_D               = 32,
+    AKEYCODE_E               = 33,
+    AKEYCODE_F               = 34,
+    AKEYCODE_G               = 35,
+    AKEYCODE_H               = 36,
+    AKEYCODE_I               = 37,
+    AKEYCODE_J               = 38,
+    AKEYCODE_K               = 39,
+    AKEYCODE_L               = 40,
+    AKEYCODE_M               = 41,
+    AKEYCODE_N               = 42,
+    AKEYCODE_O               = 43,
+    AKEYCODE_P               = 44,
+    AKEYCODE_Q               = 45,
+    AKEYCODE_R               = 46,
+    AKEYCODE_S               = 47,
+    AKEYCODE_T               = 48,
+    AKEYCODE_U               = 49,
+    AKEYCODE_V               = 50,
+    AKEYCODE_W               = 51,
+    AKEYCODE_X               = 52,
+    AKEYCODE_Y               = 53,
+    AKEYCODE_Z               = 54,
+    AKEYCODE_COMMA           = 55,
+    AKEYCODE_PERIOD          = 56,
+    AKEYCODE_ALT_LEFT        = 57,
+    AKEYCODE_ALT_RIGHT       = 58,
+    AKEYCODE_SHIFT_LEFT      = 59,
+    AKEYCODE_SHIFT_RIGHT     = 60,
+    AKEYCODE_TAB             = 61,
+    AKEYCODE_SPACE           = 62,
+    AKEYCODE_SYM             = 63,
+    AKEYCODE_EXPLORER        = 64,
+    AKEYCODE_ENVELOPE        = 65,
+    AKEYCODE_ENTER           = 66,
+    AKEYCODE_DEL             = 67,
+    AKEYCODE_GRAVE           = 68,
+    AKEYCODE_MINUS           = 69,
+    AKEYCODE_EQUALS          = 70,
+    AKEYCODE_LEFT_BRACKET    = 71,
+    AKEYCODE_RIGHT_BRACKET   = 72,
+    AKEYCODE_BACKSLASH       = 73,
+    AKEYCODE_SEMICOLON       = 74,
+    AKEYCODE_APOSTROPHE      = 75,
+    AKEYCODE_SLASH           = 76,
+    AKEYCODE_AT              = 77,
+    AKEYCODE_NUM             = 78,
+    AKEYCODE_HEADSETHOOK     = 79,
+    AKEYCODE_FOCUS           = 80,   // *Camera* focus
+    AKEYCODE_PLUS            = 81,
+    AKEYCODE_MENU            = 82,
+    AKEYCODE_NOTIFICATION    = 83,
+    AKEYCODE_SEARCH          = 84,
+    AKEYCODE_MEDIA_PLAY_PAUSE= 85,
+    AKEYCODE_MEDIA_STOP      = 86,
+    AKEYCODE_MEDIA_NEXT      = 87,
+    AKEYCODE_MEDIA_PREVIOUS  = 88,
+    AKEYCODE_MEDIA_REWIND    = 89,
+    AKEYCODE_MEDIA_FAST_FORWARD = 90,
+    AKEYCODE_MUTE            = 91,
+    AKEYCODE_PAGE_UP         = 92,
+    AKEYCODE_PAGE_DOWN       = 93,
+    AKEYCODE_PICTSYMBOLS     = 94,
+    AKEYCODE_SWITCH_CHARSET  = 95,
+    AKEYCODE_BUTTON_A        = 96,
+    AKEYCODE_BUTTON_B        = 97,
+    AKEYCODE_BUTTON_C        = 98,
+    AKEYCODE_BUTTON_X        = 99,
+    AKEYCODE_BUTTON_Y        = 100,
+    AKEYCODE_BUTTON_Z        = 101,
+    AKEYCODE_BUTTON_L1       = 102,
+    AKEYCODE_BUTTON_R1       = 103,
+    AKEYCODE_BUTTON_L2       = 104,
+    AKEYCODE_BUTTON_R2       = 105,
+    AKEYCODE_BUTTON_THUMBL   = 106,
+    AKEYCODE_BUTTON_THUMBR   = 107,
+    AKEYCODE_BUTTON_START    = 108,
+    AKEYCODE_BUTTON_SELECT   = 109,
+    AKEYCODE_BUTTON_MODE     = 110,
 
-    /* NOTE: If you add a new keycode here you must also add it to:
-     *  native/include/android/keycodes.h
-     *  frameworks/base/include/ui/KeycodeLabels.h
-     *   frameworks/base/core/java/android/view/KeyEvent.java
-     *   tools/puppet_master/PuppetMaster.nav_keys.py
-     *   frameworks/base/core/res/res/values/attrs.xml
-     */
+    // NOTE: If you add a new keycode here you must also add it to several other files.
+    //       Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
 };
 
 #ifdef __cplusplus
diff --git a/ndk/platforms/android-9/arch-arm/usr/lib/libthreaded_app.a b/ndk/platforms/android-9/arch-arm/usr/lib/libthreaded_app.a
index 6c6589f..ad55439 100644
--- a/ndk/platforms/android-9/arch-arm/usr/lib/libthreaded_app.a
+++ b/ndk/platforms/android-9/arch-arm/usr/lib/libthreaded_app.a
Binary files differ