Fixed temporary brightness getting stuck bug.

When the user would set the brightness to the same value, the
temporary brightness would remain applied, effectively disabling
auto-brightness and confusing the system state.

Test: Drag the slider to an extremity (e.g. maximum), let it go, and
      then re-drag the slider to the same place (e.g. place your finger
      on the middle of the slider and move it to the maximum again).
      run adb shell dumpsys display | grep mAppliedTemporaryBrightness
      to check whether temporary brightness is applied; should be false.

Change-Id: I819ef2dc04e0cbabc4a210bd0703e0eeab157b93
Merged-In: Id3a1bff533b1bee9ca760e742dab379eeeb4b14e
Fixes: 122554527
This commit is contained in:
Dan Gittik
2019-01-30 17:46:25 +00:00
parent 64ca10b75b
commit 7c93cefc81

View File

@@ -791,9 +791,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
&& mAutomaticBrightnessController != null;
final boolean userSetBrightnessChanged = updateUserSetScreenBrightness();
if (userSetBrightnessChanged) {
mTemporaryScreenBrightness = -1;
}
// Use the temporary screen brightness if there isn't an override, either from
// WindowManager or based on the display state.
@@ -1514,11 +1511,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
}
if (mCurrentScreenBrightnessSetting == mPendingScreenBrightnessSetting) {
mPendingScreenBrightnessSetting = -1;
mTemporaryScreenBrightness = -1;
return false;
}
mCurrentScreenBrightnessSetting = mPendingScreenBrightnessSetting;
mLastUserSetScreenBrightness = mPendingScreenBrightnessSetting;
mPendingScreenBrightnessSetting = -1;
mTemporaryScreenBrightness = -1;
return true;
}