From ded580754336db9f0848147b3af475ed6d68945a Mon Sep 17 00:00:00 2001 From: minch Date: Wed, 21 May 2025 17:20:49 +0000 Subject: [PATCH] Create the `RemoteTargetGluer` based on the `GroupedTaskInfo` Determine whether a `RemoteTargetGluer` for desktop should be created based on GroupedTaskInfo instead of `RecentsAnimationTargets.hasDesktopTasks`. The latter one is inaccurate to assume that a desk may only have FREEFORM tasks. Bug: 400866688 Flag: com.android.window.flags.enable_multiple_desktops_frontend Flag: com.android.window.flags.enable_multiple_desktops_backend Test: m Change-Id: I6f35f41204790ada59317e0b4bd0a8965c9718eb --- .../quickstep/RecentsAnimationTargets.java | 5 +---- .../android/quickstep/RemoteTargetGluer.java | 2 -- .../android/quickstep/views/RecentsView.java | 21 +++++++++++-------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationTargets.java b/quickstep/src/com/android/quickstep/RecentsAnimationTargets.java index 0deb1ca953..60b5337893 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationTargets.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationTargets.java @@ -55,14 +55,11 @@ public class RecentsAnimationTargets extends RemoteAnimationTargets { * * @return {@code true} if at least one target app is a desktop task */ + // TODO: b/362720309 - Remove this function once multi-desks is fully launched. public boolean hasDesktopTasks(Context context) { if (!DesktopModeStatus.canEnterDesktopMode(context)) { return false; } - // TODO: b/400866688 - Check if we need to update this such that for an empty desk, we - // receive a list of apps that contain only the Launcher and the `DesktopWallpaperActivity` - // and both are fullscreen windowing mode. A desk can also have transparent modals and - // immersive apps which may not have a "freeform" windowing mode. for (RemoteAnimationTarget target : apps) { if (target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_FREEFORM) { return true; diff --git a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java index 4588b778eb..c2639b3818 100644 --- a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java +++ b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java @@ -69,8 +69,6 @@ public class RemoteTargetGluer { */ public RemoteTargetGluer(Context context, BaseContainerInterface sizingStrategy, @Nullable GroupedTaskInfo groupedTaskInfo) { - // TODO: b/403344864 Make sure init with correct number of RemoteTargetHandle with - // multi-desks feature enabled as well. if (enableMultipleDesktops(context)) { if (groupedTaskInfo != null && groupedTaskInfo.isBaseType(GroupedTaskInfo.TYPE_DESK)) { // Allocate +1 to account for the DesktopWallpaperActivity added to the desk. diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index ee8f95a7be..b51175b075 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -5925,7 +5925,6 @@ public abstract class RecentsView< return mRemoteTargetHandles; } - // TODO: To be removed in a follow up CL public void setRecentsAnimationTargets(RecentsAnimationController recentsAnimationController, RecentsAnimationTargets recentsAnimationTargets) { Log.d(TAG, "setRecentsAnimationTargets " @@ -5937,15 +5936,19 @@ public abstract class RecentsView< return; } - RemoteTargetGluer gluer; - if (recentsAnimationTargets.hasDesktopTasks(mContext)) { - gluer = new RemoteTargetGluer(getContext(), getContainerInterface(), - recentsAnimationTargets, true /* forDesktop */); - mRemoteTargetHandles = gluer.assignTargetsForDesktop( - recentsAnimationTargets, /* transitionInfo= */ null); + boolean forDesktop; + if (DesktopModeStatus.enableMultipleDesktops(getContext())) { + forDesktop = mActiveGestureGroupedTaskInfo != null + && mActiveGestureGroupedTaskInfo.isBaseType(GroupedTaskInfo.TYPE_DESK); + } else { + forDesktop = recentsAnimationTargets.hasDesktopTasks(mContext); + } + RemoteTargetGluer gluer = new RemoteTargetGluer(getContext(), getContainerInterface(), + recentsAnimationTargets, forDesktop); + if (forDesktop) { + mRemoteTargetHandles = gluer.assignTargetsForDesktop( + recentsAnimationTargets, /* transitionInfo = */ null); } else { - gluer = new RemoteTargetGluer(getContext(), getContainerInterface(), - recentsAnimationTargets, false); mRemoteTargetHandles = gluer.assignTargetsForSplitScreen(recentsAnimationTargets); } mSplitBoundsConfig = gluer.getSplitBounds();