From 7d46c613f6bfeb6638c6aafb52eab417ad8eef52 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Wed, 23 Nov 2011 09:03:51 -0500 Subject: 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 --- .../src/com/android/internal/policy/impl/PhoneWindowManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'policy/src') diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index fd9e095..8f8ef91 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -3465,6 +3465,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (localLOGV) Log.v(TAG, "mScreenSaverActivator: not running screen saver when not plugged in"); return; } + // Quick fix for automation tests. + // The correct fix is to move this triggering logic to PowerManager, where more complete + // information about wakelocks (including StayOnWhilePluggedIn) is available. + if (Settings.System.getInt(mContext.getContentResolver(), + Settings.System.STAY_ON_WHILE_PLUGGED_IN, + BatteryManager.BATTERY_PLUGGED_AC) != 0) { + Log.v(TAG, "mScreenSaverActivator: not running screen saver when STAY_ON_WHILE_PLUGGED_IN"); + return; + } if (localLOGV) Log.v(TAG, "mScreenSaverActivator entering dreamland"); -- cgit v1.1