Hold off on destroying an activity until the resumed one is visible.

After ag/9754495, the visibility related flags in ActivityRecord are
already updated before the code reaches to completeFinishing(), so
we use activity status instead.

With this change, an activity in PAUSED state won't be destroyed
immediately but is put into the stopping list even if the next
top activity is already visible.

Bug: 145186882
Bug: 80414790
Test: atest ActivityLifeCycleTests ActivityLifecycleTopResumedStateTests
Change-Id: I61a9aa382d39797e835a1a5f64d64765372bf3bf
2 files changed