summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christian Göllner <chrisgollner@google.com> 2023-06-28 09:37:36 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-06-28 09:37:36 +0000
commit00c8d55a0621e8f550cf21b752b53b9d2a358a4d (patch)
tree2ca186022b60753013e692f2e374fccf3eac39a4
parent9dcced7128225f6eb061c1afa1b964eae8796011 (diff)
parentc615401f232230e87a95ab735bc52d4076cdf089 (diff)
Merge "Fix letterbox overlapping with status bar icons after rotating device" into udc-dev am: c615401f23
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23817530 Change-Id: I8f95a22a9362ba7a696bfb18843380441bba2658 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculator.kt2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt24
2 files changed, 25 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculator.kt
index f7426451fa50..a61914a70f59 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculator.kt
@@ -209,7 +209,7 @@ constructor(
if (this.contains(other) || other.contains(this)) {
return false
}
- return this.intersect(other)
+ return this.intersects(other.left, other.top, other.right, other.bottom)
}
override fun dump(pw: PrintWriter, args: Array<out String>) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt
index c0243dc537b5..b2dc0dc984c7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LetterboxAppearanceCalculatorTest.kt
@@ -105,6 +105,30 @@ class LetterboxAppearanceCalculatorTest : SysuiTestCase() {
expect.that(letterboxAppearance.appearanceRegions).isEqualTo(TEST_APPEARANCE_REGIONS)
}
+ /** Regression test for b/287508741 */
+ @Test
+ fun getLetterboxAppearance_withOverlap_doesNotMutateOriginalBounds() {
+ val statusBarStartSideBounds = Rect(left = 0, top = 0, right = 100, bottom = 100)
+ val statusBarEndSideBounds = Rect(left = 200, top = 0, right = 300, bottom = 100)
+ val letterBoxInnerBounds = Rect(left = 150, top = 50, right = 250, bottom = 150)
+ val statusBarStartSideBoundsCopy = Rect(statusBarStartSideBounds)
+ val statusBarEndSideBoundsCopy = Rect(statusBarEndSideBounds)
+ val letterBoxInnerBoundsCopy = Rect(letterBoxInnerBounds)
+ whenever(statusBarBoundsProvider.visibleStartSideBounds)
+ .thenReturn(statusBarStartSideBounds)
+ whenever(statusBarBoundsProvider.visibleEndSideBounds).thenReturn(statusBarEndSideBounds)
+
+ calculator.getLetterboxAppearance(
+ TEST_APPEARANCE,
+ TEST_APPEARANCE_REGIONS,
+ arrayOf(letterboxWithInnerBounds(letterBoxInnerBounds))
+ )
+
+ expect.that(statusBarStartSideBounds).isEqualTo(statusBarStartSideBoundsCopy)
+ expect.that(statusBarEndSideBounds).isEqualTo(statusBarEndSideBoundsCopy)
+ expect.that(letterBoxInnerBounds).isEqualTo(letterBoxInnerBoundsCopy)
+ }
+
@Test
fun getLetterboxAppearance_noOverlap_BackgroundMultiColor_returnsAppearanceWithScrim() {
whenever(letterboxBackgroundProvider.isLetterboxBackgroundMultiColored).thenReturn(true)