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

Commit e3582ce4 authored by Louis Chang's avatar Louis Chang
Browse files

Fixes the regression that the resumed activity not paused beforehand

The resumed activity of the same TaskFragmnet is not paused before
resuming the next activity. This is a regression from commit 7943b5c2.

This CL fixes the issue by restoring the original implementation and
also adding `andResume` check to ensure this is happening only if the
activity restarting is going to be started to resumed state.

Bug: 300019674
Test: atest PinActivityStackTests
Change-Id: I6b3e61ba63680fc47b152f5564392a21da3e803d
parent 45eda46e
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -795,11 +795,20 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            return false;
        }

        // Try pausing the existing resumed activity in the Task if any.
        final Task task = r.getTask();
        if (andResume) {
            // Try pausing the existing resumed activity in the Task if any.
            if (task.pauseActivityIfNeeded(r, "realStart")) {
                return false;
            }
            final TaskFragment taskFragment = r.getTaskFragment();
            if (taskFragment != null && taskFragment.getResumedActivity() != null) {
                if (taskFragment.startPausing(mUserLeaving, false /* uiSleeping */, r,
                        "realStart")) {
                    return false;
                }
            }
        }

        final Task rootTask = task.getRootTask();
        beginDeferResume();