-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Remove static MediaButtonReceiver in AndroidManifest for v3.2 #1888
Conversation
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.
@mmmoussa Great to hear! My guess, without having been able to test it yet, is that the last commit hopefully alleviates some of the notAllowed errors. |
As you can see here if we removed the exported-attribute the default would be true as long as we an intent filter present, without the intent filter the default would be false. |
@mmmoussa @bradleyflood Thanks for testing! Perhaps @jspizziri or @dcvz could take a look? I really think this should go into the main-branch as well as this 3.2 branch, but it's a good place to start. :) |
This one is on our radar! We’ll likely cherry pick after merge and make one more release of 3.2 — we’re just waiting until one of us gets a chance to test it with a few devices. |
Alright merging this in @martinmidtsund and cherry picking to 4.0.0 nightlies. We'll keep an eye out for any unintended consequences. |
The first commit removes the static MediaButtonReceiver which is causing a lot of RemoteServiceExceptions, and a group of other related exceptions, most of them mentioned in this issue. This change made all of the related errors go away in our production environment, and has been running there for almost a month now. @elliotdickison has also reported the same.
See https://developer.android.com/guide/topics/media-apps/mediabuttons#summary where they say you need the static MediaButtonReceiver for pre-lollipop, but later versions don't need it.
As seen here a service can also receive media button actions:
A service can receive a key event by including an intent filter that handles ACTION_MEDIA_BUTTON
which is already registered in the manifest, and it seems to work just fine. We have verified with a connected bluetooth headset that skip, play and pause is still working when originating from the headset. It would be great if you could test the PR and verify it with other devices as well.The last commit exporting the MusicService and setting foregroundServiceType is not tested in production yet, but should be set as I gather from this page
Sorry for the wall of text. Please advise if anything should be changed.