Dismiss split select when tapping on home button
Bug: 276361926
Test: Initate split, dismiss whenever home is pressed,
doesn't dismiss when all apps dragged down
Flag: ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE
Change-Id: Idc95123e27963c3913d04c6eb27f0e4c9b1eb401
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
index 9fcadea..d78ca88 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
@@ -111,7 +111,7 @@
&& !toState.overviewUi;
if (mRecentsView.isSplitSelectionActive() && exitingOverview) {
setter.add(mRecentsView.getSplitSelectController().getSplitAnimationController()
- .animateAwayPlaceholder(mLauncher));
+ .createPlaceholderDismissAnim(mLauncher));
setter.setViewAlpha(
mRecentsView.getSplitInstructionsView(),
0,
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 3b53e8a..7ce87a3 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -549,7 +549,7 @@
list.add(getDragController());
Consumer<AnimatorSet> splitAnimator = animatorSet -> {
AnimatorSet anim = mSplitSelectStateController.getSplitAnimationController()
- .animateAwayPlaceholder(QuickstepLauncher.this);
+ .createPlaceholderDismissAnim(QuickstepLauncher.this);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -1000,6 +1000,13 @@
return mSplitToWorkspaceController;
}
+ @Override
+ protected void handleSplitAnimationGoingToHome() {
+ super.handleSplitAnimationGoingToHome();
+ mSplitSelectStateController.getSplitAnimationController()
+ .playPlaceholderDismissAnim(this);
+ }
+
public <T extends OverviewActionsView> T getActionsView() {
return (T) mActionsView;
}
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index 2e8af4c..5740991 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -17,6 +17,8 @@
package com.android.quickstep.util
+import android.animation.Animator
+import android.animation.AnimatorListenerAdapter
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.graphics.Bitmap
@@ -185,17 +187,32 @@
}
}
+ /** Does not play any animation if user is not currently in split selection state. */
+ fun playPlaceholderDismissAnim(launcher: Launcher) {
+ if (!splitSelectStateController.isSplitSelectActive) {
+ return
+ }
- fun animateAwayPlaceholder(mLauncher: Launcher) : AnimatorSet {
+ val anim = createPlaceholderDismissAnim(launcher)
+ anim.addListener(object : AnimatorListenerAdapter() {
+ override fun onAnimationEnd(animation: Animator) {
+ splitSelectStateController.resetState()
+ }
+ })
+ anim.start()
+ }
+
+ /** Returns [AnimatorSet] which slides initial split placeholder view offscreen. */
+ fun createPlaceholderDismissAnim(launcher: Launcher) : AnimatorSet {
val animatorSet = AnimatorSet()
- val recentsView : RecentsView<*, *> = mLauncher.getOverviewPanel()
+ val recentsView : RecentsView<*, *> = launcher.getOverviewPanel()
val floatingTask: FloatingTaskView = splitSelectStateController.firstFloatingTaskView
?: return animatorSet
// We are in split selection state currently, transitioning to another state
- val dragLayer: DragLayer = mLauncher.dragLayer
+ val dragLayer: DragLayer = launcher.dragLayer
val onScreenRectF = RectF()
- Utilities.getBoundsForViewInDragLayer(mLauncher.dragLayer, floatingTask,
+ Utilities.getBoundsForViewInDragLayer(launcher.dragLayer, floatingTask,
Rect(0, 0, floatingTask.width, floatingTask.height),
false, null, onScreenRectF)
// Get the part of the floatingTask that intersects with the DragLayer (i.e. the
@@ -214,7 +231,7 @@
floatingTask,
onScreenRectF,
floatingTask.stagePosition,
- mLauncher.deviceProfile
+ launcher.deviceProfile
)))
return animatorSet
}
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 3ee9009..828d466 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -86,6 +86,10 @@
StateManager stateManager = mActivity.getStateManager();
animated &= stateManager.shouldAnimateStateChange();
stateManager.goToState(NORMAL, animated);
+ if (FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
+ mSplitSelectStateController.getSplitAnimationController()
+ .playPlaceholderDismissAnim(mActivity);
+ }
AbstractFloatingView.closeAllOpenViews(mActivity, animated);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 66c76ca..992531a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1682,6 +1682,9 @@
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onHomeIntent(internalStateHandled);
}
+ if (FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get()) {
+ handleSplitAnimationGoingToHome();
+ }
mOverlayManager.hideOverlay(isStarted() && !isForceInvisible());
handleGestureContract(intent);
} else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) {
@@ -1695,6 +1698,11 @@
TraceHelper.INSTANCE.endSection();
}
+ /** Handle animating away split placeholder view when user taps on home button */
+ protected void handleSplitAnimationGoingToHome() {
+ // Overridden
+ }
+
protected void toggleAllAppsFromIntent(boolean alreadyOnHome) {
if (getStateManager().isInStableState(ALL_APPS)) {
getStateManager().goToState(NORMAL, alreadyOnHome);