From e27372d101c6f778024404a2217960fd4dbff475 Mon Sep 17 00:00:00 2001 From: Emilie Roberts Date: Thu, 31 Mar 2022 16:00:46 +0200 Subject: [PATCH] Allow rapid request/release of pointer capture This removes a check for if pointer capture is already enabled when a call to request/release it is made. This attempt to de-duplicate the call can prevent a 2nd call from reaching the underlying implementation if it is made too quickly. In b/217714520, Minecraft: EDU was calling View.requestPointerCapture() followed by View.releasePointerCapture() in quick succession, causing the mouse cursor to disappear due to this check. Test: manually test Minecraft: EDU. Enter a world, then return to the main menu Test: atest PointerCaptureTest Bug: 217714520 Change-Id: I78c6c6f90409ca5e46e2680cc5fbb3c5ee17dc17 --- core/java/android/view/ViewRootImpl.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 931ae2748785c..0d148148eb1a4 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -5032,9 +5032,6 @@ public final class ViewRootImpl implements ViewParent, } void requestPointerCapture(boolean enabled) { - if (mPointerCapture == enabled) { - return; - } final IBinder inputToken = getInputToken(); if (inputToken == null) { Log.e(mTag, "No input channel to request Pointer Capture.");