1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 12:06:19 +00:00
treble_evolution/patches/trebledroid/platform_frameworks_base/0002-Fallback-to-stupid-autobrightness-if-brightness-valu.patch
2024-03-10 06:48:11 +00:00

40 lines
1.6 KiB
Diff

From 8e44908ad28d719314f39baa42e188cdbe65f9e4 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 5 Oct 2021 17:59:16 -0400
Subject: [PATCH 02/56] Fallback to stupid autobrightness if brightness values
are broken
This is needed because of:
`ava.lang.IllegalArgumentException: The control points must all have strictly increasing X values.`
on some Samsung devices
Change-Id: Ieb679b34239013a5e31b34cb010b12febd9ef6d9
---
.../com/android/server/display/DisplayDeviceConfig.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
index 2464eb0141b8..b0ebab8e4002 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
@@ -777,9 +777,14 @@ public class DisplayDeviceConfig {
* @return A configuration instance.
*/
public static DisplayDeviceConfig create(Context context, boolean useConfigXml) {
- final DisplayDeviceConfig config;
+ DisplayDeviceConfig config;
if (useConfigXml) {
- config = getConfigFromGlobalXml(context);
+ try {
+ config = getConfigFromGlobalXml(context);
+ } catch(Exception e) {
+ android.util.Log.e("PHH", "Failed parsing automatic brightness values, fallbacking", e);
+ config = getConfigFromPmValues(context);
+ }
} else {
config = getConfigFromPmValues(context);
}
--
2.25.1