Merge "Fix the issue of using SilkFx crash on non-HDR-supported phone." into udc-dev am: 9cdcda8d45

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23395745

Change-Id: Ifbcc4fcfb2dda35cd16c5cbf0b0c537f5c1f1fdf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Sally Qi
2023-05-30 16:04:23 +00:00
committed by Automerger Merge Worker
3 changed files with 12 additions and 1 deletions

View File

@@ -888,6 +888,13 @@ public class DisplayDeviceConfig {
return mBacklightToNitsSpline.interpolate(backlight); return mBacklightToNitsSpline.interpolate(backlight);
} }
/**
* @return true if there is sdrHdrRatioMap, false otherwise.
*/
public boolean hasSdrToHdrRatioSpline() {
return mSdrToHdrRatioSpline != null;
}
/** /**
* Calculate the HDR brightness for the specified SDR brightenss, restricted by the * Calculate the HDR brightness for the specified SDR brightenss, restricted by the
* maxDesiredHdrSdrRatio (the ratio between the HDR luminance and SDR luminance) * maxDesiredHdrSdrRatio (the ratio between the HDR luminance and SDR luminance)

View File

@@ -888,7 +888,9 @@ final class LocalDisplayAdapter extends DisplayAdapter {
BrightnessSynchronizer.brightnessFloatToInt( BrightnessSynchronizer.brightnessFloatToInt(
sdrBrightnessState)); sdrBrightnessState));
handleHdrSdrNitsChanged(nits, sdrNits); if (getDisplayDeviceConfig().hasSdrToHdrRatioSpline()) {
handleHdrSdrNitsChanged(nits, sdrNits);
}
} finally { } finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER); Trace.traceEnd(Trace.TRACE_TAG_POWER);

View File

@@ -27,6 +27,7 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@@ -981,6 +982,7 @@ public class LocalDisplayAdapterTest {
DisplayDevice displayDevice = mListener.addedDisplays.get(0); DisplayDevice displayDevice = mListener.addedDisplays.get(0);
// Turn on / initialize // Turn on / initialize
assumeTrue(displayDevice.getDisplayDeviceConfig().hasSdrToHdrRatioSpline());
Runnable changeStateRunnable = displayDevice.requestDisplayStateLocked(Display.STATE_ON, 0, Runnable changeStateRunnable = displayDevice.requestDisplayStateLocked(Display.STATE_ON, 0,
0); 0);
changeStateRunnable.run(); changeStateRunnable.run();