Make sure to report wait result when clean up activities

Starting activity with ‘-W’ option from shell waited forever
because activity was brought to top, but being removed from
waiting visible activities (due to process was gone) without
reporting the wait result.

Also correcting the component to avoid waiting for a top
finishing activity.

Bug: 117579987
Test: atest ActivityManagerAmStartOptionsTests

Change-Id: I7c1e6781544f0d794225a13fdf417475ff0598a3
3 files changed