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
This commit is contained in:
Emilie Roberts
2022-03-31 16:00:46 +02:00
parent 8c13b43b85
commit e27372d101

View File

@@ -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.");