diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index ee642db69c..ceb71669af 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -15,9 +15,16 @@ */ package com.android.launcher3.uioverrides; +import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED; + import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; +import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; +import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; +import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL; +import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import android.content.Intent; @@ -31,6 +38,8 @@ import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; +import com.android.launcher3.Workspace; +import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.Folder; @@ -56,6 +65,7 @@ import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.views.RecentsView; +import com.android.quickstep.views.TaskView; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -175,6 +185,49 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { } } + @Override + public void onStateSetEnd(LauncherState state) { + super.onStateSetEnd(state); + + switch (state.ordinal) { + case HINT_STATE_ORDINAL: { + Workspace workspace = getWorkspace(); + boolean willMoveScreens = workspace.getNextPage() != Workspace.DEFAULT_PAGE; + getStateManager().goToState(NORMAL, true, + willMoveScreens ? null : getScrimView()::startDragHandleEducationAnim); + if (willMoveScreens) { + workspace.post(workspace::moveToDefaultScreen); + } + break; + } + case OVERVIEW_STATE_ORDINAL: { + DiscoveryBounce.showForOverviewIfNeeded(this); + RecentsView rv = getOverviewPanel(); + sendCustomAccessibilityEvent( + rv.getPageAt(rv.getCurrentPage()), TYPE_VIEW_FOCUSED, null); + break; + } + case QUICK_SWITCH_STATE_ORDINAL: { + RecentsView rv = getOverviewPanel(); + TaskView tasktolaunch = rv.getTaskViewAt(0); + if (tasktolaunch != null) { + tasktolaunch.launchTask(false, success -> { + if (!success) { + getStateManager().goToState(OVERVIEW); + tasktolaunch.notifyTaskLaunchFailed(TAG); + } else { + getStateManager().moveToRestState(); + } + }, MAIN_EXECUTOR.getHandler()); + } else { + getStateManager().goToState(NORMAL); + } + break; + } + + } + } + @Override public TouchController[] createTouchControllers() { Mode mode = SysUINavigationMode.getMode(this); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index 4718c81305..357e9ecd6f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -17,7 +17,6 @@ package com.android.launcher3.uioverrides.states; import android.content.Context; -import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.userevent.nano.LauncherLogProto; @@ -29,9 +28,8 @@ import com.android.quickstep.views.RecentsView; */ public class BackgroundAppState extends OverviewState { - private static final int STATE_FLAGS = - FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY - | FLAG_DISABLE_INTERACTION; + private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI + | FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS; public BackgroundAppState(int id) { this(id, LauncherLogProto.ContainerType.TASKSWITCHER); @@ -41,11 +39,6 @@ public class BackgroundAppState extends OverviewState { super(id, logContainer, STATE_FLAGS); } - @Override - public void onStateEnabled(Launcher launcher) { - AbstractFloatingView.closeAllOpenViews(launcher, false); - } - @Override public float getVerticalProgress(Launcher launcher) { if (launcher.getDeviceProfile().isVerticalBarLayout()) { diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 868273a7bc..4e868b0c1b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.uioverrides.states; +import android.content.Context; import android.content.res.Resources; import android.graphics.Rect; @@ -30,14 +31,14 @@ import com.android.quickstep.views.RecentsView; public class OverviewModalTaskState extends OverviewState { private static final int STATE_FLAGS = - FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY; + FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE; public OverviewModalTaskState(int id) { super(id, ContainerType.OVERVIEW, STATE_FLAGS); } @Override - public int getTransitionDuration(Launcher launcher) { + public int getTransitionDuration(Context launcher) { return 300; } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java index fad9ea5817..6f572819a1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -37,17 +37,13 @@ import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; import android.graphics.Rect; import android.view.View; -import android.view.accessibility.AccessibilityEvent; import android.view.animation.Interpolator; -import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Workspace; -import com.android.launcher3.allapps.DiscoveryBounce; -import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; @@ -67,7 +63,8 @@ public class OverviewState extends LauncherState { protected static final Rect sTempRect = new Rect(); private static final int STATE_FLAGS = FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED - | FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY; + | FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE + | FLAG_CLOSE_POPUPS; public OverviewState(int id) { this(id, STATE_FLAGS); @@ -82,9 +79,9 @@ public class OverviewState extends LauncherState { } @Override - public int getTransitionDuration(Launcher launcher) { + public int getTransitionDuration(Context context) { // In no-button mode, overview comes in all the way from the left, so give it more time. - boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(launcher).getMode() == NO_BUTTON; + boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(context).getMode() == NO_BUTTON; return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250; } @@ -136,20 +133,6 @@ public class OverviewState extends LauncherState { return super.getQsbScaleAndTranslation(launcher); } - @Override - public void onStateEnabled(Launcher launcher) { - AbstractFloatingView.closeAllOpenViews(launcher); - } - - @Override - public void onStateTransitionEnd(Launcher launcher) { - DiscoveryBounce.showForOverviewIfNeeded(launcher); - RecentsView recentsView = launcher.getOverviewPanel(); - AccessibilityManagerCompat.sendCustomAccessibilityEvent( - recentsView.getPageAt(recentsView.getCurrentPage()), - AccessibilityEvent.TYPE_VIEW_FOCUSED, null); - } - @Override public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) { return new PageAlphaProvider(DEACCEL_2) { diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java index 7b4bb0274a..2c7373e206 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java @@ -15,24 +15,16 @@ */ package com.android.launcher3.uioverrides.states; -import android.os.Handler; -import android.os.Looper; - import com.android.launcher3.Launcher; import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.quickstep.GestureState; -import com.android.quickstep.views.RecentsView; -import com.android.quickstep.views.TaskView; /** * State to indicate we are about to launch a recent task. Note that this state is only used when * quick switching from launcher; quick switching from an app uses LauncherSwipeHandler. - * @see GestureState.GestureEndTarget#NEW_TASK + * @see com.android.quickstep.GestureState.GestureEndTarget#NEW_TASK */ public class QuickSwitchState extends BackgroundAppState { - private static final String TAG = "QuickSwitchState"; - public QuickSwitchState(int id) { super(id, LauncherLogProto.ContainerType.APP); } @@ -49,21 +41,4 @@ public class QuickSwitchState extends BackgroundAppState { public int getVisibleElements(Launcher launcher) { return NONE; } - - @Override - public void onStateTransitionEnd(Launcher launcher) { - TaskView tasktolaunch = launcher.getOverviewPanel().getTaskViewAt(0); - if (tasktolaunch != null) { - tasktolaunch.launchTask(false, success -> { - if (!success) { - launcher.getStateManager().goToState(OVERVIEW); - tasktolaunch.notifyTaskLaunchFailed(TAG); - } else { - launcher.getStateManager().moveToRestState(); - } - }, new Handler(Looper.getMainLooper())); - } else { - launcher.getStateManager().goToState(NORMAL); - } - } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index 07fbcd27a8..726322b0c5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -212,7 +212,7 @@ public final class LauncherActivityInterface implements BaseActivityInterface