Remove starting window when activity is preempted.

Activities launch starting windows before they are resumed. If another
activity is started after a first activity has launched its starting
window then it was possible that the starting window will never be
removed. An earlier fix, ag/368411, solved this by posting a delayed
message that would remove orphaned starting windows after 10 seconds.

This fix immediately removes starting windows that have been orphaned
through the above sequence.

A few code cleanups are also included in this CL.

Fixes bug 11029212.

Change-Id: I7a9befca92888aefe4000b90716c57c2aa572634
3 files changed