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/0014-Fix-brightness-range-not-being-complete-on-Samsung-d.patch
2024-04-24 15:13:17 +00:00

38 lines
1.9 KiB
Diff

From 6da5d40fb7e20fabcc65201afe9769a7310eb7e0 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/51] 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 ec5172fca5fa..4ac249fa6be1 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -1188,9 +1188,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