From f20588fdc65a5651c3a5ab5c0c20165c0e33c394 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Wed, 11 Apr 2012 17:06:21 -0700 Subject: Check WindowState when looking for animation. The method setTokenVisibilityLocked returns true when animations are delaying the exit of an app. Previously this only checked AppToken animations but that caused exiting WindowState animations to be ignored. In particular if an application both hid an AppToken and then dismissed the AppToken, the AppToken was being removed from mClosingTokens before the animation finished. This caused rebuildAppWindowListLocked to lose a WindowState. Furthermore Surfaces were not being removed when a WindowState was lost and we were leaking Surfaces. Fixes bug 6297563. Change-Id: Ie75c71064518199237ec4a17d3f65e2a2dd29674 --- .../android/server/wm/WindowManagerService.java | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 8d65dc3539c0..01ddbc37fc87 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -3974,7 +3974,6 @@ public class WindowManagerService extends IWindowManager.Stub wtoken.willBeHidden = false; if (wtoken.hidden == visible) { - final int N = wtoken.allAppWindows.size(); boolean changed = false; if (DEBUG_APP_TRANSITIONS) Slog.v( TAG, "Changing app " + wtoken + " hidden=" + wtoken.hidden @@ -3986,23 +3985,19 @@ public class WindowManagerService extends IWindowManager.Stub if (wtoken.mAppAnimator.animation == sDummyAnimation) { wtoken.mAppAnimator.animation = null; } - applyAnimationLocked(wtoken, lp, transit, visible); - changed = true; - if (wtoken.mAppAnimator.animation != null) { + if (applyAnimationLocked(wtoken, lp, transit, visible)) { delayed = runningAppAnimation = true; } + changed = true; } + final int N = wtoken.allAppWindows.size(); for (int i=0; i= 0 && !delayed; i--) { + if (wtoken.allAppWindows.get(i).mWinAnimator.isWindowAnimating()) { + delayed = true; + } + } + return delayed; } @@ -7262,6 +7263,7 @@ public class WindowManagerService extends IWindowManager.Stub pw.flush(); Slog.w(TAG, "This window was lost: " + ws); Slog.w(TAG, sw.toString()); + ws.mWinAnimator.destroySurfaceLocked(); } } Slog.w(TAG, "Current app token list:"); @@ -9331,7 +9333,7 @@ public class WindowManagerService extends IWindowManager.Stub pw.print(" mWaitingForConfig="); pw.println(mWaitingForConfig); pw.print(" mRotation="); pw.print(mRotation); pw.print(" mAltOrientation="); pw.println(mAltOrientation); - pw.print(" mLastWindowForcedOrientation"); pw.print(mLastWindowForcedOrientation); + pw.print(" mLastWindowForcedOrientation="); pw.print(mLastWindowForcedOrientation); pw.print(" mForcedAppOrientation="); pw.println(mForcedAppOrientation); pw.print(" mDeferredRotationPauseCount="); pw.println(mDeferredRotationPauseCount); if (mAnimator.mScreenRotationAnimation != null) { @@ -9533,4 +9535,9 @@ public class WindowManagerService extends IWindowManager.Stub void bulkSetParameters(final int bulkUpdateParams) { mH.sendMessage(mH.obtainMessage(H.BULK_UPDATE_PARAMETERS, bulkUpdateParams, 0)); } + + static String getCaller() { + StackTraceElement caller = Thread.currentThread().getStackTrace()[4]; + return caller.getClassName() + "." + caller.getMethodName() + ":" + caller.getLineNumber(); + } } -- cgit v1.2.3-59-g8ed1b