Loading core/java/android/widget/Magnifier.java +12 −6 Original line number Diff line number Diff line Loading @@ -136,6 +136,8 @@ public final class Magnifier { // Lock to synchronize between the UI thread and the thread that handles pixel copy results. // Only sync mWindow writes from UI thread with mWindow reads from sPixelCopyHandlerThread. private final Object mLock = new Object(); // The lock used to synchronize the UI and render threads when a #dismiss is performed. private final Object mDestroyLock = new Object(); /** * Initializes a magnifier. Loading Loading @@ -275,7 +277,7 @@ public final class Magnifier { mWindowElevation, mWindowCornerRadius, mOverlay != null ? mOverlay : new ColorDrawable(Color.TRANSPARENT), Handler.getMain() /* draw the magnifier on the UI thread */, mLock, mCallback); mDestroyLock, mCallback); } } performPixelCopy(startX, startY, true /* update window position */); Loading Loading @@ -304,10 +306,12 @@ public final class Magnifier { */ public void dismiss() { if (mWindow != null) { synchronized (mDestroyLock) { synchronized (mLock) { mWindow.destroy(); mWindow = null; } } mPrevShowSourceCoords.x = NONEXISTENT_PREVIOUS_CONFIG_VALUE; mPrevShowSourceCoords.y = NONEXISTENT_PREVIOUS_CONFIG_VALUE; mPrevShowWindowCoords.x = NONEXISTENT_PREVIOUS_CONFIG_VALUE; Loading Loading @@ -835,7 +839,7 @@ public final class Magnifier { // 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(); private final Object mDestroyLock; // The current content of the magnifier. It is mBitmap + mOverlay, only used for testing. private Bitmap mCurrentContent; Loading @@ -843,10 +847,12 @@ public final class Magnifier { InternalPopupWindow(final Context context, final Display display, final SurfaceControl parentSurfaceControl, final int width, final int height, final float elevation, final float cornerRadius, final Drawable overlay, final Handler handler, final Object lock, final Callback callback) { final Handler handler, final Object lock, final Object destroyLock, final Callback callback) { mDisplay = display; mOverlay = overlay; mLock = lock; mDestroyLock = destroyLock; mCallback = callback; mContentWidth = width; Loading Loading
core/java/android/widget/Magnifier.java +12 −6 Original line number Diff line number Diff line Loading @@ -136,6 +136,8 @@ public final class Magnifier { // Lock to synchronize between the UI thread and the thread that handles pixel copy results. // Only sync mWindow writes from UI thread with mWindow reads from sPixelCopyHandlerThread. private final Object mLock = new Object(); // The lock used to synchronize the UI and render threads when a #dismiss is performed. private final Object mDestroyLock = new Object(); /** * Initializes a magnifier. Loading Loading @@ -275,7 +277,7 @@ public final class Magnifier { mWindowElevation, mWindowCornerRadius, mOverlay != null ? mOverlay : new ColorDrawable(Color.TRANSPARENT), Handler.getMain() /* draw the magnifier on the UI thread */, mLock, mCallback); mDestroyLock, mCallback); } } performPixelCopy(startX, startY, true /* update window position */); Loading Loading @@ -304,10 +306,12 @@ public final class Magnifier { */ public void dismiss() { if (mWindow != null) { synchronized (mDestroyLock) { synchronized (mLock) { mWindow.destroy(); mWindow = null; } } mPrevShowSourceCoords.x = NONEXISTENT_PREVIOUS_CONFIG_VALUE; mPrevShowSourceCoords.y = NONEXISTENT_PREVIOUS_CONFIG_VALUE; mPrevShowWindowCoords.x = NONEXISTENT_PREVIOUS_CONFIG_VALUE; Loading Loading @@ -835,7 +839,7 @@ public final class Magnifier { // 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(); private final Object mDestroyLock; // The current content of the magnifier. It is mBitmap + mOverlay, only used for testing. private Bitmap mCurrentContent; Loading @@ -843,10 +847,12 @@ public final class Magnifier { InternalPopupWindow(final Context context, final Display display, final SurfaceControl parentSurfaceControl, final int width, final int height, final float elevation, final float cornerRadius, final Drawable overlay, final Handler handler, final Object lock, final Callback callback) { final Handler handler, final Object lock, final Object destroyLock, final Callback callback) { mDisplay = display; mOverlay = overlay; mLock = lock; mDestroyLock = destroyLock; mCallback = callback; mContentWidth = width; Loading