1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 09:46:19 +00:00
treble_evolution/patches/platform_frameworks_base/0031-Try-catch-around-constrainNitsAndBacklightArrays-and.patch
2024-04-24 15:13:17 +00:00

87 lines
3.7 KiB
Diff

From 1decc4c97995159562c0a1366fd86a41456ea520 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Fri, 2 Jun 2023 19:19:31 -0400
Subject: [PATCH 31/51] Try catch around constrainNitsAndBacklightArrays, and
falls back to dumb curve. It crashes on Xperia 1 IV.
---
.../server/display/DisplayDeviceConfig.java | 56 ++++++++++---------
1 file changed, 31 insertions(+), 25 deletions(-)
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
index 3dcb84dad786..9585bdc712cd 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
@@ -2120,37 +2120,43 @@ public class DisplayDeviceConfig {
return;
}
- // Use the (preferred) display device config mapping
- final List<Point> points = map.getPoint();
- final int size = points.size();
+ try {
+ // Use the (preferred) display device config mapping
+ final List<Point> points = map.getPoint();
+ final int size = points.size();
- float[] nits = new float[size];
- float[] backlight = new float[size];
+ float[] nits = new float[size];
+ float[] backlight = new float[size];
- mInterpolationType = convertInterpolationType(map.getInterpolation());
- int i = 0;
- for (Point point : points) {
- nits[i] = point.getNits().floatValue();
- backlight[i] = point.getValue().floatValue();
- if (i > 0) {
- if (nits[i] < nits[i - 1]) {
- Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
- + " of configuration. Nits: " + nits[i] + " < " + nits[i - 1]);
- return;
- }
+ mInterpolationType = convertInterpolationType(map.getInterpolation());
+ int i = 0;
+ for (Point point : points) {
+ nits[i] = point.getNits().floatValue();
+ backlight[i] = point.getValue().floatValue();
+ if (i > 0) {
+ if (nits[i] < nits[i - 1]) {
+ Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
+ + " of configuration. Nits: " + nits[i] + " < " + nits[i - 1]);
+ return;
+ }
- if (backlight[i] < backlight[i - 1]) {
- Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
- + " of configuration. Value: " + backlight[i] + " < "
- + backlight[i - 1]);
- return;
+ if (backlight[i] < backlight[i - 1]) {
+ Slog.e(TAG, "screenBrightnessMap must be non-decreasing, ignoring rest "
+ + " of configuration. Value: " + backlight[i] + " < "
+ + backlight[i - 1]);
+ return;
+ }
}
+ ++i;
}
- ++i;
+ mRawNits = nits;
+ mRawBacklight = backlight;
+ constrainNitsAndBacklightArrays();
+ } catch(Throwable t) {
+ mRawNits = null;
+ mRawBacklight = null;
+ setSimpleMappingStrategyValues();
}
- mRawNits = nits;
- mRawBacklight = backlight;
- constrainNitsAndBacklightArrays();
}
private Spline loadSdrHdrRatioMap(HighBrightnessMode hbmConfig) {
--
2.25.1