|
@@ -584,7 +584,14 @@ public class HIDDeviceManager {
|
|
|
if (usbDevice != null && !mUsbManager.hasPermission(usbDevice)) {
|
|
|
HIDDeviceOpenPending(deviceID);
|
|
|
try {
|
|
|
- mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
|
|
|
+ int flags;
|
|
|
+ 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) {
|
|
|
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
|
|
|
HIDDeviceOpenResult(deviceID, false);
|