-
Notifications
You must be signed in to change notification settings - Fork 36
/
0031-Try-catch-around-constrainNitsAndBacklightArrays-and.patch
86 lines (78 loc) · 3.66 KB
/
0031-Try-catch-around-constrainNitsAndBacklightArrays-and.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 456b5ce0a795047b48595967c2f436cbbf645bf0 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/46] 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.34.1