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

Commit 7c6e1b25 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Remove remaining embedded Task logic"

parents 8ba9c2ca 30dc09f4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1674,7 +1674,7 @@ class ActivityStarter {
        mRootWindowContainer.startPowerModeLaunchIfNeeded(
                false /* forceSend */, mStartActivity);

        final boolean isTaskSwitch = startedTask != prevTopTask && !startedTask.isEmbedded();
        final boolean isTaskSwitch = startedTask != prevTopTask;
        mTargetRootTask.startActivityLocked(mStartActivity, topRootTask, newTask, isTaskSwitch,
                mOptions, sourceRecord);
        if (mDoResume) {
@@ -2753,8 +2753,7 @@ class ActivityStarter {
        } else {
            TaskFragment candidateTf = mAddingToTaskFragment != null ? mAddingToTaskFragment : null;
            if (candidateTf == null) {
                final ActivityRecord top = task.topRunningActivity(false /* focusableOnly */,
                        false /* includingEmbeddedTask */);
                final ActivityRecord top = task.topRunningActivity(false /* focusableOnly */);
                if (top != null) {
                    candidateTf = top.getTaskFragment();
                }
+1 −6
Original line number Diff line number Diff line
@@ -849,12 +849,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            // activity cannot be focused unless it is on the same TaskFragment as the focusedApp's.
            TaskFragment parent = activity.getTaskFragment();
            if (parent != null && parent.isEmbedded()) {
                Task hostTask = focusedApp.getTask();
                if (hostTask.isEmbedded()) {
                    // Use the hosting task if the current task is embedded.
                    hostTask = hostTask.getParent().asTaskFragment().getTask();
                }
                if (activity.isDescendantOf(hostTask)
                if (activity.getTask() == focusedApp.getTask()
                        && activity.getTaskFragment() != focusedApp.getTaskFragment()) {
                    return false;
                }
+1 −7
Original line number Diff line number Diff line
@@ -1348,8 +1348,7 @@ class RecentTasks {
                    + " activityType=" + task.getActivityType()
                    + " windowingMode=" + task.getWindowingMode()
                    + " isAlwaysOnTopWhenVisible=" + task.isAlwaysOnTopWhenVisible()
                    + " intentFlags=" + task.getBaseIntent().getFlags()
                    + " isEmbedded=" + task.isEmbedded());
                    + " intentFlags=" + task.getBaseIntent().getFlags());
        }

        switch (task.getActivityType()) {
@@ -1385,11 +1384,6 @@ class RecentTasks {
            return false;
        }

        // Ignore the task if it is a embedded task
        if (task.isEmbedded()) {
            return false;
        }

        // Ignore the task if it is started on a display which is not allow to show its tasks on
        // Recents.
        if (task.getDisplayContent() != null
+1 −18
Original line number Diff line number Diff line
@@ -350,25 +350,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                return false;
            }

            if (matchingCandidate(task)) {
                return true;
            }

            // Looking for the embedded tasks (if any)
            return !task.isLeafTaskFragment() && task.forAllLeafTaskFragments(
                    this::matchingCandidate);
        }

        boolean matchingCandidate(TaskFragment taskFragment) {
            final Task task = taskFragment.asTask();
            if (task == null) {
                return false;
            }

            // Overlays should not be considered as the task's logical top activity.
            // Activities of the tasks that embedded from this one should not be used.
            final ActivityRecord r = task.getTopNonFinishingActivity(false /* includeOverlays */,
                    false /* includingEmbeddedTask */);
            final ActivityRecord r = task.getTopNonFinishingActivity(false /* includeOverlays */);

            if (r == null || r.finishing || r.mUserId != userId
                    || r.launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE) {
+3 −19
Original line number Diff line number Diff line
@@ -2980,9 +2980,8 @@ class Task extends TaskFragment {
                // Found it. This activity on top of the given activity on the same TaskFragment.
                return true;
            }
            if (isSelfOrNonEmbeddedTask(parent.asTask())) {
                // Found it. This activity is the direct child of a leaf Task without being
                // embedded.
            if (parent != null && parent.asTask() != null) {
                // Found it. This activity is the direct child of a leaf Task.
                return true;
            }
            // The candidate activity is being embedded. Checking if the bounds of the containing
@@ -2993,7 +2992,7 @@ class Task extends TaskFragment {
                    // Not occluding the grandparent.
                    break;
                }
                if (isSelfOrNonEmbeddedTask(grandParent.asTask())) {
                if (grandParent.asTask() != null) {
                    // Found it. The activity occludes its parent TaskFragment and the parent
                    // TaskFragment also occludes its parent all the way up.
                    return true;
@@ -3006,13 +3005,6 @@ class Task extends TaskFragment {
        return top != activity ? top : null;
    }

    private boolean isSelfOrNonEmbeddedTask(Task task) {
        if (task == this) {
            return true;
        }
        return task != null && !task.isEmbedded();
    }

    @Override
    public SurfaceControl.Builder makeAnimationLeash() {
        return super.makeAnimationLeash().setMetadata(METADATA_TASK_ID, mTaskId);
@@ -5091,14 +5083,6 @@ class Task extends TaskFragment {
                // window manager to keep the previous window it had previously
                // created, if it still had one.
                Task baseTask = r.getTask();
                if (baseTask.isEmbedded()) {
                    // If the task is embedded in a task fragment, there may have an existing
                    // starting window in the parent task. This allows the embedded activities
                    // to share the starting window and make sure that the window can have top
                    // z-order by transferring to the top activity.
                    baseTask = baseTask.getParent().asTaskFragment().getTask();
                }

                final ActivityRecord prev = baseTask.getActivity(
                        a -> a.mStartingData != null && a.showToCurrentUser());
                mWmService.mStartingSurfaceController.showStartingWindow(r, prev, newTask,
Loading