From d127c6d46179ac74afe20ccfd99f0d4ed2da0eb0 Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Mon, 2 May 2016 16:36:41 -0700 Subject: [PATCH] Fix bad animation when pressing Home with translucent activity Force a setAppVisibility if the previous app was translucent, so that the resumed app is added to the opening app list. Otherwise opening app list is empty and the transition can't be set up correctly. bug: 28463843 Change-Id: I7f8e28d0f804c799a429743df6fc501c06d62f21 --- .../java/com/android/server/am/ActivityStack.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 21fc4d8c68fca..7486c721603f6 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -2327,8 +2327,20 @@ final class ActivityStack { if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resume running: " + next + " stopped=" + next.stopped + " visible=" + next.visible); + // If the previous activity is translucent, force a visibility update of + // the next activity, so that it's added to WM's opening app list, and + // transition animation can be set up properly. + // For example, pressing Home button with a translucent activity in focus. + // Launcher is already visible in this case. If we don't add it to opening + // apps, maybeUpdateTransitToWallpaper() will fail to identify this as a + // TRANSIT_WALLPAPER_OPEN animation, and run some funny animation. + final boolean lastActivityTranslucent = lastStack != null + && (!lastStack.mFullscreen + || (lastStack.mLastPausedActivity != null + && !lastStack.mLastPausedActivity.fullscreen)); + // This activity is now becoming visible. - if (!next.visible || next.stopped) { + if (!next.visible || next.stopped || lastActivityTranslucent) { mWindowManager.setAppVisibility(next.appToken, true); }