Skip to content

Commit f20588f

Browse files
author
Craig Mautner
committed
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
1 parent f0cabba commit f20588f

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3974,7 +3974,6 @@ boolean setTokenVisibilityLocked(AppWindowToken wtoken, WindowManager.LayoutPara
39743974

39753975
wtoken.willBeHidden = false;
39763976
if (wtoken.hidden == visible) {
3977-
final int N = wtoken.allAppWindows.size();
39783977
boolean changed = false;
39793978
if (DEBUG_APP_TRANSITIONS) Slog.v(
39803979
TAG, "Changing app " + wtoken + " hidden=" + wtoken.hidden
@@ -3986,23 +3985,19 @@ boolean setTokenVisibilityLocked(AppWindowToken wtoken, WindowManager.LayoutPara
39863985
if (wtoken.mAppAnimator.animation == sDummyAnimation) {
39873986
wtoken.mAppAnimator.animation = null;
39883987
}
3989-
applyAnimationLocked(wtoken, lp, transit, visible);
3990-
changed = true;
3991-
if (wtoken.mAppAnimator.animation != null) {
3988+
if (applyAnimationLocked(wtoken, lp, transit, visible)) {
39923989
delayed = runningAppAnimation = true;
39933990
}
3991+
changed = true;
39943992
}
39953993

3994+
final int N = wtoken.allAppWindows.size();
39963995
for (int i=0; i<N; i++) {
39973996
WindowState win = wtoken.allAppWindows.get(i);
39983997
if (win == wtoken.startingWindow) {
39993998
continue;
40003999
}
40014000

4002-
if (win.mWinAnimator.isAnimating()) {
4003-
delayed = true;
4004-
}
4005-
40064001
//Slog.i(TAG, "Window " + win + ": vis=" + win.isVisible());
40074002
//win.dump(" ");
40084003
if (visible) {
@@ -4055,6 +4050,12 @@ boolean setTokenVisibilityLocked(AppWindowToken wtoken, WindowManager.LayoutPara
40554050
delayed = true;
40564051
}
40574052

4053+
for (int i = wtoken.allAppWindows.size() - 1; i >= 0 && !delayed; i--) {
4054+
if (wtoken.allAppWindows.get(i).mWinAnimator.isWindowAnimating()) {
4055+
delayed = true;
4056+
}
4057+
}
4058+
40584059
return delayed;
40594060
}
40604061

@@ -7262,6 +7263,7 @@ final void rebuildAppWindowListLocked() {
72627263
pw.flush();
72637264
Slog.w(TAG, "This window was lost: " + ws);
72647265
Slog.w(TAG, sw.toString());
7266+
ws.mWinAnimator.destroySurfaceLocked();
72657267
}
72667268
}
72677269
Slog.w(TAG, "Current app token list:");
@@ -9331,7 +9333,7 @@ void dumpWindowsLocked(FileDescriptor fd, PrintWriter pw, boolean dumpAll,
93319333
pw.print(" mWaitingForConfig="); pw.println(mWaitingForConfig);
93329334
pw.print(" mRotation="); pw.print(mRotation);
93339335
pw.print(" mAltOrientation="); pw.println(mAltOrientation);
9334-
pw.print(" mLastWindowForcedOrientation"); pw.print(mLastWindowForcedOrientation);
9336+
pw.print(" mLastWindowForcedOrientation="); pw.print(mLastWindowForcedOrientation);
93359337
pw.print(" mForcedAppOrientation="); pw.println(mForcedAppOrientation);
93369338
pw.print(" mDeferredRotationPauseCount="); pw.println(mDeferredRotationPauseCount);
93379339
if (mAnimator.mScreenRotationAnimation != null) {
@@ -9533,4 +9535,9 @@ void debugLayoutRepeats(final String msg, int pendingLayoutChanges) {
95339535
void bulkSetParameters(final int bulkUpdateParams) {
95349536
mH.sendMessage(mH.obtainMessage(H.BULK_UPDATE_PARAMETERS, bulkUpdateParams, 0));
95359537
}
9538+
9539+
static String getCaller() {
9540+
StackTraceElement caller = Thread.currentThread().getStackTrace()[4];
9541+
return caller.getClassName() + "." + caller.getMethodName() + ":" + caller.getLineNumber();
9542+
}
95369543
}

0 commit comments

Comments
 (0)