PlayerService: return appropriate IBinder depending on the action

This commit is contained in:
Haggai Eran 2024-12-14 17:31:51 +02:00
parent 9d750edf5f
commit f6f7c377e2
1 changed files with 7 additions and 1 deletions

View File

@ -177,7 +177,13 @@ class PlayerService : MediaBrowserServiceCompat() {
super.attachBaseContext(AudioServiceLeakFix.preventLeakOf(base)) super.attachBaseContext(AudioServiceLeakFix.preventLeakOf(base))
} }
override fun onBind(intent: Intent): IBinder = mBinder override fun onBind(intent: Intent): IBinder? {
if (SERVICE_INTERFACE == intent.action) {
// For actions related to the media browser service, pass the onBind to the superclass
return super.onBind(intent)
}
return mBinder
}
// MediaBrowserServiceCompat methods (they defer function calls to mediaBrowserConnector) // MediaBrowserServiceCompat methods (they defer function calls to mediaBrowserConnector)
override fun onGetRoot( override fun onGetRoot(