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>
This commit is contained in:
Mike Lockwood
2011-10-25 09:16:28 -04:00
parent 55174b663b
commit 320a10ad8c

View File

@ -3043,6 +3043,11 @@ public class PowerManagerService extends IPowerManager.Stub
}
if (mSensorManager != null && mLightSensorEnabled != enable) {
mLightSensorEnabled = enable;
// clear previous values so we will adjust to current brightness when
// auto-brightness is reenabled
mHighestLightSensorValue = -1;
mLightSensorValue = -1;
// clear calling identity so sensor manager battery stats are accurate
long identity = Binder.clearCallingIdentity();
try {