Fix Android Auto next episode (#4895)

This commit is contained in:
Tony Tam 2021-01-31 14:17:33 -08:00 committed by GitHub
parent c31ab79434
commit 4ff6ff4fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -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());
}
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();