Loading core/java/android/widget/Magnifier.java +22 −12 Original line number Diff line number Diff line Loading @@ -393,6 +393,12 @@ public final class Magnifier { private int mWindowPositionY; private boolean mPendingWindowPositionUpdate; // The lock used to synchronize the UI and render threads when a #destroy // is performed on the UI thread and a frame callback on the render thread. // When both mLock and mDestroyLock need to be held at the same time, // mDestroyLock should be acquired before mLock in order to avoid deadlocks. private final Object mDestroyLock = new Object(); InternalPopupWindow(final Context context, final Display display, final Surface parentSurface, final int width, final int height, final float elevation, final float cornerRadius, Loading Loading @@ -517,9 +523,11 @@ public final class Magnifier { * Destroys this instance. */ public void destroy() { synchronized (mDestroyLock) { mSurface.destroy(); } synchronized (mLock) { mRenderer.destroy(); mSurface.destroy(); mSurfaceControl.destroy(); mSurfaceSession.kill(); mBitmapRenderNode.destroy(); Loading Loading @@ -567,10 +575,11 @@ public final class Magnifier { final int pendingY = mWindowPositionY; callback = frame -> { synchronized (mLock) { synchronized (mDestroyLock) { if (!mSurface.isValid()) { return; } synchronized (mLock) { mRenderer.setLightCenter(mDisplay, pendingX, pendingY); // Show or move the window at the content draw frame. SurfaceControl.openTransaction(); Loading @@ -583,6 +592,7 @@ public final class Magnifier { } SurfaceControl.closeTransaction(); } } }; } else { callback = null; Loading Loading
core/java/android/widget/Magnifier.java +22 −12 Original line number Diff line number Diff line Loading @@ -393,6 +393,12 @@ public final class Magnifier { private int mWindowPositionY; private boolean mPendingWindowPositionUpdate; // The lock used to synchronize the UI and render threads when a #destroy // is performed on the UI thread and a frame callback on the render thread. // When both mLock and mDestroyLock need to be held at the same time, // mDestroyLock should be acquired before mLock in order to avoid deadlocks. private final Object mDestroyLock = new Object(); InternalPopupWindow(final Context context, final Display display, final Surface parentSurface, final int width, final int height, final float elevation, final float cornerRadius, Loading Loading @@ -517,9 +523,11 @@ public final class Magnifier { * Destroys this instance. */ public void destroy() { synchronized (mDestroyLock) { mSurface.destroy(); } synchronized (mLock) { mRenderer.destroy(); mSurface.destroy(); mSurfaceControl.destroy(); mSurfaceSession.kill(); mBitmapRenderNode.destroy(); Loading Loading @@ -567,10 +575,11 @@ public final class Magnifier { final int pendingY = mWindowPositionY; callback = frame -> { synchronized (mLock) { synchronized (mDestroyLock) { if (!mSurface.isValid()) { return; } synchronized (mLock) { mRenderer.setLightCenter(mDisplay, pendingX, pendingY); // Show or move the window at the content draw frame. SurfaceControl.openTransaction(); Loading @@ -583,6 +592,7 @@ public final class Magnifier { } SurfaceControl.closeTransaction(); } } }; } else { callback = null; Loading