Skip to content

Commit 75fc9de

Browse files
author
Craig Mautner
committed
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
1 parent 8b9c6d5 commit 75fc9de

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

services/java/com/android/server/PowerManagerService.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,6 +2106,10 @@ private void updateLightsLocked(int newState, int forceState) {
21062106
brightness = mScreenBrightnessDim;
21072107
}
21082108
}
2109+
if (mWaitingForFirstLightSensor && (newState & SCREEN_ON_BIT) != 0) {
2110+
steps = IMMEDIATE_ANIM_STEPS;
2111+
}
2112+
21092113
long identity = Binder.clearCallingIdentity();
21102114
try {
21112115
mBatteryStats.noteScreenBrightness(brightness);
@@ -3348,6 +3352,7 @@ private void handleLightSensorValue(int value, boolean immediate) {
33483352
}
33493353

33503354
SensorEventListener mLightListener = new SensorEventListener() {
3355+
@Override
33513356
public void onSensorChanged(SensorEvent event) {
33523357
if (mDebugLightSensor) {
33533358
Slog.d(TAG, "onSensorChanged: light value: " + event.values[0]);
@@ -3358,12 +3363,16 @@ public void onSensorChanged(SensorEvent event) {
33583363
return;
33593364
}
33603365
handleLightSensorValue((int)event.values[0], mWaitingForFirstLightSensor);
3361-
if (mWaitingForFirstLightSensor) {
3366+
if (mWaitingForFirstLightSensor && !mPreparingForScreenOn) {
3367+
if (mDebugLightAnimation) {
3368+
Slog.d(TAG, "onSensorChanged: Clearing mWaitingForFirstLightSensor.");
3369+
}
33623370
mWaitingForFirstLightSensor = false;
33633371
}
33643372
}
33653373
}
33663374

3375+
@Override
33673376
public void onAccuracyChanged(Sensor sensor, int accuracy) {
33683377
// ignore
33693378
}

0 commit comments

Comments
 (0)