diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-06-15 17:05:25 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-06-15 17:23:16 -0700 |
commit | 2fe8fb276c28372edb60f5bb10e172c19ef2671b (patch) | |
tree | 600e22507e05e4250e071c4e287d9f7544fe598c /services/java/com/android/server/PowerManagerService.java | |
parent | 87959cdd8560e743956a71bb687799e94053e086 (diff) |
Fix issue #6664140: Time to lock should work even Stay awake...
...in Developer options is on
Don't respect stay awake while on as long as a time to lock limit
is being enforced. When we start enforcing one, make sure the
setting is off (since we won't be respecting it anyway).
Bug: 6664140
Change-Id: Id07cb528afa0c64c7766341841c51771f507121d
Diffstat (limited to 'services/java/com/android/server/PowerManagerService.java')
-rw-r--r-- | services/java/com/android/server/PowerManagerService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index f46f8e6b0bad..fbdd7aa0b5e8 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -477,6 +477,11 @@ public class PowerManagerService extends IPowerManager.Stub } } + int getStayOnConditionsLocked() { + return mMaximumScreenOffTimeout <= 0 || mMaximumScreenOffTimeout == Integer.MAX_VALUE + ? mStayOnConditions : 0; + } + private class SettingsObserver implements Observer { private int getInt(String name, int defValue) { ContentValues values = mSettings.getValues(name); @@ -760,7 +765,8 @@ public class PowerManagerService extends IPowerManager.Stub } private void updateWakeLockLocked() { - if (mStayOnConditions != 0 && mBatteryService.isPowered(mStayOnConditions)) { + final int stayOnConditions = getStayOnConditionsLocked(); + if (stayOnConditions != 0 && mBatteryService.isPowered(stayOnConditions)) { // keep the device on if we're plugged in and mStayOnWhilePluggedIn is set. mStayOnWhilePluggedInScreenDimLock.acquire(); mStayOnWhilePluggedInPartialLock.acquire(); @@ -2097,7 +2103,8 @@ public class PowerManagerService extends IPowerManager.Stub // was dim steps = (int)(ANIM_STEPS*ratio); } - if (mStayOnConditions != 0 && mBatteryService.isPowered(mStayOnConditions)) { + final int stayOnConditions = getStayOnConditionsLocked(); + if (stayOnConditions != 0 && mBatteryService.isPowered(stayOnConditions)) { // If the "stay on while plugged in" option is // turned on, then the screen will often not // automatically turn off while plugged in. To |