summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2010-08-26 14:46:01 -0400
committerJoe Onorato <joeo@google.com>2010-08-26 14:48:56 -0400
commit797e688b3bebbf1f50a8ad08528740b064f79153 (patch)
tree1886e10e83e0cccd9de435be643a332bb1bace93 /services
parentd5e601c2304610085e3d7a276c4bbcd984ac89f9 (diff)
downloadframeworks_base-797e688b3bebbf1f50a8ad08528740b064f79153.zip
frameworks_base-797e688b3bebbf1f50a8ad08528740b064f79153.tar.gz
frameworks_base-797e688b3bebbf1f50a8ad08528740b064f79153.tar.bz2
Continue trying to make the turn off quickly after call feature work.
The previous implementation worked if the set timeout is short enough, which mine was. This one carries the remaining amount of timeout override forward through all of the countdown steps. Bug: 2844990 Change-Id: I040df22f9f9ddf98c355ac6845b7624e95f84f33
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PowerManagerService.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 7bbc32f..55f9d60 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -1029,11 +1029,10 @@ class PowerManagerService extends IPowerManager.Stub
// If they gave a timeoutOverride it is the number of seconds
// to screen-off. Figure out where in the countdown cycle we
// should jump to.
- private void setTimeoutLocked(long now, long timeoutOverride, int nextState) {
+ private void setTimeoutLocked(long now, final long originalTimeoutOverride, int nextState) {
+ long timeoutOverride = originalTimeoutOverride;
if (mBootCompleted) {
synchronized (mLocks) {
- mHandler.removeCallbacks(mTimeoutTask);
- mTimeoutTask.nextState = nextState;
long when = 0;
if (timeoutOverride <= 0) {
switch (nextState)
@@ -1084,6 +1083,12 @@ class PowerManagerService extends IPowerManager.Stub
+ " timeoutOverride=" + timeoutOverride
+ " nextState=" + nextState + " when=" + when);
}
+
+ mHandler.removeCallbacks(mTimeoutTask);
+ mTimeoutTask.nextState = nextState;
+ mTimeoutTask.remainingTimeoutOverride = timeoutOverride > 0
+ ? (originalTimeoutOverride - timeoutOverride)
+ : -1;
mHandler.postAtTime(mTimeoutTask, when);
mNextTimeout = when; // for debugging
}
@@ -1099,6 +1104,7 @@ class PowerManagerService extends IPowerManager.Stub
private class TimeoutTask implements Runnable
{
int nextState; // access should be synchronized on mLocks
+ long remainingTimeoutOverride;
public void run()
{
synchronized (mLocks) {
@@ -1119,11 +1125,11 @@ class PowerManagerService extends IPowerManager.Stub
{
case SCREEN_BRIGHT:
if (mDimDelay >= 0) {
- setTimeoutLocked(now, SCREEN_DIM);
+ setTimeoutLocked(now, remainingTimeoutOverride, SCREEN_DIM);
break;
}
case SCREEN_DIM:
- setTimeoutLocked(now, SCREEN_OFF);
+ setTimeoutLocked(now, remainingTimeoutOverride, SCREEN_OFF);
break;
}
}
@@ -2054,6 +2060,7 @@ class PowerManagerService extends IPowerManager.Stub
+ " mUserState=0x" + Integer.toHexString(mUserState)
+ " mWakeLockState=0x" + Integer.toHexString(mWakeLockState)
+ " mProximitySensorActive=" + mProximitySensorActive
+ + " timeoutOverride=" + timeoutOverride
+ " force=" + force);
}
// ignore user activity if we are in the process of turning off the screen