Skip to content

Commit 7d46c61

Browse files
committed
Quick fix for bug 5646217 blocking automation tests
The screen saver knows to avoid running when applications are holding wake locks via window flags, but other wake locks are invisible to the window manager and therefore to the screen saver activation code. The correct thing to do is move the screen saver to the power manager to give it access to all wakelock information. In the meantime, this fix checks for the user's STAY_ON_WHILE_PLUGGED_IN setting and disables the screen saver in this case. Bug: 5646217 Change-Id: Ia2286a8c3745267871901f7a0b7df94ec344a456
1 parent 26dd54f commit 7d46c61

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3465,6 +3465,15 @@ public void run() {
34653465
if (localLOGV) Log.v(TAG, "mScreenSaverActivator: not running screen saver when not plugged in");
34663466
return;
34673467
}
3468+
// Quick fix for automation tests.
3469+
// The correct fix is to move this triggering logic to PowerManager, where more complete
3470+
// information about wakelocks (including StayOnWhilePluggedIn) is available.
3471+
if (Settings.System.getInt(mContext.getContentResolver(),
3472+
Settings.System.STAY_ON_WHILE_PLUGGED_IN,
3473+
BatteryManager.BATTERY_PLUGGED_AC) != 0) {
3474+
Log.v(TAG, "mScreenSaverActivator: not running screen saver when STAY_ON_WHILE_PLUGGED_IN");
3475+
return;
3476+
}
34683477

34693478
if (localLOGV) Log.v(TAG, "mScreenSaverActivator entering dreamland");
34703479

0 commit comments

Comments
 (0)