Skip to content

Commit fd6c90a

Browse files
authored
fix: prevent crash when PSLab board is connected to phone before first app start (#2575)
1 parent 49680a2 commit fd6c90a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/java/io/pslab/activity/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ public void run() {
477477
private void attemptToGetUSBPermission() {
478478
if (!("android.hardware.usb.action.USB_DEVICE_ATTACHED".equals(getIntent().getAction()))) {
479479
if (communicationHandler.isDeviceFound() && !usbManager.hasPermission(communicationHandler.mUsbDevice)) {
480-
mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
480+
mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
481481
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
482482
registerReceiver(mUsbReceiver, filter);
483483
receiverRegister = true;

0 commit comments

Comments
 (0)