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

Commit f1877fb1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Resume root task's children preserving order" into main

parents 0b4f43fe 06950d6f
Loading
Loading
Loading
Loading
+50 −19
Original line number Diff line number Diff line
@@ -5249,6 +5249,34 @@ class Task extends TaskFragment {
                if (isFocusableAndVisible()) {
                    someActivityResumed = resumeTopActivityInnerLocked(prev, options, deferPause);
                }
            } else {
                if (DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue()) {
                    // Find visible tasks top-to-bottom.
                    final List<Task> tasksToResumeTopToBottom = new ArrayList<>();
                    for (int i = mChildren.size() - 1; i >= 0; i--) {
                        final Task child = (Task) getChildAt(i);
                        if (!child.isTopActivityFocusable()) {
                            continue;
                        }
                        if (child.getVisibility(null /* starting */)
                                != TASK_FRAGMENT_VISIBILITY_VISIBLE) {
                            if (child.topRunningActivity() == null) {
                                // Skip the task if no running activity and continue resuming next
                                // task.
                                continue;
                            }
                            // Otherwise, assuming everything behind this task should also be
                            // invisible.
                            break;
                        }
                        tasksToResumeTopToBottom.add(child);
                    }
                    // Resume them bottom-to-top, so Z order is preserved.
                    for (int i = tasksToResumeTopToBottom.size() - 1; i >= 0; i--) {
                        final Task child = tasksToResumeTopToBottom.get(i);
                        someActivityResumed |= child.resumeTopActivityUncheckedLocked(prev,
                                options, deferPause);
                    }
                } else {
                    int idx = mChildren.size() - 1;
                    while (idx >= 0) {
@@ -5259,10 +5287,12 @@ class Task extends TaskFragment {
                        if (child.getVisibility(null /* starting */)
                                != TASK_FRAGMENT_VISIBILITY_VISIBLE) {
                            if (child.topRunningActivity() == null) {
                            // Skip the task if no running activity and continue resuming next task.
                                // Skip the task if no running activity and continue resuming next
                                // task.
                                continue;
                            }
                        // Otherwise, assuming everything behind this task should also be invisible.
                            // Otherwise, assuming everything behind this task should also be
                            // invisible.
                            break;
                        }

@@ -5276,6 +5306,7 @@ class Task extends TaskFragment {
                        }
                    }
                }
            }

            // When resuming the top activity, it may be necessary to pause the top activity (for
            // example, returning to the lock screen. We suppress the normal pause logic in