diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl index df1f5e67e4e2e..6ec514bd83313 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl @@ -95,6 +95,8 @@ interface ISplitScreen { * Blocking call that notifies and gets additional split-screen targets when entering * recents (for example: the dividerBar). * @param cancel is true if leaving recents back to split (eg. the gesture was cancelled). + * @param appTargets apps that will be re-parented to display area */ - RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) = 12; + RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, + in RemoteAnimationTarget[] appTargets) = 12; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 7804c777bc1b0..e2eb41ac1868d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -43,6 +43,7 @@ import android.view.RemoteAnimationAdapter; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.view.WindowManager; +import android.view.SurfaceSession; import android.window.IRemoteTransition; import android.window.WindowContainerTransaction; @@ -281,8 +282,24 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, mSyncQueue.queue(transition, WindowManager.TRANSIT_OPEN, wct); } - RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) { + RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) { if (!isSplitScreenVisible()) return null; + final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession()) + .setContainerLayer() + .setName("RecentsAnimationSplitTasks") + .setHidden(false) + .setCallsite("SplitScreenController#onGoingtoRecentsLegacy"); + mRootTDAOrganizer.attachToDisplayArea(DEFAULT_DISPLAY, builder); + SurfaceControl sc = builder.build(); + SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); + for (RemoteAnimationTarget appTarget : apps) { + // TODO(b/195958376) set the correct layer/z-order in transaction for the new surface + transaction.reparent(appTarget.leash, sc); + transaction.setPosition(appTarget.leash, appTarget.screenSpaceBounds.left, + appTarget.screenSpaceBounds.top); + } + transaction.apply(); + transaction.close(); return new RemoteAnimationTarget[]{mStageCoordinator.getDividerBarLegacyTarget()}; } @@ -554,10 +571,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } @Override - public RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) { + public RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, + RemoteAnimationTarget[] apps) { final RemoteAnimationTarget[][] out = new RemoteAnimationTarget[][]{null}; executeRemoteCallWithTaskPermission(mController, "onGoingToRecentsLegacy", - (controller) -> out[0] = controller.onGoingToRecentsLegacy(cancel), + (controller) -> out[0] = controller.onGoingToRecentsLegacy(cancel, apps), true /* blocking */); return out[0]; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index 29e99175bed09..51a2be3222392 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -81,6 +81,7 @@ import com.android.wm.shell.common.SyncTransactionQueue; import com.android.wm.shell.common.TransactionPool; import com.android.wm.shell.common.split.SplitLayout; import com.android.wm.shell.common.split.SplitLayout.SplitPosition; +import com.android.wm.shell.common.split.SplitWindowManager; import com.android.wm.shell.protolog.ShellProtoLogGroup; import com.android.wm.shell.transition.Transitions; diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java index 23a365a1acefb..2911ce0911b63 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java @@ -74,6 +74,10 @@ public class RemoteAnimationTargetCompat { private final SurfaceControl mStartLeash; + // Fields used only to unrap into RemoteAnimationTarget + private final WindowConfiguration windowConfiguration; + private final Rect startBounds; + public RemoteAnimationTargetCompat(RemoteAnimationTarget app) { taskId = app.taskId; mode = app.mode; @@ -94,6 +98,8 @@ public class RemoteAnimationTargetCompat { mStartLeash = app.startLeash; windowType = app.windowType; + windowConfiguration = app.windowConfiguration; + startBounds = app.startBounds; } private static int newModeToLegacyMode(int newMode) { @@ -109,6 +115,14 @@ public class RemoteAnimationTargetCompat { } } + public RemoteAnimationTarget unwrap() { + return new RemoteAnimationTarget( + taskId, mode, leash.getSurfaceControl(), isTranslucent, clipRect, contentInsets, + prefixOrderIndex, position, localBounds, screenSpaceBounds, windowConfiguration, + isNotInRecents, mStartLeash, startBounds, taskInfo, allowEnterPip, windowType + ); + } + /** * Almost a copy of Transitions#setupStartState. @@ -220,6 +234,10 @@ public class RemoteAnimationTargetCompat { mStartLeash = null; rotationChange = change.getEndRotation() - change.getStartRotation(); windowType = INVALID_WINDOW_TYPE; + + // TODO this probably isn't right but it's unused for now /shrug + windowConfiguration = new WindowConfiguration(); + startBounds = change.getStartAbsBounds(); } public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) {