Fix brightness transition from temporary to automatic brightness

Because the strategy evaluation is now happening before deciding if the
brightness is user set or not, we can end up in a state where the
temporary brightness strategy would win over automatic.

Bug: 276702594
Test: Manually verified the transitions are as expected
Change-Id: Ie8191312f9c5684832254de52657e04d5c8f1148
This commit is contained in:
Rupesh Bansal
2023-04-03 10:15:40 +00:00
parent 33a3130230
commit f426112709

View File

@@ -1206,14 +1206,15 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
// actual state instead of the desired one.
animateScreenStateChange(state, mDisplayStateController.shouldPerformScreenOffTransition());
state = mPowerState.getScreenState();
final boolean userSetBrightnessChanged = mDisplayBrightnessController
.updateUserSetScreenBrightness();
DisplayBrightnessState displayBrightnessState = mDisplayBrightnessController
.updateBrightness(mPowerRequest, state);
float brightnessState = displayBrightnessState.getBrightness();
float rawBrightnessState = displayBrightnessState.getBrightness();
mBrightnessReasonTemp.set(displayBrightnessState.getBrightnessReason());
final boolean userSetBrightnessChanged = mDisplayBrightnessController
.updateUserSetScreenBrightness();
// Take note if the short term model was already active before applying the current
// request changes.
final boolean wasShortTermModelActive =