From 57ce690d4e793048e80ad2481de1d95a2b4b62cc Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Tue, 4 Feb 2025 14:42:09 +0000 Subject: [PATCH] Pass TransitionInfo from onTasksAppeared() to TransformParams Pass the TransitionInfo of the merging recents-transition through to TransformParams to allow setting the corner radius of desktop tasks to zero during the second part of a recents transition. Bug: 378657004 Flag: com.android.window.flags.enable_desktop_recents_transitions_corners_bugfix Test: swipe up from fullscreen app to overview, then tap desktop tile Change-Id: I08f87aa1b9a2feca9e9f8bed2c55279e0ddc1edb --- .../launcher3/QuickstepTransitionManager.java | 3 ++- .../com/android/quickstep/AbsSwipeUpHandler.java | 3 ++- .../android/quickstep/FallbackSwipeHandler.java | 6 ++++-- .../src/com/android/quickstep/RecentsActivity.java | 5 +++-- .../quickstep/RecentsAnimationCallbacks.java | 8 +++++--- .../src/com/android/quickstep/SystemUiProxy.kt | 8 ++++++-- .../android/quickstep/TaskAnimationManager.java | 6 ++++-- .../src/com/android/quickstep/TaskViewUtils.java | 14 +++++++------- .../com/android/quickstep/views/RecentsView.java | 8 +++++--- .../src/com/android/quickstep/views/TaskView.kt | 1 + 10 files changed, 39 insertions(+), 23 deletions(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 4ba4e2b6bf..c7483851b1 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -411,7 +411,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener @NonNull RemoteAnimationTarget[] nonAppTargets, boolean launcherClosing) { TaskViewUtils.composeRecentsLaunchAnimator(anim, v, appTargets, wallpaperTargets, nonAppTargets, launcherClosing, mLauncher.getStateManager(), - mLauncher.getOverviewPanel(), mLauncher.getDepthController()); + mLauncher.getOverviewPanel(), mLauncher.getDepthController(), + /* transitionInfo= */ null); } private boolean areAllTargetsTranslucent(@NonNull RemoteAnimationTarget[] targets) { diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index f46f9ae12a..b43c3ac6cc 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -2453,7 +2453,8 @@ public abstract class AbsSwipeUpHandler< } @Override - public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets) { + public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets, + @Nullable TransitionInfo transitionInfo) { if (mRecentsAnimationController == null) { return; } diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java index 331580c9d2..7d8a53d61b 100644 --- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java @@ -50,6 +50,7 @@ import android.view.RemoteAnimationTarget; import android.view.Surface; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; +import android.window.TransitionInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -172,14 +173,15 @@ public class FallbackSwipeHandler extends } @Override - public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets) { + public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets, + @Nullable TransitionInfo transitionInfo) { if (mActiveAnimationFactory != null && mActiveAnimationFactory.handleHomeTaskAppeared( appearedTaskTargets)) { mActiveAnimationFactory = null; return; } - super.onTasksAppeared(appearedTaskTargets); + super.onTasksAppeared(appearedTaskTargets, transitionInfo); } @Override diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index fca67c3c4f..3d12fdf717 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -319,7 +319,7 @@ public final class RecentsActivity extends StatefulActivity implem /** * Composes the animations for a launch from the recents list if possible. */ - private AnimatorSet composeRecentsLaunchAnimator( + private AnimatorSet composeRecentsLaunchAnimator( @NonNull RecentsView recentsView, @NonNull TaskView taskView, RemoteAnimationTarget[] appTargets, @@ -329,7 +329,8 @@ public final class RecentsActivity extends StatefulActivity implem boolean activityClosing = taskIsATargetWithMode(appTargets, getTaskId(), MODE_CLOSING); PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION); createRecentsWindowAnimator(recentsView, taskView, !activityClosing, appTargets, - wallpaperTargets, nonAppTargets, null /* depthController */, pa); + wallpaperTargets, nonAppTargets, /* depthController= */ null , + /* transitionInfo= */ null, pa); target.play(pa.buildAnim()); // Found a visible recents task that matches the opening app, lets launch the app from there diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java index c6b858b828..c276447f2b 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java @@ -163,11 +163,12 @@ public class RecentsAnimationCallbacks implements @BinderThread @Override - public void onTasksAppeared(RemoteAnimationTarget[] apps) { + public void onTasksAppeared( + RemoteAnimationTarget[] apps, @Nullable TransitionInfo transitionInfo) { Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> { ActiveGestureProtoLogProxy.logRecentsAnimationCallbacksOnTasksAppeared(); for (RecentsAnimationListener listener : getListeners()) { - listener.onTasksAppeared(apps); + listener.onTasksAppeared(apps, transitionInfo); } }); } @@ -225,6 +226,7 @@ public class RecentsAnimationCallbacks implements /** * Callback made when a task started from the recents is ready for an app transition. */ - default void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTarget) {} + default void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTarget, + @Nullable TransitionInfo transitionInfo) {} } } diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.kt b/quickstep/src/com/android/quickstep/SystemUiProxy.kt index a1ac39e354..1f3eb2a347 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.kt +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.kt @@ -1218,8 +1218,12 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context: override fun onAnimationCanceled(taskIds: IntArray?, taskSnapshots: Array?) = listener.onAnimationCanceled(wrap(taskIds, taskSnapshots)) - override fun onTasksAppeared(apps: Array?) = - listener.onTasksAppeared(apps) + override fun onTasksAppeared( + apps: Array?, + transitionInfo: TransitionInfo?, + ) { + listener.onTasksAppeared(apps, transitionInfo) + } } // diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 63b8aaf06e..98103087ed 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -231,7 +231,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn } @Override - public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) { + public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets, + @Nullable TransitionInfo transitionInfo) { RemoteAnimationTarget appearedTaskTarget = appearedTaskTargets[0]; BaseContainerInterface containerInterface = mLastGestureState.getContainerInterface(); @@ -264,7 +265,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn recentsView.launchSideTaskInLiveTileMode(appearedTaskTarget.taskId, appearedTaskTargets, new RemoteAnimationTarget[0] /* wallpaper */, - nonAppTargets /* nonApps */); + nonAppTargets /* nonApps */, + transitionInfo); return; } else { ActiveGestureProtoLogProxy.logLaunchingSideTaskFailed(); diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index e47223b7a1..37841e8c4e 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -169,6 +169,7 @@ public final class TaskViewUtils { @NonNull RemoteAnimationTarget[] wallpaperTargets, @NonNull RemoteAnimationTarget[] nonAppTargets, @Nullable DepthController depthController, + @Nullable TransitionInfo transitionInfo, PendingAnimation out) { boolean isQuickSwitch = v.isEndQuickSwitchCuj(); v.setEndQuickSwitchCuj(false); @@ -191,8 +192,7 @@ public final class TaskViewUtils { RemoteTargetGluer gluer = new RemoteTargetGluer(v.getContext(), recentsView.getSizeStrategy(), targets, forDesktop); if (forDesktop) { - remoteTargetHandles = - gluer.assignTargetsForDesktop(targets, /* transitionInfo=*/ null); + remoteTargetHandles = gluer.assignTargetsForDesktop(targets, transitionInfo); } else if (v.containsMultipleTasks()) { remoteTargetHandles = gluer.assignTargetsForSplitScreen(targets, ((GroupedTaskView) v).getSplitBoundsConfig()); @@ -462,7 +462,7 @@ public final class TaskViewUtils { final RecentsView recentsView = launchingTaskView.getRecentsView(); composeRecentsLaunchAnimator(animatorSet, launchingTaskView, appTargets, wallpaperTargets, nonAppTargets, /* launcherClosing */ true, stateManager, recentsView, - depthController); + depthController, /* transitionInfo= */ null); t.apply(); animatorSet.start(); @@ -501,7 +501,7 @@ public final class TaskViewUtils { composeRecentsLaunchAnimator(animatorSet, launchingTaskView, appTargets, wallpaperTargets, nonAppTargets, true, stateManager, - recentsView, depthController); + recentsView, depthController, /* transitionInfo= */ null); animatorSet.start(); return; } @@ -593,7 +593,7 @@ public final class TaskViewUtils { composeRecentsLaunchAnimator(animatorSet, launchingTaskView, apps, wallpaper, nonApps, true /* launcherClosing */, stateManager, launchingTaskView.getRecentsView(), - depthController); + depthController, transitionInfo); return animatorSet; } @@ -603,13 +603,13 @@ public final class TaskViewUtils { @NonNull RemoteAnimationTarget[] wallpaperTargets, @NonNull RemoteAnimationTarget[] nonAppTargets, boolean launcherClosing, @NonNull StateManager stateManager, @NonNull RecentsView recentsView, - @Nullable DepthController depthController) { + @Nullable DepthController depthController, @Nullable TransitionInfo transitionInfo) { boolean skipLauncherChanges = !launcherClosing; TaskView taskView = findTaskViewToLaunch(recentsView, v, appTargets); PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION); createRecentsWindowAnimator(recentsView, taskView, skipLauncherChanges, appTargets, - wallpaperTargets, nonAppTargets, depthController, pa); + wallpaperTargets, nonAppTargets, depthController, transitionInfo, pa); if (launcherClosing) { // TODO(b/182592057): differentiate between "restore split" vs "launch fullscreen app" TaskViewUtils.createSplitAuxiliarySurfacesAnimator(nonAppTargets, true /*shown*/, diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index a76ebdb1de..8cf46e1ffe 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -132,6 +132,7 @@ import android.widget.OverScroller; import android.widget.Toast; import android.window.DesktopModeFlags; import android.window.PictureInPictureSurfaceTransaction; +import android.window.TransitionInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -1394,12 +1395,13 @@ public abstract class RecentsView< RemoteAnimationTargets targets = params.getTargetSet(); if (targets != null && targets.findTask(taskId) != null) { launchSideTaskInLiveTileMode(taskId, targets.apps, targets.wallpapers, - targets.nonApps); + targets.nonApps, /* transitionInfo= */ null); } } public void launchSideTaskInLiveTileMode(int taskId, RemoteAnimationTarget[] apps, - RemoteAnimationTarget[] wallpaper, RemoteAnimationTarget[] nonApps) { + RemoteAnimationTarget[] wallpaper, RemoteAnimationTarget[] nonApps, + @Nullable TransitionInfo transitionInfo) { AnimatorSet anim = new AnimatorSet(); TaskView taskView = getTaskViewByTaskId(taskId); if (taskView == null || !isTaskViewVisible(taskView)) { @@ -1451,7 +1453,7 @@ public abstract class RecentsView< } else { TaskViewUtils.composeRecentsLaunchAnimator(anim, taskView, apps, wallpaper, nonApps, true /* launcherClosing */, getStateManager(), this, - getDepthController()); + getDepthController(), transitionInfo); } anim.start(); } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt index 509325949b..2dd0490e82 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.kt +++ b/quickstep/src/com/android/quickstep/views/TaskView.kt @@ -1205,6 +1205,7 @@ constructor( recentsView.stateManager, recentsView, recentsView.depthController, + /* transitionInfo= */ null, ) addListener( object : AnimatorListenerAdapter() {