uamp icon indicating copy to clipboard operation
uamp copied to clipboard

MediaBrowser.disconnect missing?

Open HectorRicardo opened this issue 2 years ago • 1 comments

Hello,

I noticed that there's no call to MediaBrowserCompat.disconnect anywhere in the repo.

Was this intentional? To never unbind the service? Or did you just forget?

HectorRicardo avatar May 01 '22 03:05 HectorRicardo

I believe this is a bug and causes the MusicService to permanently leak until the app is killed. I was trying to see how the team handled certain tricky situations, but because the MusicService is never destroyed they never encountered them.

Per the docs, the client should "connect" during onStart() and "disconnect during onStop(). Without calling disconnect the app is leaking memory and resources well after the user has finished using the app.

https://developer.android.com/guide/topics/media-apps/audio-app/building-a-mediabrowser-client

joerogers avatar Sep 08 '22 18:09 joerogers