-
Notifications
You must be signed in to change notification settings - Fork 302
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
ANR Context.startForegroundService() did not then call Service.startForeground() #299
Comments
@marcbaechinger Do we have some existing GH issue comment thread that explains potential reasons for this and what could go wrong? It interesting to see that more or less of these issues happened on Samsung and Android 13. |
After some additional testing. this is 100% reproducable on UAMP when targeting SDK 33 and 1.0.0 media3 |
It is explainable why it happens on Samsung mostly. it's because some users remap the bixby button to play pause. So this 'edgecase' is way more likely to happen on those devices. |
We have #167 that is about On a Pixel device the above repro steps can not happen if they are correct:
The report says it is reproducible with the demo app. The demo app does not have a So if this is only happening on Samsung devices and it happens with Samsung devices only, then Samsung is doing something differently to vanilla Android. This can be that the system tries to restart the service without a @tobyworks Is the comment above reproducible with the demo app intended to be |
How does the bixby button start the service and how is an app supposed to prepare the player with which media in this case? How does the bixby button know whether an app supports starting this way? Does Samsung document this somewhere? |
@marcbaechinger I advise you to check UAMP targetting sdk 33 and media3 1.0.0.
If you want i can zip my project of UAMP and send it. Edit: updated my original post with a video of it happening on my Pixel 6 |
I can not repro with UAMP either I'm afraid. For the same reasons I think. There is no Without this receiver, a However, the root problem is that something is starting the service and the service does not start playback. When an app wants to support being started by whatever means while it is not running (never started or killed) and no app is binding to the service, then the app must immediately start playback so that the service is put into the foreground. Note that in the case that the service is started by an intent (like for instance by the The session demo service does not have a From this I don't think this is a bug of the library. I apologize that neither the session demo nor UAMP currently support this feature, so it is not well documented. Can you let me know how you think the play command from BT is routed to UAMP without the receiver? Can you after you have |
Have you tried it in UAMP project that i sent you? it is 100% reproducable in that configuration. Nothing has been changed. besides the bump in target sdk and media 3 Here;s the log:
|
On the |
I haven't. I just saw there is actually a second manifest in UAMP that has a receiver. Thanks for the logs:
Let me flash my device. I'm currently on UDC and need to flash to Android 13. You still need to implement this in your app. If we can show it's not working with UAMP, what would it tell us? That the app needs to implement starting playback. Your app would need to do the same. |
Just now tested by commenting the receiver in
But we can't right now because implicitly the service get's started by
Btw @eXaLy is my collegue who will take over this issue from me. |
I will look into this and make sure that we put this into the session demo and UAMP.
I think you are correct that for API 21 and lower, the If the app is not running and the session is correctly destroyed, then this doc https://developer.android.com/guide/topics/media-apps/mediabuttons says you are not entirely correct. "If you are running Android 8.0 (API level 26) or later, the system tries to find the last app with a MediaSession that played audio locally. If the session is still active Android sends the event directly to it. Otherwise, if the session is not active and it has a mediabutton receiver, Android sends the event to the receiver, which will restart the session and so it can receive the event." |
Do you have an idea how you will or your colleagues will fix this in UAMP so we can do it aswell asap. Right now our users are not happy with the update we did and are giving 1 star reviews because of it. |
I have added some sample code in #167 I think it's best to keep the discussion around |
Media3 Version
Media3 1.0.0 , target and compile sdk 33
Devices that reproduce the issue
Galaxy S20 FE 5G - Android 13
Pixel 6 - Android 13
Pixel 7 - Android 13
Devices that do not reproduce the issue
Unknown
Reproducible in the demo app?
Yes. in UAMP when targetting compile sdk 33 and media3 1.0.0
Reproduction steps
adb shell input keyevent 126
What i notice is that the service gets recreated when i press the bluetooth controls. How do i circumvent this?
Screen.Recording.2023-04-06.at.18.22.27.mp4
download project: https://transfer.sh/vEey0M/uamp.zip
Expected result
ANR Shouldn't happen
Actual result
ANR happens
Media
any media
Bug Report
adb bugreport
to dev.exoplayer@gmail.com after filing this issue.The text was updated successfully, but these errors were encountered: