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

Commit 41dba274 authored by Piotr Wilczyński's avatar Piotr Wilczyński Committed by Android (Google) Code Review
Browse files

Merge "Keep DOZE_INITIAL brightness in setting" into main

parents d0f0810c eba8c934
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1442,6 +1442,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call

        // If there's an offload session, we need to set the initial doze brightness before
        // the offload session starts controlling the brightness.
        // During the transition DOZE_SUSPEND -> DOZE -> DOZE_SUSPEND, this brightness strategy
        // will be selected again, meaning that no new brightness will be sent to the hardware and
        // the display will stay at the brightness level set by the offload session.
        if (Float.isNaN(brightnessState) && mFlags.isDisplayOffloadEnabled()
                && Display.isDozeState(state) && mDisplayOffloadSession != null) {
            if (mAutomaticBrightnessController != null
@@ -1459,6 +1462,15 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            if (BrightnessUtils.isValidBrightnessValue(rawBrightnessState)) {
                brightnessState = clampScreenBrightness(rawBrightnessState);
                mBrightnessReasonTemp.setReason(BrightnessReason.REASON_DOZE_INITIAL);

                if (mAutomaticBrightnessController != null
                        && mAutomaticBrightnessStrategy.shouldUseAutoBrightness()) {
                    // Keep the brightness in the setting so that we can use it after the screen
                    // turns on, until a lux sample becomes available. We don't do this when
                    // auto-brightness is disabled - in that situation we still want to use
                    // the last brightness from when the screen was on.
                    updateScreenBrightnessSetting = currentBrightnessSetting != brightnessState;
                }
            }
        }

+1 −0
Original line number Diff line number Diff line
@@ -1790,6 +1790,7 @@ public final class DisplayPowerControllerTest {
        verify(mHolder.animator).animateTo(eq(brightness),
                /* linearSecondTarget= */ anyFloat(), /* rate= */ anyFloat(),
                /* ignoreAnimationLimits= */ anyBoolean());
        verify(mHolder.brightnessSetting).setBrightness(brightness);
    }

    @Test