mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-02-16 10:31:07 +00:00
Add hack to work around https://issuetracker.google.com/issues/163120692
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user