Unset window destroying state only if its surface is destroyed

Otherwise if mDestroying is unset unexpectedly, the pending
destroing surface of the window will show on screen again.
E.g. from ActivityRecord#notifyAppResumed
  -> ActivityRecord#destroySurfaces
   -> WindowStatedestroySurface(
       cleanupOnResume=true, appStopped=false)

Fix: 377179807
Flag: EXEMPT bugfix
Test: atest WindowStateTests#testDestroySurface
Test: Set the root view of a dialog in an activity to GONE.
      Switch to another activity and switch back before the
      previous activity stopped. The dialog should not appear
      on screen.
Change-Id: I380e87e0df40d5d5dda8ea71d1164cf9259da555
2 files changed