Rotate landscape display before testing cutouts.
Current cutout logic assumes the cutout is located on a short edge of
the display so if the display it tests on happens to be a landscape
display the test just fails.
Bug: 145836235
Test: atest DisplayContentTests#testDisplayCutout_rot90 on a landscape
display device.
Change-Id: I4972fbcc4aef6b9d0ba7759c8c8aa32e82a83b8b
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
index ccbafd4..612e051 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
@@ -514,6 +514,13 @@
// Prevent mInitialDisplayCutout from being updated from real display (e.g. null
// if the device has no cutout).
final DisplayContent dc = createDisplayNoUpdateDisplayInfo();
+ // This test assumes it's a top cutout on a portrait display, so if it happens to be a
+ // landscape display let's rotate it.
+ if (dc.mInitialDisplayHeight < dc.mInitialDisplayWidth) {
+ int tmp = dc.mInitialDisplayHeight;
+ dc.mInitialDisplayHeight = dc.mInitialDisplayWidth;
+ dc.mInitialDisplayWidth = tmp;
+ }
// Rotation may use real display info to compute bound, so here also uses the
// same width and height.
final int displayWidth = dc.mInitialDisplayWidth;