diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index 416c193cfc..8d489e3d69 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -216,7 +216,7 @@ public class NavigationModeSwitchRule implements TestRule { private static void assertTrue(LauncherInstrumentation launcher, String message, boolean condition, Description description) { - launcher.checkForAnomaly(true); + launcher.checkForAnomaly(true, true); if (!condition) { final AssertionError assertionError = new AssertionError(message); if (description != null) { diff --git a/tests/src/com/android/launcher3/util/Wait.java b/tests/src/com/android/launcher3/util/Wait.java index 8b5e1970de..50bc32e509 100644 --- a/tests/src/com/android/launcher3/util/Wait.java +++ b/tests/src/com/android/launcher3/util/Wait.java @@ -52,7 +52,7 @@ public class Wait { throw new RuntimeException(t); } Log.d("Wait", "atMost: timed out: " + SystemClock.uptimeMillis()); - launcher.checkForAnomaly(false); + launcher.checkForAnomaly(false, false); Assert.fail(message.get()); } diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index ea8a295b83..f7c6044268 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -392,7 +392,8 @@ public final class LauncherInstrumentation { } } - private String getSystemAnomalyMessage(boolean ignoreNavmodeChangeStates) { + private String getSystemAnomalyMessage( + boolean ignoreNavmodeChangeStates, boolean ignoreOnlySystemUiViews) { try { { final StringBuilder sb = new StringBuilder(); @@ -415,7 +416,7 @@ public final class LauncherInstrumentation { if (hasSystemUiObject("keyguard_status_view")) return "Phone is locked"; - if (!ignoreNavmodeChangeStates) { + if (!ignoreOnlySystemUiViews) { final String visibleApps = mDevice.findObjects(getAnyObjectSelector()) .stream() .map(LauncherInstrumentation::getApplicationPackageSafe) @@ -423,7 +424,8 @@ public final class LauncherInstrumentation { .filter(pkg -> pkg != null) .collect(Collectors.joining(",")); if (SYSTEMUI_PACKAGE.equals(visibleApps)) return "Only System UI views are visible"; - + } + if (!ignoreNavmodeChangeStates) { if (!mDevice.wait(Until.hasObject(getAnyObjectSelector()), WAIT_TIME_MS)) { return "Screen is empty"; } @@ -439,11 +441,13 @@ public final class LauncherInstrumentation { } private void checkForAnomaly() { - checkForAnomaly(false); + checkForAnomaly(false, false); } - public void checkForAnomaly(boolean ignoreNavmodeChangeStates) { - final String systemAnomalyMessage = getSystemAnomalyMessage(ignoreNavmodeChangeStates); + public void checkForAnomaly( + boolean ignoreNavmodeChangeStates, boolean ignoreOnlySystemUiViews) { + final String systemAnomalyMessage = + getSystemAnomalyMessage(ignoreNavmodeChangeStates, ignoreOnlySystemUiViews); if (systemAnomalyMessage != null) { Assert.fail(formatSystemHealthMessage(formatErrorWithEvents( "http://go/tapl : Tests are broken by a non-Launcher system error: " @@ -765,7 +769,7 @@ public final class LauncherInstrumentation { // pause in accessibility events prior to pressing Home. final String action; if (getNavigationModel() == NavigationModel.ZERO_BUTTON) { - checkForAnomaly(); + checkForAnomaly(false, true); setForcePauseTimeout(FORCE_PAUSE_TIMEOUT_MS); final Point displaySize = getRealDisplaySize();