Allowing autobrightness to be enabled in the temporary brightness

state

This fixes the issue where the brightness wouldnt change when the slider
is moved when autobrightness is enabled.

Bug: 262355667
Test: Manually move the slider with autobrightness enabled, and confirm
that the brightness changes and do not return back to the initial point.

Change-Id: Ic21b6c42c446ec4fca0e4cc203ef5e9c5211ffcd
This commit is contained in:
Rupesh Bansal
2022-12-28 06:17:46 +00:00
parent bb9a1f6c50
commit ddb7353bd8
3 changed files with 3 additions and 4 deletions

View File

@@ -1192,7 +1192,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
&& Display.isDozeState(state);
final boolean autoBrightnessEnabled = mUseAutoBrightness
&& (state == Display.STATE_ON || autoBrightnessEnabledInDoze)
&& Float.isNaN(brightnessState)
&& (Float.isNaN(brightnessState)
|| mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_TEMPORARY
|| mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_BOOST)
&& mAutomaticBrightnessController != null;
final boolean autoBrightnessDisabledDueToDisplayOff = mUseAutoBrightness
&& !(state == Display.STATE_ON || autoBrightnessEnabledInDoze);

View File

@@ -48,7 +48,6 @@ public class TemporaryBrightnessStrategy implements DisplayBrightnessStrategy {
BrightnessUtils.constructDisplayBrightnessState(BrightnessReason.REASON_TEMPORARY,
mTemporaryScreenBrightness,
mTemporaryScreenBrightness);
mTemporaryScreenBrightness = Float.NaN;
return displayBrightnessState;
}

View File

@@ -59,8 +59,6 @@ public class TemporaryBrightnessStrategyTest {
DisplayBrightnessState updatedDisplayBrightnessState =
mTemporaryBrightnessStrategy.updateBrightness(displayPowerRequest);
assertEquals(updatedDisplayBrightnessState, expectedDisplayBrightnessState);
assertEquals(mTemporaryBrightnessStrategy.getTemporaryScreenBrightness(),
Float.NaN, 0.0f);
}
}