Focus a task by default when using keyboard to go to overview.

Fix: 322898816
Test: TaplTestsQuickstep.java
Flag: None.
Change-Id: I6d4b0ca6593ed2ac7c7d8793954c36e55b5978de
This commit is contained in:
Pat Manning
2024-02-20 13:54:58 +00:00
parent fdf6df3226
commit 5aa23d41dd
3 changed files with 97 additions and 20 deletions

View File

@@ -44,6 +44,7 @@ import com.android.launcher3.tapl.Overview;
import com.android.launcher3.tapl.OverviewActions;
import com.android.launcher3.tapl.OverviewTask;
import com.android.launcher3.tapl.SelectModeButtons;
import com.android.launcher3.tapl.Workspace;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
@@ -227,6 +228,32 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
isInState(() -> LauncherState.NORMAL));
}
@Test
public void testOpenOverviewWithActionPlusTabKeys() throws Exception {
startTestAppsWithCheck();
startAppFast(CALCULATOR_APP_PACKAGE); // Ensure Calculator is last opened app.
Workspace home = mLauncher.goHome();
assertTrue("Launcher state is not Home", isInState(() -> LauncherState.NORMAL));
Overview overview = home.openOverviewFromActionPlusTabKeyboardShortcut();
assertTrue("Launcher state is not Overview", isInState(() -> LauncherState.OVERVIEW));
overview.launchFocusedTaskByEnterKey(CALCULATOR_APP_PACKAGE); // Assert app is focused.
}
@Test
public void testOpenOverviewWithRecentsKey() throws Exception {
startTestAppsWithCheck();
startAppFast(CALCULATOR_APP_PACKAGE); // Ensure Calculator is last opened app.
Workspace home = mLauncher.goHome();
assertTrue("Launcher state is not Home", isInState(() -> LauncherState.NORMAL));
Overview overview = home.openOverviewFromRecentsKeyboardShortcut();
assertTrue("Launcher state is not Overview", isInState(() -> LauncherState.OVERVIEW));
overview.launchFocusedTaskByEnterKey(CALCULATOR_APP_PACKAGE); // Assert app is focused.
}
private int getCurrentOverviewPage(Launcher launcher) {
return launcher.<RecentsView>getOverviewPanel().getCurrentPage();
}