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
This commit is contained in:
chaviw
2022-05-31 13:48:56 -05:00
parent 91d28d1b21
commit 9e3cd0533f

View File

@@ -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();