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

Commit 0348b3f2 authored by Louis Chang's avatar Louis Chang
Browse files

Clear the TF#mPausingActivity before complete finishing the Activity

The Activity state was set to PAUSED when the Activity reported
paused. Since the Activity was also finishing, AR#completeFinishing
was called (and it happened before clear the TF#mPausingActivity).
In that case, the TF#mPausingActivity is incorrectly reset to null
while there was another Activity started pausing in #completeFinishing.

Activity#A paused
   -> TF#completePause
      -> AR#completeFinishing
         … -> resuming Activity B and pausing Activity B
              (sets TF#mPausingActivity to B)
   -> setPausingActivity to null in TF#completePause

Once the other Activity paused, it was not added to the stopping
list because the Activity was already invisible.

Bug: 339586518
Test: steps on the bug
Change-Id: I978d81eaa380b7c7a3dcfe85dd23dca1f0bef58c
parent 2030d4f8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1906,6 +1906,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
            prev.setWillCloseOrEnterPip(false);
            final boolean wasStopping = prev.isState(STOPPING);
            prev.setState(PAUSED, "completePausedLocked");
            mPausingActivity = null;
            if (prev.finishing) {
                // We will update the activity visibility later, no need to do in
                // completeFinishing(). Updating visibility here might also making the next
@@ -1941,7 +1942,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
            if (prev != null) {
                prev.stopFreezingScreen(true /* unfreezeNow */, true /* force */);
            }
            mPausingActivity = null;
        }

        if (resumeNext) {