cmd/ebitenmobile: Bug fix: Skip 'uinput-fpc' on the joystick detection on Android

Apparently 'uinput-fpc' is a fingerprint reader and is recognized as
a joystick unexpectedly. This was often a primary gamepad on Ebiten
and confused Ebiten applications.

This change fixes this issue by skipping 'uinput-fpc' at the joystick
detection.

Closes #1542
This commit is contained in:
Hajime Hoshi 2021-03-14 23:26:02 +09:00
parent 5c5a2cf0f8
commit 1a2b308ae3
2 changed files with 7 additions and 1 deletions

View File

@ -520,6 +520,12 @@ public class EbitenView extends ViewGroup implements InputManager.InputDeviceLis
if (inputDevice == null) { if (inputDevice == null) {
return; return;
} }
// A fingerprint reader is unexpectedly recognized as a joystick. Skip this (#1542).
if (inputDevice.getName().equals("uinput-fpc")) {
return;
}
int sources = inputDevice.getSources(); int sources = inputDevice.getSources();
if ((sources & InputDevice.SOURCE_GAMEPAD) != InputDevice.SOURCE_GAMEPAD && if ((sources & InputDevice.SOURCE_GAMEPAD) != InputDevice.SOURCE_GAMEPAD &&
(sources & InputDevice.SOURCE_JOYSTICK) != InputDevice.SOURCE_JOYSTICK) { (sources & InputDevice.SOURCE_JOYSTICK) != InputDevice.SOURCE_JOYSTICK) {

File diff suppressed because one or more lines are too long