Reduce updating focus when moving an activity which is not resumed yet
When starting an existing activity:
startActivityInner
-> recycleTask
-> setTargetRootTaskIfNeeded
-> moveTaskToFront
-> moveFocusableActivityToTop
The activity state is still STOPPED because it hasn't reached
resumeTopActivity. But getTopResumedActivity will also return
top focusable activity if there is no resumed activity. That causes
the focus is updated too early.
The focus will still be updated when setState(RESUMED) which also
invoke setLastResumedActivityUncheckLocked.
This can reduce duplicated window traversal for updating focus and
assigning layer.
Bug: 297502610
Test: ActivityTaskSupervisorTests#testUpdatePendingTopForTopResumed
TestFragmentTests# \
testIgnoreRequestedOrientationForActivityEmbeddingSplit
Change-Id: I795ba6d16b9668f772e47fc0415c296487074cdb
2 files changed