diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index f01b68f4393f2..131e5bd67872c 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5009,9 +5009,10 @@ class WindowState extends WindowContainer implements WindowManagerP // on the new one. This prevents blinking when we change elevation of freeform and // pinned windows. if (!mWinAnimator.tryChangeFormatInPlaceLocked()) { - mWinAnimator.preserveSurfaceLocked(); + mWinAnimator.preserveSurfaceLocked(getPendingTransaction()); result |= RELAYOUT_RES_SURFACE_CHANGED | RELAYOUT_RES_FIRST_TIME; + scheduleAnimation(); } } @@ -5027,9 +5028,10 @@ class WindowState extends WindowContainer implements WindowManagerP // to preserve and destroy windows which are attached to another, they // will keep their surface and its size may change over time. if (mHasSurface && !isChildWindow()) { - mWinAnimator.preserveSurfaceLocked(); + mWinAnimator.preserveSurfaceLocked(getPendingTransaction()); result |= RELAYOUT_RES_SURFACE_CHANGED | RELAYOUT_RES_FIRST_TIME; + scheduleAnimation(); } } final boolean freeformResizing = isDragResizing() diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 1f7324d4d7801..2ace23f24788a 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -349,7 +349,7 @@ class WindowStateAnimator { return result; } - void preserveSurfaceLocked() { + void preserveSurfaceLocked(SurfaceControl.Transaction t) { if (mDestroyPreservedSurfaceUponRedraw) { // This could happen when switching the surface mode very fast. For example, // we preserved a surface when dragResizing changed to true. Then before the @@ -376,7 +376,7 @@ class WindowStateAnimator { // Our SurfaceControl is always at layer 0 within the parent Surface managed by // window-state. We want this old Surface to stay on top of the new one // until we do the swap, so we place it at a positive layer. - mSurfaceController.mSurfaceControl.setLayer(PRESERVED_SURFACE_LAYER); + t.setLayer(mSurfaceController.getClientViewRootSurface(), PRESERVED_SURFACE_LAYER); } mDestroyPreservedSurfaceUponRedraw = true; mSurfaceDestroyDeferred = true;