summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/PowerManagerService.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-06-18 10:33:05 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-18 10:33:05 -0700
commit608601924651531210ad3c6179d02c471f42dddf (patch)
treeec1b7516c360292123b2140c0d19a6bc2c68fa11 /services/java/com/android/server/PowerManagerService.java
parent772ddc0cf28625964435edc5e86048e353c425fa (diff)
parentd8bbf96a84cba7c31fa1535fe2467520f2aa0198 (diff)
am d8bbf96a: Merge "Fix issue #6664140: Time to lock should work even Stay awake..." into jb-dev
* commit 'd8bbf96a84cba7c31fa1535fe2467520f2aa0198': 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.java11
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 e9fbd3a480bc..55a28a6c3ddc 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