From 715dc428e38318116d8888193e5697117cbfbf32 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 23 Jul 2021 11:21:10 -0700 Subject: [PATCH] Diagnosing when only SysUI is visible. Test: presubmit Bug: 187761685 Change-Id: Ia4c7305193c104db4999dfb463004165d8f8b578 --- .../android/launcher3/tapl/LauncherInstrumentation.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index c4d46ee07d..a0c8298ef8 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -373,6 +373,14 @@ public final class LauncherInstrumentation { if (hasSystemUiObject("keyguard_status_view")) return "Phone is locked"; + final String visibleApps = mDevice.findObjects(getAnyObjectSelector()) + .stream() + .map(LauncherInstrumentation::getApplicationPackageSafe) + .distinct() + .filter(pkg -> pkg != null) + .collect(Collectors.joining(",")); + if (SYSTEMUI_PACKAGE.equals(visibleApps)) return "Only System UI views are visible"; + if (!mDevice.wait(Until.hasObject(getAnyObjectSelector()), WAIT_TIME_MS)) { return "Screen is empty"; }