Skip to content

Commit af01fe0

Browse files
author
Craig Mautner
committed
Fix initial brightness state after startup.
Setting of mInitialAnimation member was assuming that currentValue member would only be 0 at boot. It also gets set to 0 when the sensor goes dark. This fix removes mInitialValue reliance on currentValue. Fixes bug 6444319. Change-Id: I27069f1b44f1f727533d34bbecad2e5aeaa7aab8
1 parent 817a243 commit af01fe0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,9 @@ private void animateInternal(int mask, boolean turningOff, int delay) {
22422242
} else {
22432243
newValue = endValue;
22442244
mHighestLightSensorValue = endSensorValue;
2245-
mInitialAnimation = false;
2245+
if (endValue > 0) {
2246+
mInitialAnimation = false;
2247+
}
22462248
}
22472249

22482250
if (mDebugLightAnimation) {
@@ -2290,7 +2292,7 @@ public void animateTo(int target, int sensorTarget, int mask, int animationDurat
22902292
currentMask = mask;
22912293
duration = (int) (mWindowScaleAnimation * animationDuration);
22922294
startTimeMillis = SystemClock.elapsedRealtime();
2293-
mInitialAnimation = currentValue == 0 && target > 0;
2295+
mInitialAnimation = mInitialAnimation && target > 0;
22942296

22952297
if (mDebugLightAnimation) {
22962298
Slog.v(TAG, "animateTo(target=" + target
@@ -2608,7 +2610,8 @@ public void run() {
26082610
}
26092611
};
26102612

2611-
private boolean mInitialAnimation; // used to prevent lightsensor changes while turning on
2613+
/** used to prevent lightsensor changes while turning on. */
2614+
private boolean mInitialAnimation = true;
26122615

26132616
private void dockStateChanged(int state) {
26142617
synchronized (mLocks) {

0 commit comments

Comments
 (0)