From 195f6a0ff33c140c922f1f27ee7a306d7eb8f0ab Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 24 Nov 2009 11:26:00 -0800 Subject: [PATCH] Finish fixing issue #2228381: android.view.InflateException... ...Binary XML file line #37: Error inflating class after adding a secondary account The problem was that we weren't dealing well with the situation where we start a transition from activity A to B, then transition back to A before B is shown (it finishes before being shown), then transition from A to C. At this point we had some state showing that we were in the process of showing A from it being hidden (due to the middle transition from B to A), which would cause the layout pass to ensure its window is hidden before the transition starts. The solution is to detect the case where we are showing a token and it is already actually shown, and in this case not do all of the token setup for it to wait for its windows to be displayed before it is shown. This isn't needed, the windows are already displayed or the token is already set up to wait for them to be displayed. Change-Id: I16925b91e1e2449dd65ade162a5758173c6e2695 --- .../android/server/WindowManagerService.java | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index bdabca7d57507..b4db7bc0e62a0 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -3541,24 +3541,35 @@ public class WindowManagerService extends IWindowManager.Stub wtoken.inPendingTransaction = true; if (visible) { mOpeningApps.add(wtoken); - wtoken.allDrawn = false; wtoken.startingDisplayed = false; wtoken.startingMoved = false; - wtoken.waitingToShow = true; - - if (wtoken.clientHidden) { - // In the case where we are making an app visible - // but holding off for a transition, we still need - // to tell the client to make its windows visible so - // they get drawn. Otherwise, we will wait on - // performing the transition until all windows have - // been drawn, they never will be, and we are sad. - wtoken.clientHidden = false; - wtoken.sendAppVisibilityToClients(); + + // If the token is currently hidden (should be the + // common case), then we need to set up to wait for + // its windows to be ready. + if (wtoken.hidden) { + wtoken.allDrawn = false; + wtoken.waitingToShow = true; + + if (wtoken.clientHidden) { + // In the case where we are making an app visible + // but holding off for a transition, we still need + // to tell the client to make its windows visible so + // they get drawn. Otherwise, we will wait on + // performing the transition until all windows have + // been drawn, they never will be, and we are sad. + wtoken.clientHidden = false; + wtoken.sendAppVisibilityToClients(); + } } } else { mClosingApps.add(wtoken); - wtoken.waitingToHide = true; + + // If the token is currently visible (should be the + // common case), then set up to wait for it to be hidden. + if (!wtoken.hidden) { + wtoken.waitingToHide = true; + } } return; }