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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user