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

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

Fix brightness slider - allow minimum value

ag/11455081 stopped the brightness slider from reaching the minimum value. This change reverts this but other changes in this topic also change the Walleye initial curves to start at 1 instead of 0.

Bug: 157838219

Test: manual - cover ambient light sensor - ensure brightness reduces
but not to 0. Move the slider to min and check that it stays there. grep for brightness splines too:
adb shell dumpsys display | grep -i "spline\|mConfig"

Change-Id: I26334986d299d297e6d1e320222566b22497b2ff
parent 829ac140
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.util.Pair;
import android.util.Slog;
import android.util.Spline;

import com.android.internal.BrightnessSynchronizer;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Preconditions;
import com.android.server.display.utils.Plog;
@@ -348,9 +349,9 @@ public abstract class BrightnessMappingStrategy {

    // Normalize entire brightness range to 0 - 1.
    protected static float normalizeAbsoluteBrightness(int brightness) {
        brightness = MathUtils.constrain(brightness,
                PowerManager.BRIGHTNESS_OFF, PowerManager.BRIGHTNESS_ON);
        return (float) brightness / PowerManager.BRIGHTNESS_ON;
        return BrightnessSynchronizer.brightnessIntToFloat(brightness,
                PowerManager.BRIGHTNESS_OFF + 1, PowerManager.BRIGHTNESS_ON,
                PowerManager.BRIGHTNESS_MIN, PowerManager.BRIGHTNESS_MAX);
    }

    private Pair<float[], float[]> insertControlPoint(