Prevent dismissing starting window when reopening app

We reset the draw state in case the app was hidden before. This
ensures that the starting window doesn't get dismissed
immediately, in case there is some weirdness going on when
restarting an activity, like a surface view that hasn't drawn yet.

However, we don't reset draw state for starting windows as the
snapshot doesn't redraw ever.

Test: Open Chrome, swipe up, reopen Chrome, ensure no holes
Test: Same for camera
Test: go/wm-smoke
Fixes: 134561008
Change-Id: I02742cef93a6b58f2096c98514371119fa606d16
This commit is contained in:
Jorim Jaggi
2019-06-05 15:18:37 +02:00
parent 02d9b9c35b
commit 7c88cf8303

View File

@@ -539,6 +539,14 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// If the app was already visible, don't reset the waitingToShow state.
if (isHidden()) {
waitingToShow = true;
// Let's reset the draw state in order to prevent the starting window to be
// immediately dismissed when the app still has the surface.
forAllWindows(w -> {
if (w.mAttrs.type != TYPE_APPLICATION_STARTING) {
w.mWinAnimator.resetDrawState();
}
}, true /* traverseTopToBottom */);
}
}