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

Commit 3b9d53d3 authored by Tony Huang's avatar Tony Huang Committed by Android (Google) Code Review
Browse files

Merge "Make sure launcher side can animate divider"

parents 3f1e934c 2fa2671b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
    }

    RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) {
        if (!isSplitScreenVisible()) return null;
        if (apps.length < 2) return null;
        final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
                .setContainerLayer()
                .setName("RecentsAnimationSplitTasks")
+20 −6
Original line number Diff line number Diff line
@@ -369,6 +369,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
    void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
            int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
            float splitRatio, RemoteAnimationAdapter adapter) {
        // Init divider first to make divider leash for remote animation target.
        mSplitLayout.init();
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        // Need to add another wrapper here in shell so that we can inject the divider bar
        // and also manage the process elevation via setRunningRemote
@@ -385,6 +387,15 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    augmentedNonApps[i] = nonApps[i];
                }
                augmentedNonApps[augmentedNonApps.length - 1] = getDividerBarLegacyTarget();

                IRemoteAnimationFinishedCallback wrapCallback =
                        new IRemoteAnimationFinishedCallback.Stub() {
                            @Override
                            public void onAnimationFinished() throws RemoteException {
                                mSyncQueue.runInSync(t -> setDividerVisibility(true, t));
                                finishedCallback.onAnimationFinished();
                            }
                        };
                try {
                    try {
                        ActivityTaskManager.getService().setRunningRemoteTransitionDelegate(
@@ -393,8 +404,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                        Slog.e(TAG, "Unable to boost animation thread. This should only happen"
                                + " during unit tests");
                    }
                    adapter.getRunner().onAnimationStart(transit, apps, wallpapers, nonApps,
                            finishedCallback);
                    adapter.getRunner().onAnimationStart(transit, apps, wallpapers,
                            augmentedNonApps, wrapCallback);
                } catch (RemoteException e) {
                    Slog.e(TAG, "Error starting remote animation", e);
                }
@@ -402,6 +413,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,

            @Override
            public void onAnimationCancelled() {
                mSyncQueue.runInSync(t -> setDividerVisibility(true, t));
                try {
                    adapter.getRunner().onAnimationCancelled();
                } catch (RemoteException e) {
@@ -868,9 +880,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,

    private void applyDividerVisibility(SurfaceControl.Transaction t) {
        final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash();
        if (dividerLeash == null) {
            return;
        }
        if (dividerLeash == null) return;

        if (mDividerVisible) {
            t.show(dividerLeash);
@@ -895,11 +905,15 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            }
        } else if (isSideStage) {
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            mSplitLayout.init();
            // Make sure the main stage is active.
            mMainStage.activate(getMainStageBounds(), wct, true /* reparent */);
            mSideStage.moveToTop(getSideStageBounds(), wct);
            mSyncQueue.queue(wct);
            mSyncQueue.runInSync(t -> updateSurfaceBounds(mSplitLayout, t));
            mSyncQueue.runInSync(t -> {
                updateSurfaceBounds(mSplitLayout, t);
                setDividerVisibility(true, t);
            });
        }
        if (mMainStageListener.mHasChildren && mSideStageListener.mHasChildren) {
            mShouldUpdateRecents = true;