mirror of https://github.com/encounter/SDL.git
Fixed exception trying to get USB permission
You can't set the intent to be immutable, otherwise the USB system can't set the device and permission in the response. This works fine on Android 12 without an immutable intent.
This commit is contained in:
parent
acb602d607
commit
ed05a0e9e7
|
@ -554,13 +554,7 @@ public class HIDDeviceManager {
|
||||||
if (usbDevice != null && !mUsbManager.hasPermission(usbDevice)) {
|
if (usbDevice != null && !mUsbManager.hasPermission(usbDevice)) {
|
||||||
HIDDeviceOpenPending(deviceID);
|
HIDDeviceOpenPending(deviceID);
|
||||||
try {
|
try {
|
||||||
int flags;
|
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
|
||||||
flags = PendingIntent.FLAG_IMMUTABLE;
|
|
||||||
} else {
|
|
||||||
flags = 0;
|
|
||||||
}
|
|
||||||
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
||||||
HIDDeviceOpenResult(deviceID, false);
|
HIDDeviceOpenResult(deviceID, false);
|
||||||
|
|
Loading…
Reference in New Issue