Loading core/java/android/view/WindowManagerPolicy.java +3 −2 Original line number Diff line number Diff line Loading @@ -770,7 +770,8 @@ public interface WindowManagerPolicy { public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); /** * Called from the input reader thread before a motion is enqueued when the screen is off. * Called from the input reader thread before a motion is enqueued when the device is in a * non-interactive state. * * <p>There are some actions that need to be handled here because they * affect the power state of the device, for example, waking on motions. Loading @@ -780,7 +781,7 @@ public interface WindowManagerPolicy { * * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. */ public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags); public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); /** * Called from the input dispatcher thread before a key is dispatched to a window. Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +19 −7 Original line number Diff line number Diff line Loading @@ -4240,8 +4240,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { int result; boolean isWakeKey = (policyFlags & WindowManagerPolicy.FLAG_WAKE) != 0 || event.isWakeKey(); if (interactive || (isInjected && !isWakeKey)) { // When the screen is on or if the key is injected pass the key to the application. 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. result = ACTION_PASS_TO_USER; isWakeKey = false; } else { Loading Loading @@ -4548,13 +4552,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags) { // We already know this is a wake motion so just wake up. // Note that we would observe policyFlags containing // FLAG_WAKE and FLAG_INTERACTIVE here. public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { if ((policyFlags & FLAG_WAKE) != 0) { mPowerManager.wakeUp(whenNanos / 1000000); return 0; } if (shouldDispatchInputWhenNonInteractive()) { return ACTION_PASS_TO_USER; } return 0; } private boolean shouldDispatchInputWhenNonInteractive() { return keyguardIsShowingTq() && mDisplay != null && mDisplay.getState() != Display.STATE_OFF; } void dispatchMediaKeyWithWakeLock(KeyEvent event) { if (DEBUG_INPUT) { Loading services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -9945,7 +9945,7 @@ public final class ActivityManagerService extends ActivityManagerNative } private void updateEventDispatchingLocked() { mWindowManager.setEventDispatching(mBooted && !mWentToSleep && !mShuttingDown); mWindowManager.setEventDispatching(mBooted && !mShuttingDown); } public void setLockScreenShown(boolean shown) { Loading services/core/java/com/android/server/input/InputManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -1429,8 +1429,8 @@ public class InputManagerService extends IInputManager.Stub } // Native callback. private int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags) { return mWindowManagerCallbacks.interceptWakeMotionBeforeQueueing( private int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { return mWindowManagerCallbacks.interceptMotionBeforeQueueingNonInteractive( whenNanos, policyFlags); } Loading Loading @@ -1593,7 +1593,7 @@ public class InputManagerService extends IInputManager.Stub public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags); public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); public long interceptKeyBeforeDispatching(InputWindowHandle focus, KeyEvent event, int policyFlags); Loading services/core/java/com/android/server/wm/InputMonitor.java +5 −4 Original line number Diff line number Diff line Loading @@ -365,12 +365,13 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks { return mService.mPolicy.interceptKeyBeforeQueueing(event, policyFlags); } /* Provides an opportunity for the window manager policy to intercept early * motion event processing when the screen is off since these events are normally /* Provides an opportunity for the window manager policy to intercept early motion event * processing when the device is in a non-interactive state since these events are normally * dropped. */ @Override public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags) { return mService.mPolicy.interceptWakeMotionBeforeQueueing(whenNanos, policyFlags); public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { return mService.mPolicy.interceptMotionBeforeQueueingNonInteractive( whenNanos, policyFlags); } /* Provides an opportunity for the window manager policy to process a key before Loading Loading
core/java/android/view/WindowManagerPolicy.java +3 −2 Original line number Diff line number Diff line Loading @@ -770,7 +770,8 @@ public interface WindowManagerPolicy { public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); /** * Called from the input reader thread before a motion is enqueued when the screen is off. * Called from the input reader thread before a motion is enqueued when the device is in a * non-interactive state. * * <p>There are some actions that need to be handled here because they * affect the power state of the device, for example, waking on motions. Loading @@ -780,7 +781,7 @@ public interface WindowManagerPolicy { * * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}. */ public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags); public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); /** * Called from the input dispatcher thread before a key is dispatched to a window. Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +19 −7 Original line number Diff line number Diff line Loading @@ -4240,8 +4240,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { int result; boolean isWakeKey = (policyFlags & WindowManagerPolicy.FLAG_WAKE) != 0 || event.isWakeKey(); if (interactive || (isInjected && !isWakeKey)) { // When the screen is on or if the key is injected pass the key to the application. 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. result = ACTION_PASS_TO_USER; isWakeKey = false; } else { Loading Loading @@ -4548,13 +4552,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags) { // We already know this is a wake motion so just wake up. // Note that we would observe policyFlags containing // FLAG_WAKE and FLAG_INTERACTIVE here. public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { if ((policyFlags & FLAG_WAKE) != 0) { mPowerManager.wakeUp(whenNanos / 1000000); return 0; } if (shouldDispatchInputWhenNonInteractive()) { return ACTION_PASS_TO_USER; } return 0; } private boolean shouldDispatchInputWhenNonInteractive() { return keyguardIsShowingTq() && mDisplay != null && mDisplay.getState() != Display.STATE_OFF; } void dispatchMediaKeyWithWakeLock(KeyEvent event) { if (DEBUG_INPUT) { Loading
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -9945,7 +9945,7 @@ public final class ActivityManagerService extends ActivityManagerNative } private void updateEventDispatchingLocked() { mWindowManager.setEventDispatching(mBooted && !mWentToSleep && !mShuttingDown); mWindowManager.setEventDispatching(mBooted && !mShuttingDown); } public void setLockScreenShown(boolean shown) { Loading
services/core/java/com/android/server/input/InputManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -1429,8 +1429,8 @@ public class InputManagerService extends IInputManager.Stub } // Native callback. private int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags) { return mWindowManagerCallbacks.interceptWakeMotionBeforeQueueing( private int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { return mWindowManagerCallbacks.interceptMotionBeforeQueueingNonInteractive( whenNanos, policyFlags); } Loading Loading @@ -1593,7 +1593,7 @@ public class InputManagerService extends IInputManager.Stub public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags); public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags); public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags); public long interceptKeyBeforeDispatching(InputWindowHandle focus, KeyEvent event, int policyFlags); Loading
services/core/java/com/android/server/wm/InputMonitor.java +5 −4 Original line number Diff line number Diff line Loading @@ -365,12 +365,13 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks { return mService.mPolicy.interceptKeyBeforeQueueing(event, policyFlags); } /* Provides an opportunity for the window manager policy to intercept early * motion event processing when the screen is off since these events are normally /* Provides an opportunity for the window manager policy to intercept early motion event * processing when the device is in a non-interactive state since these events are normally * dropped. */ @Override public int interceptWakeMotionBeforeQueueing(long whenNanos, int policyFlags) { return mService.mPolicy.interceptWakeMotionBeforeQueueing(whenNanos, policyFlags); public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { return mService.mPolicy.interceptMotionBeforeQueueingNonInteractive( whenNanos, policyFlags); } /* Provides an opportunity for the window manager policy to process a key before Loading