diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsKeyboardQuickSwitch.java b/quickstep/tests/src/com/android/quickstep/TaplTestsKeyboardQuickSwitch.java index 3c4f1d9c6c..6f8600d637 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsKeyboardQuickSwitch.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsKeyboardQuickSwitch.java @@ -152,7 +152,7 @@ public class TaplTestsKeyboardQuickSwitch extends AbstractQuickStepTest { @Test public void testLaunchSingleRecentTask() { - mLauncher.getLaunchedAppState().switchToOverview().dismissAllTasks(); + clearAllRecentTasks(); startAppFast(CALCULATOR_APP_PACKAGE); mLauncher.goHome().showQuickSwitchView().launchFocusedAppTask(CALCULATOR_APP_PACKAGE); } diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt b/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt index 88d0969239..8c02340ce0 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsOverviewDesktop.kt @@ -35,10 +35,7 @@ import org.junit.Test class TaplTestsOverviewDesktop : AbstractQuickStepTest() { @Before fun setup() { - val overview = mLauncher.goHome().switchToOverview() - if (overview.hasTasks()) { - overview.dismissAllTasks() - } + clearAllRecentTasks() startTestAppsWithCheck() mLauncher.goHome() } diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index ede2aa24b4..560a28c1f2 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -548,7 +548,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @EnableFlags(value = Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW) public void testDismissBottomRow() throws Exception { assumeTrue(mLauncher.isTablet()); - mLauncher.goHome().switchToOverview().dismissAllTasks(); + clearAllRecentTasks(); startTestAppsWithCheck(); Overview overview = mLauncher.goHome().switchToOverview(); @@ -570,7 +570,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @EnableFlags(value = Flags.FLAG_ENABLE_GRID_ONLY_OVERVIEW) public void testDismissLastGridRow() throws Exception { assumeTrue(mLauncher.isTablet()); - mLauncher.goHome().switchToOverview().dismissAllTasks(); + clearAllRecentTasks(); startTestAppsWithCheck(); startTestActivity(3); startTestActivity(4); diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java index f27c25a159..176f81c418 100644 --- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java +++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java @@ -151,6 +151,10 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { /** * Dismissed all tasks by scrolling to Clear-all button and pressing it. + *

+ * NOTE: Fails if there are already no recent tasks. If a test needs to start with an empty task + * list, check {@link #hasTasks} before calling this since the previous test may have already + * cleared the task list. */ public void dismissAllTasks() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();