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

Commit bb2d3a13 authored by John Reck's avatar John Reck
Browse files

Adjust behavior of HDR transitions

Skipping the animation entirely exposed flickering issues
on some devices. Restrict instead to the OEM-configured transition,
but use the fast one instead.

Bug: 292124102
Test: atest com.android.server.display.DisplayPowerControllerTest
Change-Id: I43d3078e280c23218cb2d8510b4fe3922aa39136
parent a9d2c1f1
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -1628,21 +1628,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
@@ -730,8 +730,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);
@@ -762,12 +762,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);
@@ -802,7 +802,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