diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-11-08 20:22:03 -0800 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-11-10 14:33:59 -0800 |
commit | 43150bfa9377ca7a5fe0e6bfcdc04fb5807501f7 (patch) | |
tree | 06cc832929ecf28bc8e54a040867654018df2669 /policy | |
parent | 97ece7a95f76ec724633d4f4764291ea4dc20933 (diff) | |
download | frameworks_base-43150bfa9377ca7a5fe0e6bfcdc04fb5807501f7.zip frameworks_base-43150bfa9377ca7a5fe0e6bfcdc04fb5807501f7.tar.gz frameworks_base-43150bfa9377ca7a5fe0e6bfcdc04fb5807501f7.tar.bz2 |
Wake on volume key when in dock.
Bug: 5580373
Change-Id: I847fb10b48c2e5e26cabefea1d630793efc32131
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java | 18 | ||||
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 5 |
2 files changed, 18 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java index c802bc1..b514689 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -830,12 +830,13 @@ public class KeyguardViewMediator implements KeyguardViewCallback, * action should be posted to a handler. * * @param keyCode The keycode of the key that woke the device + * @param isDocked True if the device is in the dock * @return Whether we poked the wake lock (and turned the screen on) */ - public boolean onWakeKeyWhenKeyguardShowingTq(int keyCode) { + public boolean onWakeKeyWhenKeyguardShowingTq(int keyCode, boolean isDocked) { if (DEBUG) Log.d(TAG, "onWakeKeyWhenKeyguardShowing(" + keyCode + ")"); - if (isWakeKeyWhenKeyguardShowing(keyCode)) { + if (isWakeKeyWhenKeyguardShowing(keyCode, isDocked)) { // give the keyguard view manager a chance to adjust the state of the // keyguard based on the key that woke the device before poking // the wake lock @@ -846,11 +847,22 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } } - private boolean isWakeKeyWhenKeyguardShowing(int keyCode) { + /** + * When the keyguard is showing we ignore some keys that might otherwise typically + * be considered wake keys. We filter them out here. + * + * {@link KeyEvent#KEYCODE_POWER} is notably absent from this list because it + * is always considered a wake key. + */ + private boolean isWakeKeyWhenKeyguardShowing(int keyCode, boolean isDocked) { switch (keyCode) { + // ignore volume keys unless docked case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_MUTE: + return isDocked; + + // ignore media and camera keys case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY: diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index aa1c81c..f2d688b 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2480,7 +2480,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // keyguard, then we need to have it turn on the // screen once it is shown. mKeyguardMediator.onWakeKeyWhenKeyguardShowingTq( - KeyEvent.KEYCODE_POWER); + KeyEvent.KEYCODE_POWER, mDockMode != Intent.EXTRA_DOCK_STATE_UNDOCKED); } } else { // Light up the keyboard if we are sliding up. @@ -2700,7 +2700,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (down && isWakeKey) { if (keyguardActive) { // If the keyguard is showing, let it decide what to do with the wake key. - mKeyguardMediator.onWakeKeyWhenKeyguardShowingTq(keyCode); + mKeyguardMediator.onWakeKeyWhenKeyguardShowingTq(keyCode, + mDockMode != Intent.EXTRA_DOCK_STATE_UNDOCKED); } else { // Otherwise, wake the device ourselves. result |= ACTION_POKE_USER_ACTIVITY; |