DisplayCutout: Dispatch all non-zero safeInsets
Ensures that even if the display cutout does not overlap
a window, the safe insets are still dispatched if the window
overlaps any part of the cutout area and the safe insets
are therefore non-zero.
To do that, we need to compute the insets once against the
display size, then only shrink or expand the safe insets
accordingly.
Bug: 73533636
Test: atest DisplayCutoutTest
Change-Id: I1ea449178e29c7effdd92cac78af1a3875ca7e70
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index 0b3e9e5..903f3aa 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -387,11 +387,10 @@
}
private boolean hasCutout() {
- if (mInfo.displayCutout == null) {
+ final DisplayCutout displayCutout = mInfo.displayCutout;
+ if (displayCutout == null) {
return false;
}
- DisplayCutout displayCutout = mInfo.displayCutout.calculateRelativeTo(
- new Rect(0, 0, mInfo.logicalWidth, mInfo.logicalHeight));
if (mStart) {
return displayCutout.getSafeInsetLeft() > 0
|| displayCutout.getSafeInsetTop() > 0;