Several fixes for saved surface

- Do not save if the exiting app is no longer top of task

- Mark saved surfaces as invalid when recoving memory, they will
  be reclaimed if they're hidden.

- Save surface when visibility changed to GONE

- Discard saved surface after rotation

- Misc minor fixes and clean-up

bug: 19940527

Change-Id: I5760c7a7b4bf37ef6bdd39cae793a97cf7579429
6 files changed