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

Commit 35728666 authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Fix DisplayDeviceConfig crash for values > 255

If screenBrightnessBacklight values in a config.xml file go above 255,
they leave a string of 1.0 values for every one that is above that. This
change ensures that this does not happen, and clamps the array so that
it contains a maximum of 1 value of 1.0.

Bug: 197491062
Test: manual - change config.xml config_screenBrightnessBacklight to go above 255
Change-Id: Id245ea902f265aa86a2caeff9d24a67fad4c37f7
parent 35062e84
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -590,7 +590,7 @@ public class DisplayDeviceConfig {
            newIndex = i - newStart;
            final float newBacklightVal;
            final float newNitsVal;
            isLastValue = mRawBacklight[i] > mBacklightMaximum
            isLastValue = mRawBacklight[i] >= mBacklightMaximum
                    || i >= mRawBacklight.length - 1;
            // Clamp beginning and end to valid backlight values.
            if (newIndex == 0) {