From b0def1ea210650d04a5077b7d98eec962f967698 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 16 Jul 2021 19:25:28 -0700 Subject: [PATCH] Waiting for broadcasts idle in TaplInstrumentation constructor Hoping that this will prevent Launcher restarts during test execution. Test: presubmit Bug: 187761685 Change-Id: If9ba8795bcb27366dd1b2cdcad1c5329ef2e76c0 --- .../com/android/launcher3/tapl/LauncherInstrumentation.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index c4d46ee07d..71f52fdb64 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -207,6 +207,11 @@ public final class LauncherInstrumentation { public LauncherInstrumentation(Instrumentation instrumentation) { mInstrumentation = instrumentation; mDevice = UiDevice.getInstance(instrumentation); + try { + mDevice.executeShellCommand("am wait-for-broadcast-idle"); + } catch (IOException e) { + log("Failed to wait for broadcast idle"); + } // Launcher should run in test harness so that custom accessibility protocol between // Launcher and TAPL is enabled. In-process tests enable this protocol with a direct call