diff options
author | Beverly Tai <beverlyt@google.com> | 2020-03-19 18:28:44 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-03-26 16:14:16 +0000 |
commit | 46a8f767244fabf8e3da01acc4b8f76be1011d15 (patch) | |
tree | 93ada276f339ce13e872971c4e1c8e926f0b3e6a | |
parent | 515575813eb17f771e08812d839cea47707097e0 (diff) | |
download | base-46a8f767244fabf8e3da01acc4b8f76be1011d15.tar.gz |
DO NOT MERGE use left/right insets instead of cutout
Icons are being cut off when the app letterboxes (b/151868088)
Note: icons will be inset even when the app isn't letterboxing.
Fixes: 151868088
Change-Id: I870849628a3ff724fd73f36261c87ea23d858f1a
(cherry picked from commit 60023559ea0219273e0680a7b559392230172fd6)
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 63f4f1161a2f..2835201df243 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -380,7 +380,6 @@ public class PhoneStatusBarView extends PanelBar { * Returns a Pair of integers where * - Pair.first is the left margin inset * - Pair.second is the right margin inset - * This method always assumes the cutout is on the top when the device is in portrait mode. */ public static Pair<Integer, Integer> cornerCutoutMargins(DisplayCutout cutout, Display display) { @@ -395,22 +394,13 @@ public class PhoneStatusBarView extends PanelBar { Point size = new Point(); display.getRealSize(size); - Rect bounds = new Rect(); - switch (rotationOrientation) { - case RotationUtils.ROTATION_LANDSCAPE: - boundsFromDirection(cutout, Gravity.LEFT, bounds); - break; - case RotationUtils.ROTATION_SEASCAPE: - boundsFromDirection(cutout, Gravity.RIGHT, bounds); - break; - case RotationUtils.ROTATION_NONE: - boundsFromDirection(cutout, Gravity.TOP, bounds); - break; - case RotationUtils.ROTATION_UPSIDE_DOWN: - // we assume the cutout is always on top in portrait mode - return null; + if (rotationOrientation != RotationUtils.ROTATION_NONE) { + return new Pair<>(cutout.getSafeInsetLeft(), cutout.getSafeInsetRight()); } + Rect bounds = new Rect(); + boundsFromDirection(cutout, Gravity.TOP, bounds); + if (statusBarHeight >= 0 && bounds.top > statusBarHeight) { return null; } |