More paths for turning on screen immediately.

This fix forces the path through the updateLightsLocked method to turn
the screen on immediately if mWaitingForFirstLightSensor is true. Also
do not clear mWaitingForFirstLightSensor if mPreparingForScreenOn
is true. Wait until it turns false.

Fixes bug 6612418.

Change-Id: I03407e748cce4906a73de1f15df1654649b133c4
This commit is contained in:
Craig Mautner
2012-06-18 16:53:27 -07:00
parent 8b9c6d51d5
commit 75fc9de258

View File

@@ -2106,6 +2106,10 @@ public class PowerManagerService extends IPowerManager.Stub
brightness = mScreenBrightnessDim;
}
}
if (mWaitingForFirstLightSensor && (newState & SCREEN_ON_BIT) != 0) {
steps = IMMEDIATE_ANIM_STEPS;
}
long identity = Binder.clearCallingIdentity();
try {
mBatteryStats.noteScreenBrightness(brightness);
@@ -3348,6 +3352,7 @@ public class PowerManagerService extends IPowerManager.Stub
}
SensorEventListener mLightListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
if (mDebugLightSensor) {
Slog.d(TAG, "onSensorChanged: light value: " + event.values[0]);
@@ -3358,12 +3363,16 @@ public class PowerManagerService extends IPowerManager.Stub
return;
}
handleLightSensorValue((int)event.values[0], mWaitingForFirstLightSensor);
if (mWaitingForFirstLightSensor) {
if (mWaitingForFirstLightSensor && !mPreparingForScreenOn) {
if (mDebugLightAnimation) {
Slog.d(TAG, "onSensorChanged: Clearing mWaitingForFirstLightSensor.");
}
mWaitingForFirstLightSensor = false;
}
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// ignore
}