diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 2f0a4ebb84f86..59e9ed1512ee9 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -712,6 +712,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall mSurfaceAlpha = 1f; synchronized (mSurfaceControlLock) { + mSurface.release(); + if (mRtHandlingPositionUpdates) { mRtReleaseSurfaces = true; return; @@ -725,7 +727,6 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall mTmpTransaction.remove(mBackgroundControl); mBackgroundControl = null; } - mSurface.release(); mTmpTransaction.apply(); } } @@ -1198,7 +1199,6 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall mRtTransaction.remove(mBackgroundControl); mSurfaceControl = null; mBackgroundControl = null; - mSurface.release(); } mRtHandlingPositionUpdates = false; }