Merge "Allow wake keys to wake dozing device." into lmp-dev
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index cd3eab5..ab311c04 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4240,14 +4240,17 @@
int result;
boolean isWakeKey = (policyFlags & WindowManagerPolicy.FLAG_WAKE) != 0
|| event.isWakeKey();
- if (interactive
- || (isInjected && !isWakeKey)
- || (!interactive && shouldDispatchInputWhenNonInteractive())) {
- // When the device is interactive, the key is injected, or we're currently dozing in a
- // non-interactive state with the screen on and the keyguard showing, pass the key to
- // the application.
+ if (interactive || (isInjected && !isWakeKey)) {
+ // When the device is interactive or the key is injected pass the key to the
+ // application.
result = ACTION_PASS_TO_USER;
isWakeKey = false;
+ } else if (!interactive && shouldDispatchInputWhenNonInteractive()) {
+ // If we're currently dozing with the screen on and the keyguard showing, pass the key
+ // to the application but preserve its wake key status to make sure we still move
+ // from dozing to fully interactive if we would normally go from off to fully
+ // interactive.
+ result = ACTION_PASS_TO_USER;
} else {
// When the screen is off and the key is not injected, determine whether
// to wake the device but don't pass the key to the application.