mirror of
https://github.com/ponces/treble_aosp.git
synced 2025-04-19 18:16:00 +00:00
45 lines
2.2 KiB
Diff
45 lines
2.2 KiB
Diff
From 0958a593997836696678ec3120184557438880a8 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 41/56] Add a prop to use linear backlight control
|
|
|
|
---
|
|
.../settings/brightness/BrightnessController.java | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 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 90d27f4b33e9..ce5b5e105e52 100644
|
|
--- a/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
|
|
+++ b/packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessController.java
|
|
@@ -386,9 +386,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,
|
|
@@ -402,8 +408,8 @@ public class BrightnessController implements ToggleSlider.Listener, MirroredBrig
|
|
if (!tracking) {
|
|
AsyncTask.execute(new Runnable() {
|
|
public void run() {
|
|
- logBrightnessChange(mDisplayId, valFloat, false);
|
|
- mDisplayManager.setBrightness(mDisplayId, valFloat);
|
|
+ logBrightnessChange(mDisplayId, finalValFloat, false);
|
|
+ mDisplayManager.setBrightness(mDisplayId, finalValFloat);
|
|
}
|
|
});
|
|
}
|
|
--
|
|
2.43.0
|
|
|