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

Commit d6d9627c authored by Jerry Chang's avatar Jerry Chang
Browse files

Fix unexpectedly dismiss split by dragging the same app to the same side

Make sure to only evicts non-opening task when there's a new task
opening into split.

Fix: 261540443
Test: dragging the same app to the same side won't dismiss split
Change-Id: I5d7ae6cdfdc2971817a80befc834d7c45524ebc2
parent b60de628
Loading
Loading
Loading
Loading
+19 −17
Original line number Diff line number Diff line
@@ -455,8 +455,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
    void startIntentLegacy(PendingIntent intent, Intent fillInIntent, @SplitPosition int position,
            @Nullable Bundle options) {
        final boolean isEnteringSplit = !isSplitActive();
        final WindowContainerTransaction evictWct = new WindowContainerTransaction();
        prepareEvictChildTasks(position, evictWct);

        LegacyTransitions.ILegacyTransition transition = new LegacyTransitions.ILegacyTransition() {
            @Override
@@ -464,7 +462,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
                    IRemoteAnimationFinishedCallback finishedCallback,
                    SurfaceControl.Transaction t) {
                if (isEnteringSplit) {
                boolean openingToSide = false;
                if (apps != null) {
                    for (int i = 0; i < apps.length; ++i) {
@@ -475,12 +472,12 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                        }
                    }
                }
                    if (!openingToSide) {

                if (isEnteringSplit && !openingToSide) {
                    mMainExecutor.execute(() -> exitSplitScreen(
                            mSideStage.getChildCount() == 0 ? mMainStage : mSideStage,
                            EXIT_REASON_UNKNOWN));
                }
                }

                if (apps != null) {
                    for (int i = 0; i < apps.length; ++i) {
@@ -499,8 +496,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    }
                }


                if (!isEnteringSplit && openingToSide) {
                    final WindowContainerTransaction evictWct = new WindowContainerTransaction();
                    prepareEvictNonOpeningChildTasks(position, apps, evictWct);
                    mSyncQueue.queue(evictWct);
                }
            }
        };

        final WindowContainerTransaction wct = new WindowContainerTransaction();