diff --git a/api/current.txt b/api/current.txt index a88278c3664dd..2926dd470f10f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -41479,6 +41479,10 @@ package android.view { field public static final int KEYCODE_FOCUS = 80; // 0x50 field public static final int KEYCODE_FORWARD = 125; // 0x7d field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70 + field public static final int KEYCODE_FP_NAV_DOWN = 281; // 0x119 + field public static final int KEYCODE_FP_NAV_LEFT = 282; // 0x11a + field public static final int KEYCODE_FP_NAV_RIGHT = 283; // 0x11b + field public static final int KEYCODE_FP_NAV_UP = 280; // 0x118 field public static final int KEYCODE_FUNCTION = 119; // 0x77 field public static final int KEYCODE_G = 35; // 0x23 field public static final int KEYCODE_GRAVE = 68; // 0x44 diff --git a/api/system-current.txt b/api/system-current.txt index 009a6ba3610fc..67d1f56d3e543 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -44481,6 +44481,10 @@ package android.view { field public static final int KEYCODE_FOCUS = 80; // 0x50 field public static final int KEYCODE_FORWARD = 125; // 0x7d field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70 + field public static final int KEYCODE_FP_NAV_DOWN = 281; // 0x119 + field public static final int KEYCODE_FP_NAV_LEFT = 282; // 0x11a + field public static final int KEYCODE_FP_NAV_RIGHT = 283; // 0x11b + field public static final int KEYCODE_FP_NAV_UP = 280; // 0x118 field public static final int KEYCODE_FUNCTION = 119; // 0x77 field public static final int KEYCODE_G = 35; // 0x23 field public static final int KEYCODE_GRAVE = 68; // 0x44 diff --git a/api/test-current.txt b/api/test-current.txt index b72a1214400b4..f633a13feddde 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -41559,6 +41559,10 @@ package android.view { field public static final int KEYCODE_FOCUS = 80; // 0x50 field public static final int KEYCODE_FORWARD = 125; // 0x7d field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70 + field public static final int KEYCODE_FP_NAV_DOWN = 281; // 0x119 + field public static final int KEYCODE_FP_NAV_LEFT = 282; // 0x11a + field public static final int KEYCODE_FP_NAV_RIGHT = 283; // 0x11b + field public static final int KEYCODE_FP_NAV_UP = 280; // 0x118 field public static final int KEYCODE_FUNCTION = 119; // 0x77 field public static final int KEYCODE_G = 35; // 0x23 field public static final int KEYCODE_GRAVE = 68; // 0x44 diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 636384c616e0d..599c9c72237e1 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -796,8 +796,16 @@ public class KeyEvent extends InputEvent implements Parcelable { public static final int KEYCODE_COPY = 278; /** Key code constant: Paste key. */ public static final int KEYCODE_PASTE = 279; + /** Key code constant: fingerprint navigation up */ + public static final int KEYCODE_FP_NAV_UP = 280; + /** Key code constant: fingerprint navigation down */ + public static final int KEYCODE_FP_NAV_DOWN = 281; + /** Key code constant: fingerprint navigation left*/ + public static final int KEYCODE_FP_NAV_LEFT = 282; + /** Key code constant: fingerprint navigation right */ + public static final int KEYCODE_FP_NAV_RIGHT = 283; - private static final int LAST_KEYCODE = KEYCODE_PASTE; + private static final int LAST_KEYCODE = KEYCODE_FP_NAV_RIGHT; // NOTE: If you add a new keycode here you must also add it to: // isSystem() @@ -1844,6 +1852,10 @@ public class KeyEvent extends InputEvent implements Parcelable { case KeyEvent.KEYCODE_BRIGHTNESS_DOWN: case KeyEvent.KEYCODE_BRIGHTNESS_UP: case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: + case KeyEvent.KEYCODE_FP_NAV_UP: + case KeyEvent.KEYCODE_FP_NAV_DOWN: + case KeyEvent.KEYCODE_FP_NAV_LEFT: + case KeyEvent.KEYCODE_FP_NAV_RIGHT: return true; } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 930abb10e0666..5875b56601fae 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1835,6 +1835,10 @@ i + + + + diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 251f714d9f02f..49efad154d5f7 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -5632,6 +5632,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { break; } + case KeyEvent.KEYCODE_FP_NAV_DOWN: + // fall through + case KeyEvent.KEYCODE_FP_NAV_UP: + // fall through + case KeyEvent.KEYCODE_FP_NAV_LEFT: + // fall through + case KeyEvent.KEYCODE_FP_NAV_RIGHT: { + interceptStatusBarKey(event); + break; + } + case KeyEvent.KEYCODE_SLEEP: { result &= ~ACTION_PASS_TO_USER; isWakeKey = false; @@ -5752,6 +5763,32 @@ public class PhoneWindowManager implements WindowManagerPolicy { return result; } + /** + * Handle statusbar expansion events. + * @param event + */ + private void interceptStatusBarKey(KeyEvent event) { + final int e = event.getKeyCode(); + if (event.getAction() == KeyEvent.ACTION_UP) { + boolean doOpen = false; + boolean doClose = false; + doOpen = (e == KeyEvent.KEYCODE_FP_NAV_DOWN); + doClose = (e == KeyEvent.KEYCODE_FP_NAV_UP); + IStatusBarService sbar = getStatusBarService(); + if (sbar != null) { + try { + if (doOpen) { + sbar.expandNotificationsPanel(); + } else if (doClose) { + sbar.collapsePanels(); + } + } catch (RemoteException e1) { + // oops, no statusbar. Ignore event. + } + } + } + } + /** * Returns true if the key can have global actions attached to it. * We reserve all power management keys for the system since they require