Loading quickstep/res/layout/overview_clear_all_button.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <com.android.quickstep.views.ClearAllButton xmlns:android="http://schemas.android.com/apk/res/android" style="@android:style/Widget.DeviceDefault.Button.Borderless" android:id="@+id/clear_all" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/recents_clear_all" Loading quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +7 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,13 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { // Test UIDevice.pressHome, once we are in AllApps. mDevice.pressHome(); waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL); // Test dismissing all tasks. mLauncher.getWorkspace().switchToOverview().dismissAllTasks(); waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL); executeOnLauncher( launcher -> assertEquals("Still have tasks after dismissing all", 0, getTaskCount(launcher))); } private int getCurrentOverviewPage(Launcher launcher) { Loading tests/tapl/com/android/launcher3/tapl/BaseOverview.java +18 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.launcher3.tapl; import androidx.annotation.NonNull; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; Loading @@ -28,6 +29,7 @@ import java.util.List; */ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { private static final int DEFAULT_FLING_SPEED = 15000; private static final int FLINGS_FOR_DISMISS_LIMIT = 5; BaseOverview(LauncherInstrumentation launcher) { super(launcher); Loading @@ -49,6 +51,22 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { verifyActiveContainer(); } /** * Dismissed all tasks by scrolling to Clear-all button and pressing it. */ public Workspace dismissAllTasks() { final BySelector clearAllSelector = mLauncher.getLauncherObjectSelector("clear_all"); for (int i = 0; i < FLINGS_FOR_DISMISS_LIMIT && verifyActiveContainer().findObject(clearAllSelector) == null; ++i) { flingForward(); } mLauncher.getObjectInContainer(verifyActiveContainer(), clearAllSelector).click(); return new Workspace(mLauncher); } /** * Flings backward (right) and waits the fling's end. */ Loading Loading
quickstep/res/layout/overview_clear_all_button.xml +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ <com.android.quickstep.views.ClearAllButton xmlns:android="http://schemas.android.com/apk/res/android" style="@android:style/Widget.DeviceDefault.Button.Borderless" android:id="@+id/clear_all" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/recents_clear_all" Loading
quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +7 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,13 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { // Test UIDevice.pressHome, once we are in AllApps. mDevice.pressHome(); waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL); // Test dismissing all tasks. mLauncher.getWorkspace().switchToOverview().dismissAllTasks(); waitForState("Launcher internal state didn't switch to Home", LauncherState.NORMAL); executeOnLauncher( launcher -> assertEquals("Still have tasks after dismissing all", 0, getTaskCount(launcher))); } private int getCurrentOverviewPage(Launcher launcher) { Loading
tests/tapl/com/android/launcher3/tapl/BaseOverview.java +18 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.launcher3.tapl; import androidx.annotation.NonNull; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; Loading @@ -28,6 +29,7 @@ import java.util.List; */ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { private static final int DEFAULT_FLING_SPEED = 15000; private static final int FLINGS_FOR_DISMISS_LIMIT = 5; BaseOverview(LauncherInstrumentation launcher) { super(launcher); Loading @@ -49,6 +51,22 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { verifyActiveContainer(); } /** * Dismissed all tasks by scrolling to Clear-all button and pressing it. */ public Workspace dismissAllTasks() { final BySelector clearAllSelector = mLauncher.getLauncherObjectSelector("clear_all"); for (int i = 0; i < FLINGS_FOR_DISMISS_LIMIT && verifyActiveContainer().findObject(clearAllSelector) == null; ++i) { flingForward(); } mLauncher.getObjectInContainer(verifyActiveContainer(), clearAllSelector).click(); return new Workspace(mLauncher); } /** * Flings backward (right) and waits the fling's end. */ Loading