Avoid touchscreens when looking for pointer capture capable devices

This commit is contained in:
Cameron Gutman 2022-02-18 17:07:23 -06:00
parent eb9e6443e2
commit 8a63b61495

View File

@ -39,6 +39,15 @@ public class AndroidNativePointerCaptureProvider extends AndroidPointerIconCaptu
continue;
}
// Skip touchscreens when considering compatible capture devices.
// Samsung devices on Android 12 will report a sec_touchpad device
// with SOURCE_TOUCHSCREEN, SOURCE_KEYBOARD, and SOURCE_MOUSE.
// Upon enabling pointer capture, that device will switch to
// SOURCE_KEYBOARD and SOURCE_TOUCHPAD.
if (device.supportsSource(InputDevice.SOURCE_TOUCHSCREEN)) {
continue;
}
if (device.supportsSource(InputDevice.SOURCE_MOUSE) ||
device.supportsSource(InputDevice.SOURCE_MOUSE_RELATIVE) ||
device.supportsSource(InputDevice.SOURCE_TOUCHPAD)) {