Fix issue with leaked preserved surface

Imagine a non-app-window going through the following sequence:

1. Window starts out visible
2. Client sets to GONE
3. Exit animation starts.
4. Client sets to VISIBLE
5. Before it can redraw, Client sets to GONE again

In that case we preserve the surface because we need to client to
force-retrieve a new surface. However, we never mark the surface
as to be destroyed because we never enter the path in
WSA.prepareSurfaceLocked that would mark the preserved surface to
be destroyed, which is only the case when the client redraws.

Fix this by also marking it as to be destroyed when the surface
gets hidden.

Test: Above flow. See bug for test app.
Change-Id: Ic554ae787e7d2130b93b993fadf8c302913ed6ee
Fixes: 77633603
2 files changed