diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java index 0c5b9ada5d..664958a18e 100644 --- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java +++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java @@ -48,7 +48,9 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest { // b/143488140 mLauncher.pressHome(); // Start an activity where the gestures start. - startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + if (mLauncher.getRecentTasks().isEmpty()) { + startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + } } private void runTest(String... eventSequence) { diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index bf093fdabf..ed25cc71ca 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -69,14 +69,16 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { } private void startTestApps() throws Exception { - startAppFast(getAppPackageName()); - startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); - startTestActivity(2); + if (mLauncher.getRecentTasks().size() < 3) { + startAppFast(getAppPackageName()); + startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR)); + startTestActivity(2); - executeOnLauncher(launcher -> assertTrue( - "Launcher activity is the top activity; expecting another activity to be the top " - + "one", - isInBackground(launcher))); + executeOnLauncher(launcher -> assertTrue( + "Launcher activity is the top activity; expecting another activity to be the " + + "top one", + isInBackground(launcher))); + } } @Test