From f54eb8f2c42b229195e6ca2843efedf239cd6957 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 22 Jan 2024 15:48:01 -0800 Subject: [PATCH] Remove clear all button in overview for contextual split * If we start split from allApps or workspace and then go into workspace, clear all button was previously showing since it's only hidding via state manager transitions * Modify the normal Overview LauncherState to provide a split translation when we are in contextual and have already selected the first app in split Fixes: 296006310 Test: Manually started from overview and workspace, grid tiles look correct, no clear all button Flags: aconfig com.android.wm.shell.enable_split_contextual Change-Id: I8630ce7297119392bb0abb07cdb39592eabf129a --- .../uioverrides/RecentsViewStateController.java | 14 ++++++++++---- .../uioverrides/states/OverviewState.java | 13 +++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 23e922c945..27224f2fed 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides; import static com.android.app.animation.Interpolators.LINEAR; import static com.android.launcher3.LauncherState.CLEAR_ALL_BUTTON; +import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_ACTIONS; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE; @@ -27,6 +28,7 @@ import static com.android.quickstep.views.RecentsView.TASK_MODALNESS; import static com.android.quickstep.views.RecentsView.TASK_PRIMARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANSLATION; import static com.android.quickstep.views.TaskView.FLAG_UPDATE_ALL; +import static com.android.wm.shell.Flags.enableSplitContextual; import android.animation.AnimatorSet; import android.annotation.TargetApi; @@ -120,7 +122,9 @@ public final class RecentsViewStateController extends */ private void handleSplitSelectionState(@NonNull LauncherState toState, @NonNull PendingAnimation builder, boolean animate) { - if (toState != OVERVIEW_SPLIT_SELECT) { + boolean goingToOverviewFromWorkspaceContextual = enableSplitContextual() && + toState == OVERVIEW && mLauncher.isSplitSelectionActive(); + if (toState != OVERVIEW_SPLIT_SELECT && !goingToOverviewFromWorkspaceContextual) { // Not going to split return; } @@ -135,9 +139,11 @@ public final class RecentsViewStateController extends SplitAnimationTimings timings = AnimUtils.getDeviceOverviewToSplitTimings(mLauncher.getDeviceProfile().isTablet); - - mRecentsView.createSplitSelectInitAnimation(builder, - toState.getTransitionDuration(mLauncher, true /* isToState */)); + if (!goingToOverviewFromWorkspaceContextual) { + // This animation is already done for the contextual case, don't redo it + mRecentsView.createSplitSelectInitAnimation(builder, + toState.getTransitionDuration(mLauncher, true /* isToState */)); + } // Shift tasks vertically downward to get out of placeholder view builder.setFloat(mRecentsView, taskViewsFloat.first, toState.getSplitSelectTranslation(mLauncher), diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index 396d0abeb0..76502358ea 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.app.animation.Interpolators.DECELERATE_2; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; +import static com.android.wm.shell.Flags.enableSplitContextual; import android.content.Context; import android.graphics.Rect; @@ -120,9 +121,21 @@ public class OverviewState extends LauncherState { if (showFloatingSearch) { elements |= FLOATING_SEARCH_BAR; } + if (enableSplitContextual() && launcher.isSplitSelectionActive()) { + elements &= ~CLEAR_ALL_BUTTON; + } return elements; } + @Override + public float getSplitSelectTranslation(Launcher launcher) { + if (!enableSplitContextual() || !launcher.isSplitSelectionActive()) { + return 0f; + } + RecentsView recentsView = launcher.getOverviewPanel(); + return recentsView.getSplitSelectTranslation(); + } + @Override public int getFloatingSearchBarRestingMarginBottom(Launcher launcher) { return areElementsVisible(launcher, FLOATING_SEARCH_BAR) ? 0