Twelve: Open audio session once
Pixel 9 had a bugged audio session handling, it has now been fixed.
Change-Id: I853422549328388d76b8cce96c931b8b17ce1804
diff --git a/app/src/main/java/org/lineageos/twelve/services/PlaybackService.kt b/app/src/main/java/org/lineageos/twelve/services/PlaybackService.kt
index 7420316..1544e08 100644
--- a/app/src/main/java/org/lineageos/twelve/services/PlaybackService.kt
+++ b/app/src/main/java/org/lineageos/twelve/services/PlaybackService.kt
@@ -219,6 +219,7 @@
)
exoPlayer.audioSessionId = (application as TwelveApplication).audioSessionId
+ openAudioEffectSession()
}
override fun onBind(intent: Intent?): IBinder? {
@@ -253,20 +254,6 @@
override fun onGetSession(controllerInfo: MediaSession.ControllerInfo) = mediaLibrarySession
override fun onEvents(player: Player, events: Player.Events) {
- if (events.containsAny(
- Player.EVENT_PLAYBACK_STATE_CHANGED,
- Player.EVENT_PLAY_WHEN_READY_CHANGED,
- Player.EVENT_IS_PLAYING_CHANGED,
- Player.EVENT_POSITION_DISCONTINUITY
- )
- ) {
- if (player.playbackState != Player.STATE_ENDED && player.playWhenReady) {
- openAudioEffectSession()
- } else {
- closeAudioEffectSession()
- }
- }
-
// Update startIndex and startPositionMs in resumption playlist.
if (events.containsAny(Player.EVENT_MEDIA_ITEM_TRANSITION)) {
lifecycle.coroutineScope.launch {