Wait for all destroying activities to kill task process

For example:
Task of package A
 - top translucent activity of package B
 - bottom activity of package A
The activities are in different processes, so B may complete
destroyed earlier than A. If the kill is triggered when receiving
the destroyed of A, B may be died before it completes onStop and
onDestroy. So now wait for both A and B.

Also move cancel-kill from cleanup to handleAppDied to avoid the
pending state getting cleared too early when waiting for multiple
activities to destroy.

Fix: 290938781
Test: atest RecentTasksTest#testRemovePackageByName
Change-Id: Ia0928ebddc6ffa56acc065c0833d660bd275e3f6
3 files changed