From 3cc58ddd3c39580d0c008d1cf7138d5634be1b90 Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Wed, 20 Apr 2016 17:45:24 -0700 Subject: [PATCH] Fix dead surface/window left on screen If the surface is explicitly hidden while we're changing resizing mode, we need to discard the preserved surface immediately, otherwise it could linger around on screen. Do not mark mAnimatingExit in setTokenVisibilityLocked. This flag can only be set after client relayouts to invisible. There we set mAnimatingExit and mAnimating, so that when animation finishes the surface is marked to be destroyed. If we marke it too early (and not mark mAnimating at the same time), the surface may get stuck in exiting state. bug: 28236574 Change-Id: I5cc916dfa698113e1d783a66547e1878469a9879 --- .../core/java/com/android/server/wm/WindowManagerService.java | 1 - .../java/com/android/server/wm/WindowSurfaceController.java | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 38f12a13e3794..7e5a91def8293 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -4248,7 +4248,6 @@ public class WindowManagerService extends IWindowManager.Stub WindowManagerPolicy.TRANSIT_EXIT); } } - win.mAnimatingExit = true; changed = true; win.setDisplayLayoutNeeded(); } diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java index 6eed5e7464585..af47369b181ec 100644 --- a/services/core/java/com/android/server/wm/WindowSurfaceController.java +++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java @@ -100,6 +100,8 @@ class WindowSurfaceController { void hideInTransaction(String reason) { if (SHOW_TRANSACTIONS) logSurface("HIDE ( " + reason + " )", null); mHiddenForOtherReasons = true; + + mAnimator.destroyPreservedSurfaceLocked(); updateVisibility(); } @@ -180,6 +182,7 @@ class WindowSurfaceController { updateVisibility(); } else { mHiddenForCrop = true; + mAnimator.destroyPreservedSurfaceLocked(); updateVisibility(); } } catch (RuntimeException e) {