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

Commit 72cecb84 authored by Tony Huang's avatar Tony Huang
Browse files

Fix launch adjacent behavior if split background

We should handle the transition request if task is open under stage
but split invisible ant treat it same as split inactive.

Fix: 283738741
Test: pass existing tests
Test: manual
Change-Id: Icdde8bba0d246c91b95322924f9a468a5c01b199
parent 2907102b
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -2291,6 +2291,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    prepareExitSplitScreen(dismissTop, out);
                    mSplitTransitions.setDismissTransition(transition, dismissTop,
                            EXIT_REASON_APP_FINISHED);
                } else if (!isSplitScreenVisible() && isOpening) {
                    // If split running backgroud and trigger task is appearing into split,
                    // prepare to enter split screen.
                    prepareEnterSplitScreen(out);
                    mSplitTransitions.setEnterTransition(transition, request.getRemoteTransition(),
                            null /* consumedCallback */, null /* finishedCallback */,
                            TRANSIT_SPLIT_SCREEN_PAIR_OPEN, !mIsDropEntering);
                }
            } else if (isOpening && inFullscreen) {
                final int activityType = triggerTask.getActivityType();
@@ -2316,7 +2323,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                prepareEnterSplitScreen(out);
                mSplitTransitions.setEnterTransition(transition, request.getRemoteTransition(),
                        null /* consumedCallback */, null /* finishedCallback */,
                        TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, !mIsDropEntering);
                        TRANSIT_SPLIT_SCREEN_PAIR_OPEN, !mIsDropEntering);
            }
        }
        return out;
@@ -2565,17 +2572,22 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        // First, verify that we actually have opened apps in both splits.
        TransitionInfo.Change mainChild = null;
        TransitionInfo.Change sideChild = null;
        final WindowContainerTransaction evictWct = new WindowContainerTransaction();
        for (int iC = 0; iC < info.getChanges().size(); ++iC) {
            final TransitionInfo.Change change = info.getChanges().get(iC);
            final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
            if (taskInfo == null || !taskInfo.hasParentTask()) continue;
            final @StageType int stageType = getStageType(getStageOfTask(taskInfo));
            if (stageType == STAGE_TYPE_MAIN
            if (mainChild == null && stageType == STAGE_TYPE_MAIN
                    && (isOpeningType(change.getMode()) || change.getMode() == TRANSIT_CHANGE)) {
                // Includes TRANSIT_CHANGE to cover reparenting top-most task to split.
                mainChild = change;
            } else if (stageType == STAGE_TYPE_SIDE && isOpeningType(change.getMode())) {
            } else if (sideChild == null && stageType == STAGE_TYPE_SIDE
                    && isOpeningType(change.getMode())) {
                sideChild = change;
            } else if (stageType != STAGE_TYPE_UNDEFINED && change.getMode() == TRANSIT_TO_BACK) {
                // Collect all to back task's and evict them when transition finished.
                evictWct.reparent(taskInfo.token, null /* parent */, false /* onTop */);
            }
        }

@@ -2637,6 +2649,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    mSideStage.evictInvisibleChildren(callbackWct);
                }
            }
            if (!evictWct.isEmpty()) {
                callbackWct.merge(evictWct, true);
            }
            if (enterTransition.mResizeAnim) {
                mShowDecorImmediately = true;
                mSplitLayout.flingDividerToCenter();