Do not count closing activity as visible process
Previously, VisibleActivityProcessTracker#hasVisibleActivity can
still return true when the only activity of a process is in a
playing transition animation (since shell transition only commits
invisible until transition is done). That may lead to a timing
that background launch check still allows the process with
visible window to launch activity. For example, after pressing home
key, the closing app may still be able to launch activity at a
specific timing after APP_SWITCH_DISALLOW updates to
APP_SWITCH_FG_ONLY but the transition is not finished yet.
FIXED_READ_ONLY_FLAG_REASON=OTHER_SYSTEM_HEALTH_APPROVED CVE backport
Bug: 396653764
Flag: com.android.window.flags.use_visible_requested_for_process_tracker
Test: WindowProcessControllerTests#testComputeProcessActivityState
(cherry picked from commit dbdbdf5e0c56757462d4e9aa0092990077919a11)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:93cb70f1bf64d29d2c0135302b84cb52915a5d92
Merged-In: I064ce5cbb140c68d3e1a482980df52ee5d37f361
Change-Id: I064ce5cbb140c68d3e1a482980df52ee5d37f361
3 files changed