From 2ccf0c8e636fd3be75c3a07f4cf60d72a4cfaa28 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Tue, 4 Aug 2015 23:03:03 +0100 Subject: Don't dispatch when non-interactive and the display is off. We generally dispatch while the display is off and we're dozing, under the assumption that the dozing window is controlling the display state and wants the events as they come in. Unfortunately, it's possible that we're dozing but something other than the dozing component has focus, which leads to dropped and cancelled events. This was preventing media events from being propogated to the media session under a number of scenarios, so for now we'll just prevent dispatching entirely while the display is off and the device is in a non-interactive state. Going forward we should figure out a better solution so that doze components can continue to receiving input events throughout their lifecycle, regardless of the display state. Bug: 22422588 Change-Id: Ia38bd81245234743e84548841d6478f75a6b8775 --- .../core/java/com/android/server/policy/PhoneWindowManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index da8fb702a56e..c4ff277945a2 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -5229,9 +5229,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private boolean shouldDispatchInputWhenNonInteractive() { - // Send events to keyguard while the screen is on. - if (isKeyguardShowingAndNotOccluded() && mDisplay != null - && mDisplay.getState() != Display.STATE_OFF) { + if (mDisplay == null || mDisplay.getState() == Display.STATE_OFF) { + return false; + } + // Send events to keyguard while the screen is on and it's showing. + if (isKeyguardShowingAndNotOccluded()) { return true; } -- cgit v1.2.3-59-g8ed1b