Reland "Prevent dismissing starting window when reopening app"

If we are changing the visibility while the app is shortly before
drawing it's first frame, we cleared out the draw state, leading
to a hang. We also had this issue with starting windows, but that
was a fix only for starting windows, but cascaded the underlying
issue.

Now, we only clear out the draw state if is has fully drawn - this
covers the Chrome case but doesn't clear out draw state if it's
just about to show.

Test: go/wm-smoke
Test: Open TTS settings, go back, open again
Bug: 135084202
Fixes: 134561008
Change-Id: Icd318ffd7c63dd244e0812775af28cb1a182597e
1 file changed