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

Commit 270ea415 authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Fix Walleye dim brightness curves

This fixes the issue that cause -1.0f to be added to the brightness
curves when a devices had 0 in the backlight configuration
(config_screenBrightnessBacklight) in config.xml.

This code is the same as it originally was before the float brightness changes.

Bug: 153290107

Test: manual, check values in `adb shell dumpsys display | grep -i
"spline\|mconfig\|mambientlux"`

Change-Id: I332fc09565b26bfc5f108fe32bf109f9584c60a2
parent 3443ba8d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ 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;
@@ -342,10 +341,11 @@ public abstract class BrightnessMappingStrategy {
        }
    }

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

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