diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 8e4a78fc0b..9f6994ac53 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -304,6 +304,10 @@ public class TaskbarLauncherStateController { callbacks.addListener(mTaskBarRecentsAnimationListener); ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(() -> mTaskBarRecentsAnimationListener.endGestureStateOverride(true)); + + ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchCancelledRunnable(() -> { + updateStateForUserFinishedToApp(false /* finishedToApp */); + }); return animatorSet; } @@ -770,21 +774,29 @@ public class TaskbarLauncherStateController { mTaskBarRecentsAnimationListener = null; ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null); - // Update the visible state immediately to ensure a seamless handoff - boolean launcherVisible = !finishedToApp; - updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false); - updateStateForFlag(FLAG_VISIBLE, launcherVisible); - applyState(); - - TaskbarStashController controller = mControllers.taskbarStashController; - if (DEBUG) { - Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp); - } - controller.updateStateForFlag(FLAG_IN_APP, finishedToApp); - controller.applyState(); + updateStateForUserFinishedToApp(finishedToApp); } } + /** + * Updates the visible state immediately to ensure a seamless handoff. + * @param finishedToApp True iff user is in an app. + */ + private void updateStateForUserFinishedToApp(boolean finishedToApp) { + // Update the visible state immediately to ensure a seamless handoff + boolean launcherVisible = !finishedToApp; + updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false); + updateStateForFlag(FLAG_VISIBLE, launcherVisible); + applyState(); + + TaskbarStashController controller = mControllers.taskbarStashController; + if (DEBUG) { + Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp); + } + controller.updateStateForFlag(FLAG_IN_APP, finishedToApp); + controller.applyState(); + } + private static String getStateString(int flags) { StringJoiner result = new StringJoiner("|"); appendFlag(result, flags, FLAG_VISIBLE, "flag_visible"); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 8ff43f0122..c2cd11cb68 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -646,6 +646,18 @@ public final class TaskViewUtils { }); }); } + + @Override + public void onAnimationCancel(Animator animation) { + super.onAnimationCancel(animation); + recentsView.onTaskLaunchedInLiveTileModeCancelled(); + } + + @Override + public void onAnimationEnd(Animator animation) { + super.onAnimationEnd(animation); + recentsView.setTaskLaunchCancelledRunnable(null); + } }; } else { AnimatorPlaybackController controller = diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index fecbf0882f..9884d8dd1d 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -759,6 +759,9 @@ public abstract class RecentsView