Ensure force-stopped process do not start again during cleanup

By setting all activities of the removed process as finishing,
those activities haven’t been removed won't be the candidate of
top or visible activity.

Also adjust the conditions to set ProcessRecord.removed to fit the
original meaning a bit. That should be used to indicate the process
is killed for the change of package state. Now ProcessRecord.removed
will only be set when force-stop or crash too many times.

Fixes: 114117787
Fixes: 37070733
Test: atest ActivityManagerTest#testForceStopPackageWontRestartProcess
Test: atest ActivityStackTests

Change-Id: Ia2975c2e4ece8600307b317f124354ecdca55d31
9 files changed