Support multiple tasks per split screen via SplitRemoteTargetHandles

It enables support for assigning SplitRemoteTargetHandles to multiple tasks within a split-screen.

The changes include:

- Retrieving the list of split-screen tasks directly from `SplitBounds`.
- Iterating through the task list and setting the remoteTargetHandle for each individual task.
- General code refactoring to set the remoteTargetHandle.

Bug: 346295292
Bug: 360782849
Flag: com.android.wm.shell.enable_flexible_two_app_split
Test: manual test.
Video: Before: http://recall/-/gvQq7Z7JECwxnxKrBmr3wt/fnHVbaVwMWfvrOaez5eO6L
Video: After: http://recall/-/gvQq7Z7JECwxnxKrBmr3wt/dzv6tZMlAYG1bBBtYdsWxF

Change-Id: I1e8c8316947b0d4fd72c9cf36dff8ecd99d2f170
This commit is contained in:
Simon (Qiong) Sun
2025-04-29 09:14:55 +00:00
parent 10b72a252d
commit 00063bcf2f
7 changed files with 184 additions and 99 deletions

View File

@@ -132,6 +132,42 @@ public abstract class AbsSwipeUpHandlerTestCase<
/* taskInfo= */ mRunningTaskInfo,
/* allowEnterPip= */ false);
protected final RemoteAnimationTarget mRemoteAnimationLeftTop = new RemoteAnimationTarget(
/* taskId= */ 1,
/* mode= */ RemoteAnimationTarget.MODE_CLOSING,
/* leash= */ new SurfaceControl(),
/* isTranslucent= */ false,
/* clipRect= */ null,
/* contentInsets= */ null,
/* prefixOrderIndex= */ 0,
/* position= */ null,
/* localBounds= */ null,
/* screenSpaceBounds= */ null,
new Configuration().windowConfiguration,
/* isNotInRecents= */ false,
/* startLeash= */ null,
/* startBounds= */ null,
/* taskInfo= */ mRunningTaskInfo,
/* allowEnterPip= */ false);
protected final RemoteAnimationTarget mRemoteAnimationRightBottom = new RemoteAnimationTarget(
/* taskId= */ 2,
/* mode= */ RemoteAnimationTarget.MODE_CLOSING,
/* leash= */ new SurfaceControl(),
/* isTranslucent= */ false,
/* clipRect= */ null,
/* contentInsets= */ null,
/* prefixOrderIndex= */ 0,
/* position= */ null,
/* localBounds= */ null,
/* screenSpaceBounds= */ null,
new Configuration().windowConfiguration,
/* isNotInRecents= */ false,
/* startLeash= */ null,
/* startBounds= */ null,
/* taskInfo= */ mRunningTaskInfo,
/* allowEnterPip= */ false);
protected RecentsAnimationTargets mRecentsAnimationTargets;
protected TaskAnimationManager mTaskAnimationManager;
protected StateManager<STATE_TYPE, RECENTS_CONTAINER> mStateManager;
@@ -157,12 +193,12 @@ public abstract class AbsSwipeUpHandlerTestCase<
extras.putParcelable(KEY_EXTRA_SPLIT_BOUNDS, new SplitBounds(
/* leftTopBounds = */ new Rect(),
/* rightBottomBounds = */ new Rect(),
/* leftTopTaskId = */ -1,
/* rightBottomTaskId = */ -1,
/* leftTopTaskId = */ mRemoteAnimationLeftTop.taskId,
/* rightBottomTaskId = */ mRemoteAnimationRightBottom.taskId,
/* snapPosition = */ SNAP_TO_2_50_50));
mRecentsAnimationTargets = new RecentsAnimationTargets(
new RemoteAnimationTarget[] {mRemoteAnimationTarget},
new RemoteAnimationTarget[] {mRemoteAnimationTarget},
new RemoteAnimationTarget[] {mRemoteAnimationLeftTop},
new RemoteAnimationTarget[] {mRemoteAnimationRightBottom},
new RemoteAnimationTarget[] {mRemoteAnimationTarget},
/* homeContentInsets= */ new Rect(),
/* minimizedHomeBounds= */ null,

View File

@@ -121,8 +121,8 @@ public class RecentTasksListTest {
new RecentTaskInfo(), new RecentTaskInfo(), new SplitBounds(
/* leftTopBounds = */ new Rect(),
/* rightBottomBounds = */ new Rect(),
/* leftTopTaskId = */ -1,
/* rightBottomTaskId = */ -1,
/* leftTopTaskId = */ 1,
/* rightBottomTaskId = */ 2,
/* snapPosition = */ SplitScreenConstants.SNAP_TO_2_50_50));
when(mSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
.thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
@@ -217,8 +217,8 @@ public class RecentTasksListTest {
new SplitBounds(
/* leftTopBounds = */ new Rect(),
/* rightBottomBounds = */ new Rect(),
/* leftTopTaskId = */ -1,
/* rightBottomTaskId = */ -1,
/* leftTopTaskId = */ 1,
/* rightBottomTaskId = */ 2,
/* snapPosition = */ SplitScreenConstants.SNAP_TO_2_50_50));
when(mSystemUiProxy.getRecentTasks(anyInt(), anyInt()))
.thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));

View File

@@ -247,8 +247,8 @@ public class RecentsModelTest {
new SplitTask(task1, task2, new SplitBounds(
/* leftTopBounds = */ new Rect(),
/* rightBottomBounds = */ new Rect(),
/* leftTopTaskId = */ -1,
/* rightBottomTaskId = */ -1,
/* leftTopTaskId = */ 1,
/* rightBottomTaskId = */ 2,
/* snapPosition = */ SplitScreenConstants.SNAP_TO_2_50_50)));
return allTasks;
}

View File

@@ -60,8 +60,8 @@ class TasksRepositoryTest {
SplitBounds(
/* leftTopBounds = */ Rect(),
/* rightBottomBounds = */ Rect(),
/* leftTopTaskId = */ -1,
/* rightBottomTaskId = */ -1,
/* leftTopTaskId = */ 1,
/* rightBottomTaskId = */ 2,
/* snapPosition = */ SNAP_TO_2_50_50,
),
),