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

Commit 7830afcc authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Keep splitting tasks in the background with shell transition" into...

Merge "Keep splitting tasks in the background with shell transition" into udc-dev am: 026f3296 am: bf28a404

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22994256



Change-Id: I6f8c08742824da4132844bf94e722f920d427a97
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0cc95179 bf28a404
Loading
Loading
Loading
Loading
+27 −9
Original line number Original line Diff line number Diff line
@@ -1476,6 +1476,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            mSideStage.removeAllTasks(wct, false /* toTop */);
            mSideStage.removeAllTasks(wct, false /* toTop */);
            mMainStage.deactivate(wct, false /* toTop */);
            mMainStage.deactivate(wct, false /* toTop */);
        }
        }
        wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
                false /* reparentLeafTaskIfRelaunch */);
    }
    }


    private void prepareEnterSplitScreen(WindowContainerTransaction wct) {
    private void prepareEnterSplitScreen(WindowContainerTransaction wct) {
@@ -2327,6 +2329,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    // the remote handler.
                    // the remote handler.
                    return null;
                    return null;
                }
                }

                if ((mMainStage.containsTask(triggerTask.taskId)
                            && mMainStage.getChildCount() == 1)
                        || (mSideStage.containsTask(triggerTask.taskId)
                            && mSideStage.getChildCount() == 1)) {
                    // A splitting task is opening to fullscreen causes one side of the split empty,
                    // so appends operations to exit split.
                    prepareExitSplitScreen(STAGE_TYPE_UNDEFINED, out);
                }
            }
            }
        } else {
        } else {
            if (isOpening && getStageOfTask(triggerTask) != null) {
            if (isOpening && getStageOfTask(triggerTask) != null) {
@@ -2409,9 +2420,23 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    if (isOpeningType(change.getMode())) {
                    if (isOpeningType(change.getMode())) {
                        // Split is opened by someone so set it as visible.
                        // Split is opened by someone so set it as visible.
                        setSplitsVisible(true);
                        setSplitsVisible(true);
                        // TODO(b/275664132): Find a way to integrate this with finishWct.
                        //  This is setting the flag to a task and not interfering with the
                        //  transition.
                        final WindowContainerTransaction wct = new WindowContainerTransaction();
                        wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
                                false /* reparentLeafTaskIfRelaunch */);
                        mTaskOrganizer.applyTransaction(wct);
                    } else if (isClosingType(change.getMode())) {
                    } else if (isClosingType(change.getMode())) {
                        // Split is closed by someone so set it as invisible.
                        // Split is closed by someone so set it as invisible.
                        setSplitsVisible(false);
                        setSplitsVisible(false);
                        // TODO(b/275664132): Find a way to integrate this with finishWct.
                        //  This is setting the flag to a task and not interfering with the
                        //  transition.
                        final WindowContainerTransaction wct = new WindowContainerTransaction();
                        wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
                                true /* reparentLeafTaskIfRelaunch */);
                        mTaskOrganizer.applyTransaction(wct);
                    }
                    }
                    continue;
                    continue;
                }
                }
@@ -2812,16 +2837,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            }
            }
        }
        }


        // TODO(b/275664132): Remove dismissing split screen here to fit in back-to-split support.
        // Dismiss the split screen if it's not returning to split.
        prepareExitSplitScreen(STAGE_TYPE_UNDEFINED, finishWct);
        for (TransitionInfo.Change change : info.getChanges()) {
            if (change.getTaskInfo() != null && TransitionUtil.isClosingType(change.getMode())) {
                finishT.setCrop(change.getLeash(), null).hide(change.getLeash());
            }
        }
        setSplitsVisible(false);
        setSplitsVisible(false);
        setDividerVisibility(false, finishT);
        finishWct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
                true /* reparentLeafTaskIfRelaunch */);
        logExit(EXIT_REASON_UNKNOWN);
        logExit(EXIT_REASON_UNKNOWN);
    }
    }


+5 −1
Original line number Original line Diff line number Diff line
@@ -2908,6 +2908,9 @@ class ActivityStarter {
    private void setTargetRootTaskIfNeeded(ActivityRecord intentActivity) {
    private void setTargetRootTaskIfNeeded(ActivityRecord intentActivity) {
        intentActivity.getTaskFragment().clearLastPausedActivity();
        intentActivity.getTaskFragment().clearLastPausedActivity();
        Task intentTask = intentActivity.getTask();
        Task intentTask = intentActivity.getTask();
        // The intent task might be reparented while in getOrCreateRootTask, caches the original
        // root task to distinguish if it is moving to front or not.
        final Task origRootTask = intentTask != null ? intentTask.getRootTask() : null;


        if (mTargetRootTask == null) {
        if (mTargetRootTask == null) {
            // Update launch target task when it is not indicated.
            // Update launch target task when it is not indicated.
@@ -2940,7 +2943,8 @@ class ActivityStarter {
                    ? null : focusRootTask.topRunningNonDelayedActivityLocked(mNotTop);
                    ? null : focusRootTask.topRunningNonDelayedActivityLocked(mNotTop);
            final Task topTask = curTop != null ? curTop.getTask() : null;
            final Task topTask = curTop != null ? curTop.getTask() : null;
            differentTopTask = topTask != intentTask
            differentTopTask = topTask != intentTask
                    || (focusRootTask != null && topTask != focusRootTask.getTopMostTask());
                    || (focusRootTask != null && topTask != focusRootTask.getTopMostTask())
                    || (focusRootTask != null && focusRootTask != origRootTask);
        } else {
        } else {
            // The existing task should always be different from those in other displays.
            // The existing task should always be different from those in other displays.
            differentTopTask = true;
            differentTopTask = true;