From 98fbe25da9ec04bfe67501dea49736358cf91ce5 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 25 May 2023 05:56:05 +0000 Subject: [PATCH] Try to handle side-task launches even if not fully transitioned to overview - The launcher state does not transition from Background -> Overview until the overview animation finishes, and if a side task is launched before that happens, then we receive onTaskAppeared() but isInLiveTileMode() is false, which results in a state where no animation of the side task surface is run, and the recents animation is not finished. In these cases, if we've already calculated the end target is RECENTS, then we can still animate the side task - Adding some more gesture logs to indicate side task launched (or didn't) Bug: 279114961 Test: Go to overview and launch next task Change-Id: I23eac8721da801f14cc95fc6781a0ef9f0355cc0 --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 2 ++ .../src/com/android/quickstep/TaskAnimationManager.java | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 928910d3ab..f5202b7ebe 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -2260,6 +2260,7 @@ public abstract class AbsSwipeUpHandler, targetCompat.taskId == mGestureState.getLastStartedTaskId()) .findFirst(); if (!taskTargetOptional.isPresent()) { + ActiveGestureLog.INSTANCE.addLog("No appeared task matching started task id"); finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); return; } @@ -2267,6 +2268,7 @@ public abstract class AbsSwipeUpHandler, TaskView taskView = mRecentsView == null ? null : mRecentsView.getTaskViewByTaskId(taskTarget.taskId); if (taskView == null || !taskView.getThumbnail().shouldShowSplashView()) { + ActiveGestureLog.INSTANCE.addLog("Invalid task view splash state"); finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); return; } diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 4c4b9b4095..410ba21866 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -19,6 +19,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; +import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_INITIALIZED; import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION; @@ -174,16 +175,21 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn if (nonAppTargets == null) { nonAppTargets = new RemoteAnimationTarget[0]; } - if (activityInterface.isInLiveTileMode() + if ((activityInterface.isInLiveTileMode() + || mLastGestureState.getEndTarget() == RECENTS) && activityInterface.getCreatedActivity() != null) { RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); if (recentsView != null) { + ActiveGestureLog.INSTANCE.addLog("Launching side task id=" + + appearedTaskTarget.taskId); recentsView.launchSideTaskInLiveTileMode(appearedTaskTarget.taskId, appearedTaskTargets, new RemoteAnimationTarget[0] /* wallpaper */, nonAppTargets /* nonApps */); return; + } else { + ActiveGestureLog.INSTANCE.addLog("Unable to launch side task (no recents)"); } } else if (nonAppTargets.length > 0) { TaskViewUtils.createSplitAuxiliarySurfacesAnimator(nonAppTargets /* nonApps */,