From bd1c1e1fd09d7f7cf0423d56576f9a8c9beb6780 Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Fri, 8 Sep 2023 21:50:48 +1000 Subject: [PATCH 1/2] Use compact actions only before Android 13. --- .../java/com/ryanheise/audioservice/AudioService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java index ddb778ea..98775283 100644 --- a/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java +++ b/audio_service/android/src/main/java/com/ryanheise/audioservice/AudioService.java @@ -650,8 +650,10 @@ private Notification buildNotification() { builder.addAction(action); } final MediaStyle style = new MediaStyle() - .setMediaSession(mediaSession.getSessionToken()) - .setShowActionsInCompactView(compactActionIndices); + .setMediaSession(mediaSession.getSessionToken()); + if (Build.VERSION.SDK_INT < 33) { + style.setShowActionsInCompactView(compactActionIndices); + } if (config.androidNotificationOngoing) { style.setShowCancelButton(true); style.setCancelButtonIntent(buildMediaButtonPendingIntent(PlaybackStateCompat.ACTION_STOP)); @@ -772,7 +774,7 @@ private void releaseMediaSession() { * Gets called from background thread. */ synchronized void setQueue(List queue) { - this.queue = queue; + AudioService.queue = queue; mediaSession.setQueue(queue); } From aa74e070cb6bac0203970b202a2e45340bd5be1f Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Tue, 12 Sep 2023 15:16:41 +1000 Subject: [PATCH 2/2] 0.18.12 CHANGELOG --- audio_service/CHANGELOG.md | 4 ++++ audio_service/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/audio_service/CHANGELOG.md b/audio_service/CHANGELOG.md index fde60899..fa03546b 100644 --- a/audio_service/CHANGELOG.md +++ b/audio_service/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.18.12 + +* Fix crash with Oppo/OnePlus devices running Android 13. + ## 0.18.11 * Support custom media controls (@defsub) diff --git a/audio_service/pubspec.yaml b/audio_service/pubspec.yaml index dd0d03b4..a39bb466 100644 --- a/audio_service/pubspec.yaml +++ b/audio_service/pubspec.yaml @@ -1,6 +1,6 @@ name: audio_service description: Flutter plugin to play audio in the background while the screen is off. -version: 0.18.11 +version: 0.18.12 repository: https://github.com/ryanheise/audio_service/tree/minor/audio_service issue_tracker: https://github.com/ryanheise/audio_service/issues topics: