Merge "Improving diags when Launcher is invisible when the test fails" into sc-v2-dev am: ec4be03dd3

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15352430

Change-Id: I861fe20f96d3da2565441b698ac07562665fce94
This commit is contained in:
TreeHugger Robot
2021-07-23 04:03:25 +00:00
committed by Automerger Merge Worker
@@ -406,12 +406,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) {