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
Loading
Please register or sign in to comment