Fix crash on device without nits-backlight mapping

When there is no nits mapping, we sent NaN for the
sdr backlight value, which is invalid. Instead, send
the same (valid) backlight value for normal and SDR
brightnesses.

Bug: 186895034
Test: Manually verify that a device without nit-backlight
      mapping can still boot normally.
Change-Id: Ie6786fa17776674d914e66727f324368831f6761
This commit is contained in:
Santos Cordon
2021-05-01 11:10:50 +01:00
parent 096c8547d3
commit 01b6dd29ff

View File

@@ -790,7 +790,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
try {
final float backlight = brightnessToBacklight(brightness);
float nits = NITS_INVALID;
float sdrBacklight = PowerManager.BRIGHTNESS_INVALID_FLOAT;
float sdrBacklight = backlight;
float sdrNits = NITS_INVALID;
if (getDisplayDeviceConfig().hasNitsMapping()
&& sdrBrightness != PowerManager.BRIGHTNESS_INVALID_FLOAT) {