-
Notifications
You must be signed in to change notification settings - Fork 482
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
Session service prevents process from terminating if swiped away from recents while the audio is playing #1269
Comments
Thanks! I believe this is a duplicate of #805 You can verify if this is the same issue by checking whether |
The music playback ends correctly, or did I misunderstand? I'll check if onTaskRemoved gets called in several hours, although I believe it does get called |
If you try and you see it is called. Can you try to instead of calling In the demo app with a single session that would be: override fun onTaskRemoved(rootIntent: Intent?) {
mediaLibrarySession.release()
stopSelf()
} The reason is if that would help, then you have a controller that is still bound to the service when |
|
Hi @marcbaechinger @nikushaa991 Any Update on issue!!! |
@marcbaechinger @nikushaa991 I can confirm that this issue relevant for |
Thanks. I don't think the library can do much if this is a duplicate of #805. The library version shouldn't make a difference. I don't really know what you mean by 'this issue'. We may understand different things. If you are saying that #805 is an OS bug that's not yet fixed on a device. You'd need to have this fixed in the OS. So you would need to at least tell us the device and OS that your using. I'm not able to evaluate this for every device due to not having every device, but the build number and the device would be information that is required to look into that. In any case, I think you would need to provide us with a bit more information to make this actuionable. |
All lifecycle methods, including |
Ok, I understand you see this on any version of the OS. Thanks for clarifying. |
The profiler does not record memory leaks and the application functions correctly after reopening, so I believe this is not a critical problem. However, the fact that the process continues to work after closing the application is still at least an unnecessary consumption of RAM and in general the situation is alarming. |
I can second your observation. When I test this with the session demo app on a recent Android I see that behaviour. As you say, when not playing, then it works as expected. The app itself calls Case 2) Swiping the app away when playing
When I then check
I see that the service is still around as expected. I also see the there is no client bound anymore as expected. And I see that the time is ticking for the system to kill the service:
(there is I also see that there are two processes for the demo app (I run the service in a different process in this example):
After a while the system indeed kills the service and the record for the service goeas away. Also the process for the service goes away, but a process sticks like you observed:
No need to convince me this is an issue. :) It's definitely worth investigating why this is the case. I'd say from what I observed that the library does behave correct as far as I can tell. That that process sticks there seems wrong to mee too. |
I tested primarily the behavior when the service is expected to stop when the application is swiped(https://developer.android.com/media/media3/session/background-playback#service-lifecycle).
I see that service destroyed. But the process remains alive. |
Yup, thanks. I checked with system health. This is expected behavior. As long as there is no memory pressure the process is kept. My expectation that terminating the last app component would immediately kill the process was not correct. When I launch the activity again, the process is reused and this is expected behavior. |
I've double checked all the logs and can confirm that the process is in the |
Version
Media3 main branch
More version details
a154c98
Devices that reproduce the issue
Galaxy S22 ultra running android 14
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Expected result
The static integer value gets reset and prints the same value on both launches
Actual result
The static integer retains it's incremented value and prints different values
Media
Not applicable
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.The text was updated successfully, but these errors were encountered: