-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix android 14 crash #5
Conversation
use RECEIVER_EXPORTED to make MIDI I/O work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the intent explicit, that would have been my first suggestion. I wonder if we can get away with using RECEIVER_NOT_EXPORTED
? That would be more secure
IntentFilter filter = new IntentFilter(UsbMidiGrantedReceiver.USB_PERMISSION_GRANTED_ACTION); | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
context.registerReceiver(receiver, filter, RECEIVER_EXPORTED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary to export the receiver to be available to other apps?
Is this a requirement because we're awaiting a system notification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we tried this with RECEIVER_NOT_EXPORTED
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when using the unsafe flag RECEIVER_NOT_EXPORTED
did not work (since no MIDI messages were received or send). BUT now with the explicit intent RECEIVER_NOT_EXPORTED
it seems to work. will push the change 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes implicit intents have to be exported but explicit intents do not.
it's possible midi messages were arriving but the driver assumes the permissions were rejected if it cannot access the information in the intent (which contain the message whether permissions were accepted or not)
Using
PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
fixes following crash:However we also need to use the
RECEIVER_EXPORTED
flag in order to fix a follow-up issue: