From f4c0a13170cd85da39953c354dc4c5eb836af038 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 17 May 2016 18:11:52 -0700 Subject: [PATCH] Add fingerprint navigation to enable pulling down the statusbar Change-Id: If0584358fd615ebd9df11614c662f4f287abf5c4 --- api/current.txt | 4 ++ api/system-current.txt | 4 ++ api/test-current.txt | 4 ++ core/java/android/view/KeyEvent.java | 14 ++++++- core/res/res/values/attrs.xml | 4 ++ .../server/policy/PhoneWindowManager.java | 37 +++++++++++++++++++ 6 files changed, 66 insertions(+), 1 deletion(-) diff --git a/api/current.txt b/api/current.txt index 1b7f095fae7ca..4cf7c60801de7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -41457,6 +41457,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 68106ab55643b..19aafa52b6630 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -44451,6 +44451,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 2d022ad65338a..43117bb6c234c 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -41536,6 +41536,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 6af9ef2271fa1..f3d8335121718 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 b30817f53cdbb..8288088d185fd 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