1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 08:36:19 +00:00
treble_evolution/patches/platform_frameworks_base/0043-Add-a-prop-to-use-linear-backlight-control.patch
2024-04-24 15:13:17 +00:00

43 lines
2.1 KiB
Diff

From 90b7513cbbc99c7e2de0cf51b5bbc69c45a2fce2 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 30 Oct 2023 19:25:27 -0400
Subject: [PATCH 43/51] Add a prop to use linear backlight control
---
.../settings/brightness/BrightnessController.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
index 6af9b739da52..65e32255dcad 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
@@ -346,9 +346,15 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
: MetricsEvent.ACTION_BRIGHTNESS;
minBacklight = mBrightnessMin;
maxBacklight = mBrightnessMax;
- final float valFloat = MathUtils.min(
+ float valFloat = MathUtils.min(
convertGammaToLinearFloat(value, minBacklight, maxBacklight),
maxBacklight);
+ if (android.os.SystemProperties.getBoolean("persist.sys.phh.linear_brightness", false)) {
+ android.util.Log.e("PHH", "Linear brightness val " + value + " from " + minBacklight + " to " + maxBacklight + " makes " + valFloat);
+ valFloat = value / 65536.0f;
+ }
+ final float finalValFloat = valFloat;
+
if (stopTracking) {
// TODO(brightnessfloat): change to use float value instead.
MetricsLogger.action(mContext, metric,
@@ -359,7 +365,7 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
if (!tracking) {
AsyncTask.execute(new Runnable() {
public void run() {
- mDisplayManager.setBrightness(mDisplayId, valFloat);
+ mDisplayManager.setBrightness(mDisplayId, finalValFloat);
}
});
}
--
2.25.1