Don't take invisible screenshots

This fixes a bug where we took a snapshot of a task while the
surface wasn't visible yet. The transition was set-up so the win
animator was already shown but translucency was set to 0, leading
that the snapshot is a black screen.

We fixed this by also checking whether the alpha is non-zero.

Fixes a bug where launching a Hangouts notification from the
lockscreen causes a black flicker. When we launch the activity,
the Hangouts activity is in the mClosingApps list, because it's
immediately hidden from the lockscreen, which means we try to take
a snapshot. Shortly after that we reopen the activity because
Keyguard is going away, so we try to reuse a snapshot.

Test: go/wm-smoke
Test: Open hangouts, close hangouts with back button, go to
Keyguard, receive message, launch notification

Change-Id: Iffc1db1a738800c90a2421a5f90174d647eb4440
Fixes: 65695379
This commit is contained in:
Jorim Jaggi
2017-09-15 14:17:40 +02:00
parent b7202a8339
commit 406386a894

View File

@@ -3020,7 +3020,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
final boolean foundTargetWs =
(w.mAppToken != null && w.mAppToken.token == appToken)
|| (mScreenshotApplicationState.appWin != null && wallpaperOnly);
if (foundTargetWs && winAnim.getShown()) {
if (foundTargetWs && winAnim.getShown() && winAnim.mLastAlpha > 0f) {
mScreenshotApplicationState.screenshotReady = true;
}