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

Commit 466a3598 authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Set transientlaunch before starting transient activity" into udc-qpr-dev

parents c268174c 3ceb2568
Loading
Loading
Loading
Loading
+20 −15
Original line number Diff line number Diff line
@@ -1588,22 +1588,15 @@ class ActivityStarter {
                newTransition = null;
            }
        }
        if (isTransientLaunch) {
        if (forceTransientTransition) {
            transitionController.collect(mLastStartActivityRecord);
            transitionController.collect(mPriorAboveTask);
            }
            // `started` isn't guaranteed to be the actual relevant activity, so we must wait
            // until after we launched to identify the relevant activity.
            transitionController.setTransientLaunch(mLastStartActivityRecord, mPriorAboveTask);
            if (forceTransientTransition) {
            final DisplayContent dc = mLastStartActivityRecord.getDisplayContent();
            // update wallpaper target to TransientHide
            dc.mWallpaperController.adjustWallpaperWindows();
            // execute transition because there is no change
            transitionController.setReady(dc, true /* ready */);
        }
        }
        if (!userLeaving) {
            // no-user-leaving implies not entering PiP.
            transitionController.setCanPipOnFinish(false /* canPipOnFinish */);
@@ -1712,6 +1705,7 @@ class ActivityStarter {
                    activity.destroyIfPossible("Removes redundant singleInstance");
                }
            }
            recordTransientLaunchIfNeeded(targetTaskTop);
            // Recycle the target task for this launch.
            startResult = recycleTask(targetTask, targetTaskTop, reusedTask, intentGrants);
            if (startResult != START_SUCCESS) {
@@ -1743,6 +1737,9 @@ class ActivityStarter {
            addOrReparentStartingActivity(targetTask, "adding to task");
        }

        // After activity is attached to task, but before actual start
        recordTransientLaunchIfNeeded(mLastStartActivityRecord);

        if (!mAvoidMoveToFront && mDoResume) {
            mTargetRootTask.getRootTask().moveToFront("reuseOrNewTask", targetTask);
            if (!mTargetRootTask.isTopRootTaskInDisplayArea() && mService.isDreaming()
@@ -1839,6 +1836,14 @@ class ActivityStarter {
        return START_SUCCESS;
    }

    private void recordTransientLaunchIfNeeded(ActivityRecord r) {
        if (r == null || !mTransientLaunch) return;
        final TransitionController controller = r.mTransitionController;
        if (controller.isCollecting() && !controller.isTransientCollect(r)) {
            controller.setTransientLaunch(r, mPriorAboveTask);
        }
    }

    /** Returns the leaf task where the target activity may be placed. */
    private Task computeTargetTask() {
        if (mStartActivity.resultTo == null && mInTask == null && !mAddingToTask
+13 −5
Original line number Diff line number Diff line
@@ -358,22 +358,30 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        mTransientLaunches.put(activity, restoreBelow);
        setTransientLaunchToChanges(activity);

        if (restoreBelow != null) {
        final Task transientRootTask = activity.getRootTask();
        final WindowContainer<?> parent = restoreBelow != null ? restoreBelow.getParent()
                : (transientRootTask != null ? transientRootTask.getParent() : null);
        if (parent != null) {
            // Collect all visible tasks which can be occluded by the transient activity to
            // make sure they are in the participants so their visibilities can be updated when
            // finishing transition.
            ((WindowContainer<?>) restoreBelow.getParent()).forAllTasks(t -> {
            parent.forAllTasks(t -> {
                // Skip transient-launch task
                if (t == transientRootTask) return false;
                if (t.isVisibleRequested() && !t.isAlwaysOnTop()
                        && !t.getWindowConfiguration().tasksAreFloating()) {
                    if (t.isRootTask() && t != transientRootTask) {
                    if (t.isRootTask()) {
                        mTransientHideTasks.add(t);
                    }
                    if (t.isLeafTask()) {
                        collect(t);
                    }
                }
                return t == restoreBelow;
                return restoreBelow != null
                        // Stop at the restoreBelow task
                        ? t == restoreBelow
                        // Or stop at the last visible task if no restore-below (new task)
                        : (t.isRootTask() && t.fillsParent());
            });
            // Add FLAG_ABOVE_TRANSIENT_LAUNCH to the tree of transient-hide tasks,
            // so ChangeInfo#hasChanged() can return true to report the transition info.