1
0
mirror of https://github.com/ponces/treble_aosp.git synced 2024-11-24 20:16:22 +00:00
treble_aosp/patches/trebledroid/platform_frameworks_base/0014-Fix-brightness-range-not-being-complete-on-Samsung-d.patch
2024-07-21 01:50:08 +01:00

38 lines
1.9 KiB
Diff

From e59e6b83921f4094f154fb721c75b86cf863d471 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/54] 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 a172de0bb0ff..4244c03d8744 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -1203,9 +1203,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.34.1