diff options
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index ea60e73..5598972 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -4118,11 +4118,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " policyFlags=" + Integer.toHexString(policyFlags)); } - if (down && (policyFlags & WindowManagerPolicy.FLAG_VIRTUAL) != 0 - && event.getRepeatCount() == 0) { - performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); - } - // Basic policy based on interactive state. int result; boolean isWakeKey = (policyFlags & WindowManagerPolicy.FLAG_WAKE) != 0 @@ -4145,6 +4140,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { return result; } + boolean useHapticFeedback = down + && (policyFlags & WindowManagerPolicy.FLAG_VIRTUAL) != 0 + && event.getRepeatCount() == 0; + // Handle special keys. switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: @@ -4291,6 +4290,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { case KeyEvent.KEYCODE_SLEEP: { result &= ~ACTION_PASS_TO_USER; + if (!mPowerManager.isInteractive()) { + useHapticFeedback = false; // suppress feedback if already non-interactive + } mPowerManager.goToSleep(event.getEventTime()); isWakeKey = false; break; @@ -4357,6 +4359,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + if (useHapticFeedback) { + performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false); + } + if (isWakeKey) { mPowerManager.wakeUp(event.getEventTime()); } |
