From 8082401a83a9338d5d3659454180f16e004e702a Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 5 Jul 2023 18:21:59 -0700 Subject: [PATCH] Prevent passing in GroupedTaskView when not animating split launch * With ag/23320818 we started always passing in GroupedTaskView, which gets used downstream to mean that we are launching an app from tapping on it in overview * This caused a bug in the case where we quickswitched to the last task. Now we pass in null for GroupedTaskView like before Test: Prior bug (b/274540670) doesn't occur, nor do repro steps for this one Fixes: 289163668 Flag: None Change-Id: I82dd8f26bfc286fefc0995822786cf3980da41d0 --- .../util/SplitSelectStateController.java | 2 +- .../quickstep/views/GroupedTaskView.java | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index e063b447be..ff701e756b 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -561,7 +561,7 @@ public class SplitSelectStateController { new RemoteSplitLaunchTransitionRunner(firstTaskId, secondTaskId, callback); final RemoteTransition remoteTransition = new RemoteTransition(animationRunner, ActivityThread.currentActivityThread().getApplicationThread(), - "LaunchSplitPair"); + "LaunchAppFullscreen"); InstanceId instanceId = LogUtils.getShellShareableInstanceId().first; if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) { switch (launchData.getSplitLaunchType()) { diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index c91b18347c..01f6ae8d5c 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -223,11 +223,12 @@ public class GroupedTaskView extends TaskView { // Callbacks run from remote animation when recents animation not currently running InteractionJankMonitorWrapper.begin(this, InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER, "Enter form GroupedTaskView"); - launchTask(success -> { + launchTaskInternal(success -> { endCallback.executeAllAndDestroy(); InteractionJankMonitorWrapper.end( InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER); - }, false /* freezeTaskList */); + }, false /* freezeTaskList */, true /*launchingExistingTaskview*/); + // Callbacks get run from recentsView for case when recents animation already running recentsView.addSideTaskLaunchCallback(endCallback); @@ -236,7 +237,19 @@ public class GroupedTaskView extends TaskView { @Override public void launchTask(@NonNull Consumer callback, boolean isQuickswitch) { - getRecentsView().getSplitSelectController().launchExistingSplitPair(this, mTask.key.id, + launchTaskInternal(callback, isQuickswitch, false /*launchingExistingTaskview*/); + } + + /** + * @param launchingExistingTaskView {@link SplitSelectStateController#launchExistingSplitPair} + * uses existence of GroupedTaskView as control flow of how to animate in the incoming task. If + * we're launching from overview (from overview thumbnails) then pass in {@code true}, + * otherwise pass in {@code false} for case like quickswitching from home to task + */ + private void launchTaskInternal(@NonNull Consumer callback, boolean isQuickswitch, + boolean launchingExistingTaskView) { + getRecentsView().getSplitSelectController().launchExistingSplitPair( + launchingExistingTaskView ? this : null, mTask.key.id, mSecondaryTask.key.id, SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT, callback, isQuickswitch, getSplitRatio()); }