From f6f7c377e235e629da690f48dd713ef87d7ed341 Mon Sep 17 00:00:00 2001 From: Haggai Eran Date: Sat, 14 Dec 2024 17:31:51 +0200 Subject: [PATCH] PlayerService: return appropriate IBinder depending on the action --- .../main/java/org/schabi/newpipe/player/PlayerService.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt b/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt index 4ccda0c17..10c750f7b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt +++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.kt @@ -177,7 +177,13 @@ class PlayerService : MediaBrowserServiceCompat() { 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) override fun onGetRoot(