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

Commit 9d29aa97 authored by nadlabak's avatar nadlabak
Browse files

PowerManagerService: fix getAutoBrightnessValue for btn/kbd

getAutoBrightnessValue calculations are correct only for LCD
backlight brightness values increasing with higher light values.
Skip the calculation for the reversed button/keyboard backlight
arrays, where the backlight brightness decreases with increasing
light values.

Change-Id: Ib72b8325fe2b0f83780e91dc94eea2e38061224b
parent 49c83850
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2636,6 +2636,11 @@ public class PowerManagerService extends IPowerManager.Stub
            // This is the range of brightness values that we can use.
            final int minval = values[0];
            final int maxval = values[mAutoBrightnessLevels.length];
            if (minval > maxval) {
                // this is a button or keyboard brightness where brightness
                // is in reversed order to sensor values
                return values[i];
            }
            // This is the range we will be scaling.  We put some padding
            // at the low and high end to give the adjustment a little better
            // impact on the actual observed value.