summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java13
-rw-r--r--services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java10
2 files changed, 19 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 7a5a6c5a9ae8..1b4a733246b8 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5244,9 +5244,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final boolean attachedInParent = attached != null && !layoutInScreen;
// Ensure that windows with a DEFAULT or NEVER display cutout mode are laid out in
// the cutout safe zone.
- // Windows that are attached to a parent and laid out in said parent are already avoiding
- // the cutout according to that parent and don't need to be further constrained.
- if (cutoutMode != LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS && !attachedInParent) {
+ if (cutoutMode != LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS) {
final Rect displayCutoutSafeExceptMaybeTop = mTmpRect;
displayCutoutSafeExceptMaybeTop.set(displayFrames.mDisplayCutoutSafe);
if (layoutInScreen && layoutInsetDecor && !requestedFullscreen
@@ -5257,7 +5255,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// the window from that area.
displayCutoutSafeExceptMaybeTop.top = Integer.MIN_VALUE;
}
- pf.intersectUnchecked(displayCutoutSafeExceptMaybeTop);
+ // Windows that are attached to a parent and laid out in said parent are already
+ // avoidingthe cutout according to that parent and don't need to be further constrained.
+ if (!attachedInParent) {
+ pf.intersectUnchecked(displayCutoutSafeExceptMaybeTop);
+ }
+ // Make sure that NO_LIMITS windows clipped to the display don't extend into the display
+ // don't extend under the cutout.
+ df.intersectUnchecked(displayCutoutSafeExceptMaybeTop);
}
// Content should never appear in the cutout.
diff --git a/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
index 293f9afeea22..c6800be343af 100644
--- a/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
+++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
@@ -77,6 +77,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
+ assertInsetBy(mAppWindow.displayFrame, 0, 0, 0, 0);
}
@Test
@@ -91,6 +92,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.displayFrame, 0, NAV_BAR_HEIGHT);
}
@Test
@@ -106,6 +108,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.displayFrame, 0, NAV_BAR_HEIGHT);
}
@Test
@@ -130,6 +133,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
+ assertInsetByTopBottom(mAppWindow.displayFrame, 0, 0);
}
@Test
@@ -146,6 +150,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
+ assertInsetByTopBottom(mAppWindow.displayFrame, STATUS_BAR_HEIGHT, 0);
}
@Test
@@ -162,6 +167,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
+ assertInsetBy(mAppWindow.displayFrame, 0, 0, 0, 0);
}
@Test
@@ -178,6 +184,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
+ assertInsetByTopBottom(mAppWindow.displayFrame, STATUS_BAR_HEIGHT, 0);
}
@Test
@@ -195,6 +202,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
+ assertInsetByTopBottom(mAppWindow.displayFrame, 0, 0);
}
@@ -212,6 +220,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetBy(mAppWindow.contentFrame,
DISPLAY_CUTOUT_HEIGHT, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
assertInsetBy(mAppWindow.decorFrame, 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.displayFrame, DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
}
@Test
@@ -228,6 +237,7 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
assertInsetBy(mAppWindow.contentFrame,
NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT, DISPLAY_CUTOUT_HEIGHT, 0);
assertInsetBy(mAppWindow.decorFrame, 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.displayFrame, 0, 0, DISPLAY_CUTOUT_HEIGHT, 0);
}
@Test