diff options
| author | 2024-01-31 13:52:10 -0500 | |
|---|---|---|
| committer | 2024-01-31 13:53:46 -0500 | |
| commit | bb2d3a13aa739dddbe5209f8d0189ebe22a587f2 (patch) | |
| tree | 9fb0ed0c6a8c1feb05b37d40a0de167bda7dc9e9 | |
| parent | a9d2c1f17c2c128231df3d0aa771b55f697d3f61 (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/display/DisplayPowerController.java | 17 | ||||
| -rw-r--r-- | services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java | 8 |
2 files changed, 7 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 087cacf9a570..8903d43c4c48 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -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, diff --git a/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java b/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java index 88a9758991f4..51f2a44b37a1 100644 --- a/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java +++ b/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java @@ -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 |