diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 83eb424..6339007 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -495,7 +495,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // During wakeup by volume keys, we still need to capture subsequent events // until the key is released. This is required since the beep sound is produced // post keypressed. - boolean mVolumeWakeTriggered; + boolean mVolumeDownWakeTriggered; + boolean mVolumeUpWakeTriggered; + boolean mVolumeMuteWakeTriggered; int mPointerLocationMode = 0; // guarded by mLock @@ -5572,6 +5574,36 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + private void setVolumeWakeTriggered(final int keyCode, boolean triggered) { + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_DOWN: + mVolumeDownWakeTriggered = triggered; + break; + case KeyEvent.KEYCODE_VOLUME_UP: + mVolumeUpWakeTriggered = triggered; + break; + case KeyEvent.KEYCODE_VOLUME_MUTE: + mVolumeMuteWakeTriggered = triggered; + break; + default: + Log.w(TAG, "setVolumeWakeTriggered: unexpected keyCode=" + keyCode); + } + } + + private boolean getVolumeWakeTriggered(final int keyCode) { + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_DOWN: + return mVolumeDownWakeTriggered; + case KeyEvent.KEYCODE_VOLUME_UP: + return mVolumeUpWakeTriggered; + case KeyEvent.KEYCODE_VOLUME_MUTE: + return mVolumeMuteWakeTriggered; + default: + Log.w(TAG, "getVolumeWakeTriggered: unexpected keyCode=" + keyCode); + return false; + } + } + /** {@inheritDoc} */ @Override public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) { @@ -5667,11 +5699,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Eat all down & up keys when using volume wake. // This disables volume control, music control, and "beep" on key up. if (isWakeKey && mVolumeWakeScreen) { - mVolumeWakeTriggered = true; + setVolumeWakeTriggered(keyCode, true); break; - } else if (mVolumeWakeTriggered && !down) { + } else if (getVolumeWakeTriggered(keyCode) && !down) { result &= ~ACTION_PASS_TO_USER; - mVolumeWakeTriggered = false; + setVolumeWakeTriggered(keyCode, false); break; } |