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

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

Schedule top-resumed-activity-gain after previous one paused

When the top-resumed-activity-gain event is scheduled immediately
after the previous top-resumed activity reports back (potentially
even before the previous activity has paused), it may lead to
unnecessary and rapid top-resumed activity switches, particularly
when having multiple resumed activities in a root task.

Consider the following scenario where Activity#C is the top-resumed
activity:

   Root-Task
      - Task#1
         - Activity#C (resumed)
         - Activity#A (stopped)
      - Task#2
         - Activity#B (resumed)

In this case, Activity#A is intended to resume once Activity#C
finishes. However, the top-resumed activity sequence would be
C -> B -> A.

To address this, this ensures that the top-resumed-activity-gain
event will now wait until the previous top-resumed activity has
paused and has scheduled the next activity to resume.

Bug: 417956804
Test: wm presubmit
Test: ActivityLifecycleTopResumedStateTests
Flag: com.android.window.flags.fix_rapid_top_resumed_switch
Change-Id: Ia849f816567e14a707793fd36eede0955c813394
parent b6a56c4f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment