From 6c1331ca42a67c13c306c72d41b64a1110578fd5 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 21 Jul 2021 18:50:32 -0700 Subject: [PATCH] Improving diags when Launcher is invisible when the test fails Test: presubmit Bug: 187761685 Change-Id: I69a930ef076dbf6cca5af516228ebe689fac91eb --- .../android/launcher3/tapl/LauncherInstrumentation.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index c4d46ee07d..1144dcef17 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -396,12 +396,15 @@ public final class LauncherInstrumentation { } private String getVisiblePackages() { - return mDevice.findObjects(getAnyObjectSelector()) + final String apps = mDevice.findObjects(getAnyObjectSelector()) .stream() .map(LauncherInstrumentation::getApplicationPackageSafe) .distinct() - .filter(pkg -> pkg != null && !"com.android.systemui".equals(pkg)) + .filter(pkg -> pkg != null && !SYSTEMUI_PACKAGE.equals(pkg)) .collect(Collectors.joining(", ")); + return !apps.isEmpty() + ? "active app: " + apps + : "the test doesn't see views from any app, including Launcher"; } private static String getApplicationPackageSafe(UiObject2 object) {