summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-04-07 20:43:25 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-04-07 20:43:25 +0000
commitc3c71ff6cd6037cabda9a4f4d610373548c76165 (patch)
tree2cd0b052d45005d438ab4401a0c0b51ae906e3cd
parente75b0136d1fb6fa4922f9660557c662d0db16eca (diff)
parent6ec2eb3efe5696d3e15edf268e5562fb511e1e0a (diff)
downloadcts-sparse-9904815-L75800000960413676.tar.gz
-rw-r--r--tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java9
-rw-r--r--tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java6
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
index b0f86bac2e4..a4e2d491e61 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
@@ -620,8 +620,6 @@ public class DisplayCutoutTests {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
if (getIntent() != null) {
- getWindow().getAttributes().layoutInDisplayCutoutMode = getIntent().getIntExtra(
- EXTRA_CUTOUT_MODE, LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT);
setRequestedOrientation(getIntent().getIntExtra(
EXTRA_ORIENTATION, SCREEN_ORIENTATION_UNSPECIFIED));
}
@@ -629,6 +627,13 @@ public class DisplayCutoutTests {
view.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
view.setOnApplyWindowInsetsListener((v, insets) -> mDispatchedInsets = insets);
setContentView(view);
+ // Because the PhoneWindow.java will set the CutoutMode
+ // So we have to set the CutoutMode after the setContentView method
+ if (getIntent() != null) {
+ int mode = getIntent().getIntExtra(EXTRA_CUTOUT_MODE,
+ LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT);
+ getWindow().getAttributes().layoutInDisplayCutoutMode = mode;
+ }
}
@Override
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java b/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java
index a3782962906..972ae92559a 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java
@@ -23,6 +23,7 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
+import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -69,8 +70,9 @@ public final class BarTestUtils {
public static void assumeHasStatusBar(ActivityTestRule<?> rule) {
assumeFalse("No status bar when running in VR", isRunningInVr());
- assumeTrue("Top stable inset is non-positive, no status bar.",
- getInsets(rule).getStableInsetTop() > 0);
+ Insets statusBar = getInsets(rule).getInsetsIgnoringVisibility(
+ WindowInsets.Type.statusBars());
+ assumeFalse("There must be status bar insets.", statusBar.equals(Insets.NONE));
}
public static void assumeHasColoredNavigationBar(ActivityTestRule<?> rule) {