mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-24 12:06:19 +00:00
87 lines
3.7 KiB
Diff
87 lines
3.7 KiB
Diff
From 3e2f0164bd7754ad039c7e9b8416c29583c632a2 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/56] 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 b0ebab8e4002..77dafd5068d0 100644
|
|
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
|
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
|
|
@@ -1903,37 +1903,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
|
|
|