From 026a6c45e77d3dec8f7ae26b74fe6fba18021caf Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 1 Mar 2017 13:13:45 -0800 Subject: [PATCH] Correct dissapearing SurfaceView during exit animations. We were missing a call to detachChildren in the case that the visibility change originates from AM (rather than relayout). Thus we were racing relayout with the client to detach fast enough. Detach before notifying the client of window visibility changes. Test: Slow down animation speed. Open close SV app (say Chrome). No flashes. Change-Id: Ibf027c2ca295f25765ba95b36c1346a715f3bc6e --- services/core/java/com/android/server/wm/WindowState.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 945a349a28fd..207a627895c4 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1528,6 +1528,13 @@ class WindowState extends WindowContainer implements WindowManagerP return changed; } + // Next up we will notify the client that it's visibility has changed. + // We need to prevent it from destroying child surfaces until + // the animation has finished. + if (!visible && isVisibleNow()) { + mWinAnimator.detachChildren(); + } + if (visible != isVisibleNow()) { if (!runningAppAnimation) { final AccessibilityController accessibilityController = -- 2.11.0