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
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 5cd4fc4..37695cb 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -3020,7 +3020,7 @@
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;
}