This commit is contained in:
Cameron Gutman
2021-01-31 19:29:57 -06:00
parent fedaa74c47
commit 963133598f

View File

@@ -107,6 +107,8 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
defaultContext.rightStickDeadzoneRadius = (float) stickDeadzone;
defaultContext.leftTriggerAxis = MotionEvent.AXIS_BRAKE;
defaultContext.rightTriggerAxis = MotionEvent.AXIS_GAS;
defaultContext.hatXAxis = MotionEvent.AXIS_HAT_X;
defaultContext.hatYAxis = MotionEvent.AXIS_HAT_Y;
defaultContext.controllerNumber = (short) 0;
defaultContext.assignedControllerNumber = true;
defaultContext.external = false;
@@ -194,6 +196,13 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
return true;
}
// HACK for https://issuetracker.google.com/issues/163120692
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
if (device.getId() == -1) {
return true;
}
}
// Otherwise, we'll try anything that claims to be a non-alphabetic keyboard
return device.getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC;
}
@@ -703,6 +712,13 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
return null;
}
// HACK for https://issuetracker.google.com/issues/163120692
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
if (event.getDeviceId() == -1) {
return defaultContext;
}
}
// Return the existing context if it exists
InputDeviceContext context = inputDeviceContexts.get(event.getDeviceId());
if (context != null) {