From ba993781bc2f0c086eb64e8ff98e6530e70b57be Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 15 May 2018 15:16:40 -0700 Subject: Reparent children when hiding preserved surface. A recent change hides preserved surfaces immediately when showing the new surface. We need to make sure to reparent the children at this point like we do when we destroy. Bug: 79748420 Test: go/wm-smoke. Manual. Change-Id: Ia5b68d595c4cdc1395ffcc69de7128c04f9e248d --- services/core/java/com/android/server/wm/WindowStateAnimator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 4a6587bcc8af..6ca044370561 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1291,6 +1291,7 @@ class WindowStateAnimator { // if we are transparent. if (mPendingDestroySurface != null && mDestroyPreservedSurfaceUponRedraw) { mPendingDestroySurface.mSurfaceControl.hide(); + mPendingDestroySurface.reparentChildrenInTransaction(mSurfaceController); } return true; -- cgit v1.2.3-59-g8ed1b From a8531a054aca594b3e0a0a3263d82601573c3332 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 15 May 2018 15:18:03 -0700 Subject: Remove preserve surface block when detaching children. This code path was added with the idea of avoiding the bug where children have been detached but then the client receives the same surface back. However it seems this idea doesn't really work, there's no hint to the client side to ensure that the SurfaceView is recreated, in particular SurfaceView.java does not check the generation ID of the Surface changing. This means this fix wasn't really working, as the children would just keep trying to use the old detached SurfaceView. The fix is also adding complexity by introducing extra surfaces when quitting apps. Bug: 79748420 Test: go/wm-smoke. Manual Change-Id: I281c748aa4ccc8de04abebbd4f030ceb3f301ba1 --- services/core/java/com/android/server/wm/WindowState.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 91c449ba3832..40c93f7993fc 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4404,14 +4404,6 @@ class WindowState extends WindowContainer implements WindowManagerP result |= (!wasVisible || !isDrawnLw()) ? RELAYOUT_RES_FIRST_TIME : 0; - if (mWinAnimator.mChildrenDetached) { - // If there are detached children hanging around we need to force - // the client receiving a new Surface. - mWinAnimator.preserveSurfaceLocked(); - result |= RELAYOUT_RES_SURFACE_CHANGED - | RELAYOUT_RES_FIRST_TIME; - } - if (mAnimatingExit) { Slog.d(TAG, "relayoutVisibleWindow: " + this + " mAnimatingExit=true, mRemoveOnExit=" + mRemoveOnExit + ", mDestroying=" + mDestroying); -- cgit v1.2.3-59-g8ed1b