diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-06-18 10:49:38 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-18 10:49:38 -0700 |
commit | d466fe463b6c4a1a5694d5a42810af60ad782a2c (patch) | |
tree | 8efc406e7e1248129a2520b940906265f601a6c3 /services/java/com/android/server/PowerManagerService.java | |
parent | 00b7ae0936c555079e622237e8499613a073381c (diff) | |
parent | 608601924651531210ad3c6179d02c471f42dddf (diff) |
am 60860192: am d8bbf96a: Merge "Fix issue #6664140: Time to lock should work even Stay awake..." into jb-dev
* commit '608601924651531210ad3c6179d02c471f42dddf':
Fix issue #6664140: Time to lock should work even Stay awake...
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 2e3121dca005..c95da409ada5 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(); @@ -2099,7 +2105,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 |