Skip to content

Commit b9ba2b6

Browse files
author
John Spurlock
committed
Fix screen timeout determination for starting dream.
It turns out OFF_BECAUSE_OF_TIMEOUT is not the best indicator of actual screen timeout. For example, it is the reason passed down when acquiring a wake lock. This was causing us to launch Dreams in the wrong situations, and deadlocking on calls to WindowManager. This fix simply adds an additional check ensuring the intention is to turn the screen off. Change-Id: If8adff446b5b1fcb19424b45878b75bfd0552b90
1 parent 7c46e43 commit b9ba2b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/java/com/android/server/power/PowerManagerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,8 +1830,8 @@ private void setPowerState(int newState, boolean noChangeLights, int reason)
18301830

18311831
final boolean stateChanged = mPowerState != newState;
18321832

1833-
if (stateChanged && reason == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT) {
1834-
if (mPolicy != null && mPolicy.isScreenSaverEnabled() && mIsPowered) {
1833+
if (stateChanged && !newScreenOn && reason == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT) {
1834+
if (mPolicy != null && mIsPowered && mPolicy.isScreenSaverEnabled()) {
18351835
if (DEBUG) {
18361836
Slog.d(TAG, "setPowerState: running screen saver instead of turning off screen");
18371837
}

0 commit comments

Comments
 (0)