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

Commit b43432bc authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Adjust behavior of HDR transitions" into main

parents b5563b49 bb2d3a13
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -1638,21 +1638,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                    // SDR brightness is unchanged, so animate quickly as this is only impacting
                    // a likely minority amount of display content
                    // ie, the highlights of an HDR video or UltraHDR image
                    // Ideally we'd do this as fast as possible (ie, skip the animation entirely),
                    // but this requires display support and would need an entry in the
                    // display configuration. For now just do the fast animation
                    slowChange = false;

                    // Going from HDR to no HDR; visually this should be a "no-op" anyway
                    // as the remaining SDR content's brightness should be holding steady
                    // due to the sdr brightness not shifting
                    if (BrightnessSynchronizer.floatEquals(sdrAnimateValue, animateValue)) {
                        skipAnimation = true;
                    }

                    // Going from no HDR to HDR; visually this is a significant scene change
                    // and the animation just prevents advanced clients from doing their own
                    // handling of enter/exit animations if they would like to do such a thing
                    if (BrightnessSynchronizer.floatEquals(sdrAnimateValue, currentBrightness)) {
                        skipAnimation = true;
                    }
                }
                if (skipAnimation) {
                    animateScreenBrightness(animateValue, sdrAnimateValue,
+4 −4
Original line number Diff line number Diff line
@@ -725,8 +725,8 @@ public final class DisplayPowerControllerTest {
    }

    @Test
    @RequiresFlagsEnabled(Flags.FLAG_FAST_HDR_TRANSITIONS)
    public void testDisplayBrightnessHdr_SkipAnimationOnHdrAppearance() {
        when(mDisplayManagerFlagsMock.isFastHdrTransitionsEnabled()).thenReturn(true);
        Settings.System.putInt(mContext.getContentResolver(),
                Settings.System.SCREEN_BRIGHTNESS_MODE,
                Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
@@ -757,12 +757,12 @@ public final class DisplayPowerControllerTest {
        advanceTime(1); // Run updatePowerState

        verify(mHolder.animator).animateTo(eq(hdrBrightness), eq(sdrBrightness),
                eq(BRIGHTNESS_RAMP_RATE_MINIMUM), eq(false));
                eq(BRIGHTNESS_RAMP_RATE_FAST_INCREASE), eq(false));
    }

    @Test
    @RequiresFlagsEnabled(Flags.FLAG_FAST_HDR_TRANSITIONS)
    public void testDisplayBrightnessHdr_SkipAnimationOnHdrRemoval() {
        when(mDisplayManagerFlagsMock.isFastHdrTransitionsEnabled()).thenReturn(true);
        Settings.System.putInt(mContext.getContentResolver(),
                Settings.System.SCREEN_BRIGHTNESS_MODE,
                Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
@@ -797,7 +797,7 @@ public final class DisplayPowerControllerTest {
        advanceTime(1); // Run updatePowerState

        verify(mHolder.animator).animateTo(eq(sdrBrightness), eq(sdrBrightness),
                eq(BRIGHTNESS_RAMP_RATE_MINIMUM), eq(false));
                eq(BRIGHTNESS_RAMP_RATE_FAST_DECREASE), eq(false));
    }

    @Test