Merge commit '00d1772d8cfb94066b757034055ac38897d161da' into gingerbread-plus-aosp * commit '00d1772d8cfb94066b757034055ac38897d161da': Continue trying to make the turn off quickly after call feature work.
This commit is contained in:
@ -1043,11 +1043,10 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
// If they gave a timeoutOverride it is the number of seconds
|
// If they gave a timeoutOverride it is the number of seconds
|
||||||
// to screen-off. Figure out where in the countdown cycle we
|
// to screen-off. Figure out where in the countdown cycle we
|
||||||
// should jump to.
|
// 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) {
|
if (mBootCompleted) {
|
||||||
synchronized (mLocks) {
|
synchronized (mLocks) {
|
||||||
mHandler.removeCallbacks(mTimeoutTask);
|
|
||||||
mTimeoutTask.nextState = nextState;
|
|
||||||
long when = 0;
|
long when = 0;
|
||||||
if (timeoutOverride <= 0) {
|
if (timeoutOverride <= 0) {
|
||||||
switch (nextState)
|
switch (nextState)
|
||||||
@ -1098,6 +1097,12 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
+ " timeoutOverride=" + timeoutOverride
|
+ " timeoutOverride=" + timeoutOverride
|
||||||
+ " nextState=" + nextState + " when=" + when);
|
+ " nextState=" + nextState + " when=" + when);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mHandler.removeCallbacks(mTimeoutTask);
|
||||||
|
mTimeoutTask.nextState = nextState;
|
||||||
|
mTimeoutTask.remainingTimeoutOverride = timeoutOverride > 0
|
||||||
|
? (originalTimeoutOverride - timeoutOverride)
|
||||||
|
: -1;
|
||||||
mHandler.postAtTime(mTimeoutTask, when);
|
mHandler.postAtTime(mTimeoutTask, when);
|
||||||
mNextTimeout = when; // for debugging
|
mNextTimeout = when; // for debugging
|
||||||
}
|
}
|
||||||
@ -1113,6 +1118,7 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
private class TimeoutTask implements Runnable
|
private class TimeoutTask implements Runnable
|
||||||
{
|
{
|
||||||
int nextState; // access should be synchronized on mLocks
|
int nextState; // access should be synchronized on mLocks
|
||||||
|
long remainingTimeoutOverride;
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
synchronized (mLocks) {
|
synchronized (mLocks) {
|
||||||
@ -1133,11 +1139,11 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
{
|
{
|
||||||
case SCREEN_BRIGHT:
|
case SCREEN_BRIGHT:
|
||||||
if (mDimDelay >= 0) {
|
if (mDimDelay >= 0) {
|
||||||
setTimeoutLocked(now, SCREEN_DIM);
|
setTimeoutLocked(now, remainingTimeoutOverride, SCREEN_DIM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCREEN_DIM:
|
case SCREEN_DIM:
|
||||||
setTimeoutLocked(now, SCREEN_OFF);
|
setTimeoutLocked(now, remainingTimeoutOverride, SCREEN_OFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2076,6 +2082,7 @@ class PowerManagerService extends IPowerManager.Stub
|
|||||||
+ " mUserState=0x" + Integer.toHexString(mUserState)
|
+ " mUserState=0x" + Integer.toHexString(mUserState)
|
||||||
+ " mWakeLockState=0x" + Integer.toHexString(mWakeLockState)
|
+ " mWakeLockState=0x" + Integer.toHexString(mWakeLockState)
|
||||||
+ " mProximitySensorActive=" + mProximitySensorActive
|
+ " mProximitySensorActive=" + mProximitySensorActive
|
||||||
|
+ " timeoutOverride=" + timeoutOverride
|
||||||
+ " force=" + force);
|
+ " force=" + force);
|
||||||
}
|
}
|
||||||
// ignore user activity if we are in the process of turning off the screen
|
// ignore user activity if we are in the process of turning off the screen
|
||||||
|
Reference in New Issue
Block a user