diff options
| author | 2022-05-31 13:48:56 -0500 | |
|---|---|---|
| committer | 2022-05-31 13:48:56 -0500 | |
| commit | 9e3cd0533fa4dbca75d65750f9ffcd9817779c3c (patch) | |
| tree | c17d5047329683768898ee89da4423b3067b70f2 | |
| parent | 91d28d1b21ad2466470f887877a89e1b1046366d (diff) | |
Remove lock when calling Surface.destroy
Surface already has a lock on the native object so it's safe to call
destroy without holding additional locks. This also fixes ANR issues
where an app is still attempting to render when the window is destroyed.
Test: App from bug doesn't ANR
Bug: 234006724
Change-Id: I0d323c03f299e5857d1950870498f3182d019924
| -rw-r--r-- | core/java/android/view/SurfaceView.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 2e48c2b77233..7e264cea46bb 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -719,13 +719,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall private void releaseSurfaces(boolean releaseSurfacePackage) { mSurfaceAlpha = 1f; - - mSurfaceLock.lock(); - try { - mSurface.destroy(); - } finally { - mSurfaceLock.unlock(); - } + mSurface.destroy(); + synchronized (mSurfaceControlLock) { if (mBlastBufferQueue != null) { mBlastBufferQueue.destroy(); |