From 588932a53e63c0a7ee281dea22559c129b40eb99 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Wed, 1 Jul 2015 16:02:15 -0700 Subject: Always wait for the main app window before starting a transition When waiting for all the windows that belong to an activity, we skipped the main window, in case it didn't had a surface yet. This was a problem because with SurfaceViews: They set it's visibility extremely early in the app visibility change cycle. Then, they use another thread to draw content. Thus, they have drawn their first frame pretty fast, where the main thread might still be in the activity lifecycle phases. Then, we don't even have a surface for the main window yet, but we start the app transition already because we think the only interesting window for this app token is the SurfaceView, which has already drawn. Bug: 22207948 Change-Id: I708add3aab00575ae1707b25622b9b4614472892 --- services/core/java/com/android/server/wm/WindowManagerService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 03ca95a..858d9ad 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -10054,7 +10054,10 @@ public class WindowManagerService extends IWindowManager.Stub } winAnimator.setSurfaceBoundariesLocked(recoveringMemory); + } + // Check the draw state of the window, but only if it is visible to the user. + if (!w.isHiddenFromUserLocked()) { final AppWindowToken atoken = w.mAppToken; if (DEBUG_STARTING_WINDOW && atoken != null && w == atoken.startingWindow) { -- cgit v1.1