Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3beaadb2 authored by Piotr Wilczyński's avatar Piotr Wilczyński
Browse files

Restoring SDR brightness immediately when entering dim state if the

device is in HDR brightness scale mode.

Because the mBrightnessReason.modifier is updated after scaling HDR
brightness by calling mHbmController.getHdrBrightnessValue(), so
if the device is entering dim state, the brightness will still
scaling to HDR brightness, instead of setting to dim brightness
directly.

Bug: 274763122

Test: atest BrightnessThrottlerTest DisplayModeDirectorTest BrightnessLevelPreferenceControllerTest HighBrightnessModeControllerTest
Test: Manually operations:
1. Enable HBM function;
2. Open a HDR layer;
3. Wait until the screen is dimming;
4. Check related logs.

Change-Id: Ie8ba03cfdd4a8aa446071e05db1c302182a92939
parent 8e9d00cd
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1799,10 +1799,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            // TODO(b/216365040): The decision to prevent HBM for HDR in low power mode should be
            // done in HighBrightnessModeController.
            if (mHbmController.getHighBrightnessMode() == BrightnessInfo.HIGH_BRIGHTNESS_MODE_HDR
                    && (mBrightnessReason.getModifier() & BrightnessReason.MODIFIER_DIMMED) == 0
                    && (mBrightnessReason.getModifier() & BrightnessReason.MODIFIER_LOW_POWER)
                    && (mBrightnessReasonTemp.getModifier() & BrightnessReason.MODIFIER_DIMMED) == 0
                    && (mBrightnessReasonTemp.getModifier() & BrightnessReason.MODIFIER_LOW_POWER)
                    == 0) {
                // We want to scale HDR brightness level with the SDR level
                // We want to scale HDR brightness level with the SDR level, we also need to restore
                // SDR brightness immediately when entering dim or low power mode.
                animateValue = mHbmController.getHdrBrightnessValue();
            }

+4 −3
Original line number Diff line number Diff line
@@ -1507,10 +1507,11 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            // TODO(b/216365040): The decision to prevent HBM for HDR in low power mode should be
            // done in HighBrightnessModeController.
            if (mHbmController.getHighBrightnessMode() == BrightnessInfo.HIGH_BRIGHTNESS_MODE_HDR
                    && (mBrightnessReason.getModifier() & BrightnessReason.MODIFIER_DIMMED) == 0
                    && (mBrightnessReason.getModifier() & BrightnessReason.MODIFIER_LOW_POWER)
                    && (mBrightnessReasonTemp.getModifier() & BrightnessReason.MODIFIER_DIMMED) == 0
                    && (mBrightnessReasonTemp.getModifier() & BrightnessReason.MODIFIER_LOW_POWER)
                    == 0) {
                // We want to scale HDR brightness level with the SDR level
                // We want to scale HDR brightness level with the SDR level, we also need to restore
                // SDR brightness immediately when entering dim or low power mode.
                animateValue = mHbmController.getHdrBrightnessValue();
            }