mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-18 18:42:46 +00:00
Use the newly public InputDevice.isExternal() function on Android Q
This commit is contained in:
parent
6fb3a8e57d
commit
b7810d6eb6
@ -335,6 +335,11 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isExternal(InputDevice dev) {
|
private static boolean isExternal(InputDevice dev) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
// Landroid/view/InputDevice;->isExternal()Z is officially public on Android Q
|
||||||
|
return dev.isExternal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
try {
|
try {
|
||||||
// Landroid/view/InputDevice;->isExternal()Z is on the light graylist in Android P
|
// Landroid/view/InputDevice;->isExternal()Z is on the light graylist in Android P
|
||||||
return (Boolean)dev.getClass().getMethod("isExternal").invoke(dev);
|
return (Boolean)dev.getClass().getMethod("isExternal").invoke(dev);
|
||||||
@ -347,6 +352,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Answer true if we don't know
|
// Answer true if we don't know
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user