Ensure arraylist index is montonically decreasing

A previous fix for IndexOutOfBoundsException (ag/584621) left a
situation where the index would not decrement if the arraylist
size didn't change. The size doesn't change if the window being
removed is animating away. That caused window manager to remain
in an infinite loop within removeAllWindows.

This change ensures that the index diminishes each pass through
the loop and doesn't exceed the bounds of the arraylist.

Fixes bug 18362246.

Change-Id: Ibca70d95622f3b152ede14857f0e913099dc7b88
1 file changed