Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54281a4f authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Pass RecentsAnimationTargets to shell to reparent" into sc-v2-dev

parents 651bd056 2bf30747
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
}
+21 −3
Original line number Diff line number Diff line
@@ -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];
        }
+1 −0
Original line number Diff line number Diff line
@@ -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;

+18 −0
Original line number Diff line number Diff line
@@ -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) {