mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-24 12:06:19 +00:00
52 lines
2.5 KiB
Diff
52 lines
2.5 KiB
Diff
From 6c209ba8ff77f74d9bad16252ab60c95fd24807e Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Hugues Husson <phh@phh.me>
|
|
Date: Tue, 23 Mar 2021 19:43:26 +0100
|
|
Subject: [PATCH 22/56] Catch broken mainBuiltInDisplayCutoutRectApproximation
|
|
|
|
Some devices (Redmi Note 9T) have:
|
|
mainBuiltInDisplayCutoutRectApproximation = @android:mainBuiltInDisplayCutout
|
|
Since mainBuiltInDisplayCutout is private, its ID is dynamic and can't
|
|
be relied upon.
|
|
This means that we'll get garbage in mainBuiltInDisplayCutoutRectApproximation
|
|
The SVG Path parser will fail, triggering an exception.
|
|
|
|
Fix it by catching it, and parsing mainBuiltInDisplayCutout instead
|
|
|
|
Change-Id: I03b6e78bac2cc38f3a623c8add801405ad6ba7ba
|
|
---
|
|
core/java/android/view/DisplayCutout.java | 18 +++++++++++++-----
|
|
1 file changed, 13 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java
|
|
index 712d1d67c942..5d929873f18d 100644
|
|
--- a/core/java/android/view/DisplayCutout.java
|
|
+++ b/core/java/android/view/DisplayCutout.java
|
|
@@ -1056,11 +1056,19 @@ public final class DisplayCutout {
|
|
public static DisplayCutout fromResourcesRectApproximation(Resources res,
|
|
String displayUniqueId, int physicalDisplayWidth, int physicalDisplayHeight,
|
|
int displayWidth, int displayHeight) {
|
|
- return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId),
|
|
- getDisplayCutoutApproximationRect(res, displayUniqueId), physicalDisplayWidth,
|
|
- physicalDisplayHeight, displayWidth, displayHeight,
|
|
- DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT,
|
|
- getWaterfallInsets(res, displayUniqueId)).second;
|
|
+ try {
|
|
+ return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId),
|
|
+ getDisplayCutoutApproximationRect(res, displayUniqueId), physicalDisplayWidth,
|
|
+ physicalDisplayHeight, displayWidth, displayHeight,
|
|
+ DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT,
|
|
+ getWaterfallInsets(res, displayUniqueId)).second;
|
|
+ } catch(Throwable t) {
|
|
+ return pathAndDisplayCutoutFromSpec(getDisplayCutoutPath(res, displayUniqueId),
|
|
+ null, physicalDisplayWidth,
|
|
+ physicalDisplayHeight, displayWidth, displayHeight,
|
|
+ DENSITY_DEVICE_STABLE / (float) DENSITY_DEFAULT,
|
|
+ getWaterfallInsets(res, displayUniqueId)).second;
|
|
+ }
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.25.1
|
|
|