Loading quickstep/src/com/android/quickstep/OverviewCommandHelper.java +32 −20 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ public class OverviewCommandHelper { && dp != null && (dp.isTablet || dp.isTwoPanels); if (cmd.type == TYPE_HIDE) { switch (cmd.type) { case TYPE_HIDE: if (!allowQuickSwitch) { return true; } Loading @@ -217,19 +218,29 @@ public class OverviewCommandHelper { if (mKeyboardTaskFocusIndex == -1) { return true; } } if (cmd.type == TYPE_KEYBOARD_INPUT) { break; case TYPE_KEYBOARD_INPUT: if (allowQuickSwitch) { uiController.openQuickSwitchView(); return true; } else { mKeyboardTaskFocusIndex = 0; break; } } if (cmd.type == TYPE_HOME) { ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(TYPE_HOME)"); case TYPE_HOME: ActiveGestureLog.INSTANCE.addLog( "OverviewCommandHelper.executeCommand(TYPE_HOME)"); mService.startActivity(mOverviewComponentObserver.getHomeIntent()); return true; case TYPE_SHOW: // When Recents is not currently visible, the command's type is TYPE_SHOW // when overview is triggered via the keyboard overview button or Action+Tab // keys (Not Alt+Tab which is KQS). The overview button on-screen in 3-button // nav is TYPE_TOGGLE. mKeyboardTaskFocusIndex = 0; break; default: // continue below to handle displaying Recents. } } else { createdRecentsView = visibleRecentsView; Loading Loading @@ -351,7 +362,8 @@ public class OverviewCommandHelper { private void updateRecentsViewFocus(CommandInfo cmd) { RecentsView recentsView = mOverviewComponentObserver.getActivityInterface().getVisibleRecentsView(); if (recentsView == null || (cmd.type != TYPE_KEYBOARD_INPUT && cmd.type != TYPE_HIDE)) { if (recentsView == null || (cmd.type != TYPE_KEYBOARD_INPUT && cmd.type != TYPE_HIDE && cmd.type != TYPE_SHOW)) { return; } // When the overview is launched via alt tab (cmd type is TYPE_KEYBOARD_INPUT), Loading quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +27 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java +38 −0 Original line number Diff line number Diff line Loading @@ -17,10 +17,14 @@ package com.android.launcher3.tapl; import static android.view.KeyEvent.KEYCODE_META_RIGHT; import static android.view.KeyEvent.KEYCODE_RECENT_APPS; import static android.view.KeyEvent.KEYCODE_TAB; import static android.view.KeyEvent.META_META_ON; import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_SCROLLED; import static com.android.launcher3.testing.shared.TestProtocol.ALL_APPS_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.UIOBJECT_STALE_ELEMENT; import static junit.framework.TestCase.assertNotNull; Loading Loading @@ -134,6 +138,40 @@ public final class Workspace extends Home { } } /** Opens the Launcher Overview page with the action+tab keyboard shortcut. */ public Overview openOverviewFromActionPlusTabKeyboardShortcut() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer("want to open overview")) { verifyActiveContainer(); mLauncher.runToState( () -> mLauncher.getDevice().pressKeyCode(KEYCODE_TAB, META_META_ON), OVERVIEW_STATE_ORDINAL, "pressing keyboard shortcut"); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( "pressed meta+tab key")) { return new Overview(mLauncher); } } } /** Opens the Launcher Overview page with the Recents keyboard shortcut. */ public Overview openOverviewFromRecentsKeyboardShortcut() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer("want to open overview")) { verifyActiveContainer(); mLauncher.runToState( () -> mLauncher.getDevice().pressKeyCode(KEYCODE_RECENT_APPS), OVERVIEW_STATE_ORDINAL, "pressing keyboard shortcut"); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( "pressed recents apps key")) { return new Overview(mLauncher); } } } /** * Returns the home qsb. * Loading Loading
quickstep/src/com/android/quickstep/OverviewCommandHelper.java +32 −20 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ public class OverviewCommandHelper { && dp != null && (dp.isTablet || dp.isTwoPanels); if (cmd.type == TYPE_HIDE) { switch (cmd.type) { case TYPE_HIDE: if (!allowQuickSwitch) { return true; } Loading @@ -217,19 +218,29 @@ public class OverviewCommandHelper { if (mKeyboardTaskFocusIndex == -1) { return true; } } if (cmd.type == TYPE_KEYBOARD_INPUT) { break; case TYPE_KEYBOARD_INPUT: if (allowQuickSwitch) { uiController.openQuickSwitchView(); return true; } else { mKeyboardTaskFocusIndex = 0; break; } } if (cmd.type == TYPE_HOME) { ActiveGestureLog.INSTANCE.addLog("OverviewCommandHelper.executeCommand(TYPE_HOME)"); case TYPE_HOME: ActiveGestureLog.INSTANCE.addLog( "OverviewCommandHelper.executeCommand(TYPE_HOME)"); mService.startActivity(mOverviewComponentObserver.getHomeIntent()); return true; case TYPE_SHOW: // When Recents is not currently visible, the command's type is TYPE_SHOW // when overview is triggered via the keyboard overview button or Action+Tab // keys (Not Alt+Tab which is KQS). The overview button on-screen in 3-button // nav is TYPE_TOGGLE. mKeyboardTaskFocusIndex = 0; break; default: // continue below to handle displaying Recents. } } else { createdRecentsView = visibleRecentsView; Loading Loading @@ -351,7 +362,8 @@ public class OverviewCommandHelper { private void updateRecentsViewFocus(CommandInfo cmd) { RecentsView recentsView = mOverviewComponentObserver.getActivityInterface().getVisibleRecentsView(); if (recentsView == null || (cmd.type != TYPE_KEYBOARD_INPUT && cmd.type != TYPE_HIDE)) { if (recentsView == null || (cmd.type != TYPE_KEYBOARD_INPUT && cmd.type != TYPE_HIDE && cmd.type != TYPE_SHOW)) { return; } // When the overview is launched via alt tab (cmd type is TYPE_KEYBOARD_INPUT), Loading
quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +27 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } Loading
tests/multivalentTests/tapl/com/android/launcher3/tapl/Workspace.java +38 −0 Original line number Diff line number Diff line Loading @@ -17,10 +17,14 @@ package com.android.launcher3.tapl; import static android.view.KeyEvent.KEYCODE_META_RIGHT; import static android.view.KeyEvent.KEYCODE_RECENT_APPS; import static android.view.KeyEvent.KEYCODE_TAB; import static android.view.KeyEvent.META_META_ON; import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_SCROLLED; import static com.android.launcher3.testing.shared.TestProtocol.ALL_APPS_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; import static com.android.launcher3.testing.shared.TestProtocol.UIOBJECT_STALE_ELEMENT; import static junit.framework.TestCase.assertNotNull; Loading Loading @@ -134,6 +138,40 @@ public final class Workspace extends Home { } } /** Opens the Launcher Overview page with the action+tab keyboard shortcut. */ public Overview openOverviewFromActionPlusTabKeyboardShortcut() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer("want to open overview")) { verifyActiveContainer(); mLauncher.runToState( () -> mLauncher.getDevice().pressKeyCode(KEYCODE_TAB, META_META_ON), OVERVIEW_STATE_ORDINAL, "pressing keyboard shortcut"); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( "pressed meta+tab key")) { return new Overview(mLauncher); } } } /** Opens the Launcher Overview page with the Recents keyboard shortcut. */ public Overview openOverviewFromRecentsKeyboardShortcut() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer("want to open overview")) { verifyActiveContainer(); mLauncher.runToState( () -> mLauncher.getDevice().pressKeyCode(KEYCODE_RECENT_APPS), OVERVIEW_STATE_ORDINAL, "pressing keyboard shortcut"); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( "pressed recents apps key")) { return new Overview(mLauncher); } } } /** * Returns the home qsb. * Loading