Fix race condition of removing surface.

mContainer.startingSurface can be replaced between posting
mRemoveStartingWindow and actually surface.remove() is called.

1. removeStartingWindow is called, then mRemoveStartingWindow is posted
   to mHandler
2. transferStartingWindow is called, then mContainer.startingWindow is
   replaced with new surface.
3. mHandler pops the callback and surface.remove() is called.

Here the remove is only called for replaced surface and never called for
older surface.

To fix this issue, surely removes the surface when the
removeStartingWindow is called.

Bug: 63156080
Bug: 63784898
Test: Watch /proc/<pid>/fd
Change-Id: Iccf13bdc98b4012168910305568f5dd4bbedbf54
Merged-In: I55e2c1b8fba32b3a19603e6ad4743f07576abd48
(cherry picked from commit 0bf3dc9822a4817b1fea1d819ab7abf61013ad8b)
1 file changed