diff options
author | Tony Tam <149837+tonytamsf@users.noreply.github.com> | 2021-01-31 14:17:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-31 23:17:33 +0100 |
commit | 4ff6ff4fb73614de6498f9562bbbf392f69a6fae (patch) | |
tree | be71b0d7145f02d77f07bce96c604c531c3503ea /core | |
parent | c31ab7943421fd9074115fefe6cf0afc9b17feef (diff) | |
download | AntennaPod-4ff6ff4fb73614de6498f9562bbbf392f69a6fae.zip |
Fix Android Auto next episode (#4895)
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index 98280f54d..3536fd26e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -1,6 +1,8 @@ package de.danoeh.antennapod.core.service.playback; +import android.app.UiModeManager; import android.content.Context; +import android.content.res.Configuration; import android.media.AudioManager; import android.os.PowerManager; import androidx.annotation.NonNull; @@ -275,7 +277,10 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { } else { throw new IOException("Unable to read local file " + media.getLocalMediaUrl()); } - setPlayerStatus(PlayerStatus.INITIALIZED, media); + UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE); + if (uiModeManager.getCurrentModeType() != Configuration.UI_MODE_TYPE_CAR) { + setPlayerStatus(PlayerStatus.INITIALIZED, media); + } if (prepareImmediately) { setPlayerStatus(PlayerStatus.PREPARING, media); @@ -933,9 +938,6 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { boolean isPlaying = playerStatus == PlayerStatus.PLAYING; - if (playerStatus != PlayerStatus.INDETERMINATE) { - setPlayerStatus(PlayerStatus.INDETERMINATE, media); - } // we're relying on the position stored in the Playable object for post-playback processing if (media != null) { int position = getPosition(); |