1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-28 04:44:30 +00:00
treble_evolution/patches/trebledroid/platform_frameworks_base/0014-Fix-brightness-range-not-being-complete-on-Samsung-d.patch
2024-03-10 06:48:11 +00:00

38 lines
1.9 KiB
Diff

From 97ca8d827fce93acac498bf66d1cfdf651c7d5e8 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 29 Sep 2020 22:40:10 +0200
Subject: [PATCH 14/56] Fix brightness range not being complete on Samsung
devices
On some devices, minimum brightness is 0, which totally messes with
Brightness computations (minimum float brightness becomes -1.0 instead
of 0.0...).
Cheat and have them report 1 as minimum instead, which fixes the slope
Change-Id: I4d97cbc32490949e83272b81ec6320a5483310b1
---
.../java/com/android/server/power/PowerManagerService.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index d82f7a56a830..fe397d53c5d6 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -1191,9 +1191,11 @@ public final class PowerManagerService extends SystemService
if (min == INVALID_BRIGHTNESS_IN_CONFIG || max == INVALID_BRIGHTNESS_IN_CONFIG
|| def == INVALID_BRIGHTNESS_IN_CONFIG) {
+ int correctedMin = mContext.getResources().getInteger(com.android.internal.R.integer
+ .config_screenBrightnessSettingMinimum);
+ if(correctedMin == 0) correctedMin = 1;
mScreenBrightnessMinimum = BrightnessSynchronizer.brightnessIntToFloat(
- mContext.getResources().getInteger(com.android.internal.R.integer
- .config_screenBrightnessSettingMinimum));
+ correctedMin);
mScreenBrightnessMaximum = BrightnessSynchronizer.brightnessIntToFloat(
mContext.getResources().getInteger(com.android.internal.R.integer
.config_screenBrightnessSettingMaximum));
--
2.25.1