diff options
-rw-r--r-- | api/current.txt | 2 | ||||
-rw-r--r-- | core/java/android/view/KeyEvent.java | 10 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 2 | ||||
-rw-r--r-- | data/keyboards/Generic.kl | 7 | ||||
-rw-r--r-- | data/keyboards/Vendor_05ac_Product_0239.kl | 4 | ||||
-rw-r--r-- | include/androidfw/KeycodeLabels.h | 2 | ||||
-rw-r--r-- | libs/androidfw/Input.cpp | 4 |
7 files changed, 26 insertions, 5 deletions
diff --git a/api/current.txt b/api/current.txt index b38fd60..e7d1d54 100644 --- a/api/current.txt +++ b/api/current.txt @@ -24186,6 +24186,8 @@ package android.view { field public static final int KEYCODE_BACKSLASH = 73; // 0x49 field public static final int KEYCODE_BOOKMARK = 174; // 0xae field public static final int KEYCODE_BREAK = 121; // 0x79 + field public static final int KEYCODE_BRIGHTNESS_DOWN = 220; // 0xdc + field public static final int KEYCODE_BRIGHTNESS_UP = 221; // 0xdd field public static final int KEYCODE_BUTTON_1 = 188; // 0xbc field public static final int KEYCODE_BUTTON_10 = 197; // 0xc5 field public static final int KEYCODE_BUTTON_11 = 198; // 0xc6 diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index af818fa..bb533bf 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -623,8 +623,14 @@ public class KeyEvent extends InputEvent implements Parcelable { /** 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; - private static final int LAST_KEYCODE = KEYCODE_ASSIST; + private static final int LAST_KEYCODE = KEYCODE_BRIGHTNESS_UP; // NOTE: If you add a new keycode here you must also add it to: // isSystem() @@ -866,6 +872,8 @@ public class KeyEvent extends InputEvent implements Parcelable { 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"); }; // Symbolic names of all metakeys in bit order from least significant to most significant. diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index cdf0d7e..0fb8a10 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1542,6 +1542,8 @@ <enum name="KEYCODE_RO" value="217" /> <enum name="KEYCODE_KANA" value="218" /> <enum name="KEYCODE_ASSIST" value="219" /> + <enum name="KEYCODE_BRIGHTNESS_DOWN" value="220" /> + <enum name="KEYCODE_BRIGHTNESS_UP" value="221" /> </attr> <!-- ***************************************************************** --> diff --git a/data/keyboards/Generic.kl b/data/keyboards/Generic.kl index 225c11a..1413319 100644 --- a/data/keyboards/Generic.kl +++ b/data/keyboards/Generic.kl @@ -243,8 +243,8 @@ key 217 SEARCH # key 221 "KEY_SHOP" # key 222 "KEY_ALTERASE" # key 223 "KEY_CANCEL" -# key 224 "KEY_BRIGHTNESSDOWN" -# key 225 "KEY_BRIGHTNESSUP" +key 224 BRIGHTNESS_DOWN +key 225 BRIGHTNESS_UP key 226 HEADSETHOOK key 256 BUTTON_1 @@ -404,6 +404,9 @@ key 484 B FUNCTION # key 503 KEY_BRL_DOT7 # key 504 KEY_BRL_DOT8 +# Keys defined by HID usages +key usage 0x0c006F BRIGHTNESS_UP +key usage 0x0c0070 BRIGHTNESS_DOWN # Joystick and game controller axes. # Axes that are not mapped will be assigned generic axis numbers by the input subsystem. diff --git a/data/keyboards/Vendor_05ac_Product_0239.kl b/data/keyboards/Vendor_05ac_Product_0239.kl index 6bd3753..b0c358e 100644 --- a/data/keyboards/Vendor_05ac_Product_0239.kl +++ b/data/keyboards/Vendor_05ac_Product_0239.kl @@ -112,8 +112,8 @@ key 163 MEDIA_NEXT key 164 MEDIA_PLAY_PAUSE key 165 MEDIA_PREVIOUS # key 204 show gadgets -# key 224 reduce brightness -# key 225 increase brightness +key 224 BRIGHTNESS_DOWN +key 225 BRIGHTNESS_UP # key 229 blank special function on F5 # key 230 blank special function on F6 key 464 FUNCTION diff --git a/include/androidfw/KeycodeLabels.h b/include/androidfw/KeycodeLabels.h index 538949d..3e12f26 100644 --- a/include/androidfw/KeycodeLabels.h +++ b/include/androidfw/KeycodeLabels.h @@ -244,6 +244,8 @@ static const KeycodeLabel KEYCODES[] = { { "RO", 217 }, { "KANA", 218 }, { "ASSIST", 219 }, + { "BRIGHTNESS_DOWN", 220 }, + { "BRIGHTNESS_UP", 221 }, // 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. diff --git a/libs/androidfw/Input.cpp b/libs/androidfw/Input.cpp index 97b0ec1..8996f6f 100644 --- a/libs/androidfw/Input.cpp +++ b/libs/androidfw/Input.cpp @@ -72,6 +72,8 @@ bool KeyEvent::hasDefaultAction(int32_t keyCode) { case AKEYCODE_MEDIA_RECORD: case AKEYCODE_MEDIA_FAST_FORWARD: case AKEYCODE_MUTE: + case AKEYCODE_BRIGHTNESS_DOWN: + case AKEYCODE_BRIGHTNESS_UP: return true; } @@ -108,6 +110,8 @@ bool KeyEvent::isSystemKey(int32_t keyCode) { case AKEYCODE_CAMERA: case AKEYCODE_FOCUS: case AKEYCODE_SEARCH: + case AKEYCODE_BRIGHTNESS_DOWN: + case AKEYCODE_BRIGHTNESS_UP: return true; } |