Skip to content

Commit 320a10a

Browse files
committed
Reset cached light sensor values when toggling auto-brightness mode
Now the screen brightness will readjust to ambient lighting when toggling auto-brightness on and off in Settings or the Power Widget. Bug: 5486091 Change-Id: Ic98939fe1c59cb8def0f84266e48ca00329d6b30 Signed-off-by: Mike Lockwood <lockwood@android.com>
1 parent 55174b6 commit 320a10a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,6 +3043,11 @@ private void enableLightSensorLocked(boolean enable) {
30433043
}
30443044
if (mSensorManager != null && mLightSensorEnabled != enable) {
30453045
mLightSensorEnabled = enable;
3046+
// clear previous values so we will adjust to current brightness when
3047+
// auto-brightness is reenabled
3048+
mHighestLightSensorValue = -1;
3049+
mLightSensorValue = -1;
3050+
30463051
// clear calling identity so sensor manager battery stats are accurate
30473052
long identity = Binder.clearCallingIdentity();
30483053
try {

0 commit comments

Comments
 (0)