summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2011-11-23 09:03:51 -0500
committerDaniel Sandler <dsandler@android.com>2011-11-23 09:03:51 -0500
commit7d46c613f6bfeb6638c6aafb52eab417ad8eef52 (patch)
treefca7ea6b63202b4c9b6f5f685b6ce77736648683 /policy
parent26dd54f87c1daaa369576d9abea823c8105bd702 (diff)
downloadframeworks_base-7d46c613f6bfeb6638c6aafb52eab417ad8eef52.zip
frameworks_base-7d46c613f6bfeb6638c6aafb52eab417ad8eef52.tar.gz
frameworks_base-7d46c613f6bfeb6638c6aafb52eab417ad8eef52.tar.bz2
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
Diffstat (limited to 'policy')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java9
1 files changed, 9 insertions, 0 deletions
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");