Fix a race condition that resulted in the screen coming on without the brightness set to the correct value.
Do not cancel screen brightness animation in forceUserActivityLocked unless screen is turning off. Also not turn the screen on if PowerManager.preventScreenOn(false) is called while proximity sensor is active. Fixes b/2254818 (dim display) where due to a race condition the screen is stuck in a dim state. Change-Id: If6f805609c8d463631b9e22805e5242714ce34c0 Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
@@ -1266,7 +1266,7 @@ class PowerManagerService extends IPowerManager.Stub
|
||||
// Forcibly turn on the screen if it's supposed to be on. (This
|
||||
// handles the case where the screen is currently off because of
|
||||
// a prior preventScreenOn(true) call.)
|
||||
if ((mPowerState & SCREEN_ON_BIT) != 0) {
|
||||
if (!mProximitySensorActive && (mPowerState & SCREEN_ON_BIT) != 0) {
|
||||
if (mSpew) {
|
||||
Log.d(TAG,
|
||||
"preventScreenOn: turning on after a prior preventScreenOn(true)!");
|
||||
@@ -1847,8 +1847,10 @@ class PowerManagerService extends IPowerManager.Stub
|
||||
}
|
||||
|
||||
private void forceUserActivityLocked() {
|
||||
// cancel animation so userActivity will succeed
|
||||
mScreenBrightness.animating = false;
|
||||
if (isScreenTurningOffLocked()) {
|
||||
// cancel animation so userActivity will succeed
|
||||
mScreenBrightness.animating = false;
|
||||
}
|
||||
boolean savedActivityAllowed = mUserActivityAllowed;
|
||||
mUserActivityAllowed = true;
|
||||
userActivity(SystemClock.uptimeMillis(), false);
|
||||
|
||||
Reference in New Issue
Block a user