Exclude non-main windows during their removal

...from being captured in the snapshot.
If a window that is being removed is captured in a snapshot, the
snapshot will definitely be inconsistent with the activity upon the
next launch. Therefore, it is recommended to either exclude non-main
windows from being captured in a snapshot, or to remove the activity
snapshot if a window is removed after the snapshot was captured.

Flag: com.android.window.flags.exclude_non_main_window_from_snapshot
Bug: 412295455
Test: Launch an activity from a popup window. Then, verify either that the
popup window won't be captured in the snapshot, or that the activity
snapshot is removed after the popup window is removed.

Change-Id: I82f8c1efa72a308c5c36c0ad3547a2f8a5cd5ef0
4 files changed