From f42611270908ea8cefaff940d7f83b4957da3625 Mon Sep 17 00:00:00 2001 From: Rupesh Bansal Date: Mon, 3 Apr 2023 10:15:40 +0000 Subject: 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 --- .../java/com/android/server/display/DisplayPowerController2.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/display/DisplayPowerController2.java b/services/core/java/com/android/server/display/DisplayPowerController2.java index 5306ac0e57b9..8ce4b66eba28 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController2.java +++ b/services/core/java/com/android/server/display/DisplayPowerController2.java @@ -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 = -- cgit v1.2.3-59-g8ed1b