only allow for endPlayback with wasSkipped==false internally

This commit is contained in:
Domingos Lopes 2016-04-30 02:02:00 -04:00
parent e94219ce26
commit 12d62d5519
5 changed files with 13 additions and 8 deletions

View File

@ -755,7 +755,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
@Override
public void endPlayback(final boolean wasSkipped, boolean switchingPlayers) {
protected void endPlayback(final boolean wasSkipped) {
executor.submit(() -> {
playerLock.lock();
releaseWifiLockIfNecessary();
@ -870,7 +870,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
mp -> genericOnCompletion();
private void genericOnCompletion() {
endPlayback(false, false);
endPlayback(false);
}
private final MediaPlayer.OnBufferingUpdateListener audioBufferingUpdateListener =

View File

@ -473,7 +473,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
UserPreferences.shouldHardwareButtonSkip()) {
// assume the skip command comes from a notification or the lockscreen
// a >| skip button should actually skip
mediaPlayer.endPlayback(true, false);
mediaPlayer.endPlayback();
} else {
// assume skip command comes from a (bluetooth) media button
// user actually wants to fast-forward
@ -1424,7 +1424,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void onReceive(Context context, Intent intent) {
if (TextUtils.equals(intent.getAction(), ACTION_SKIP_CURRENT_EPISODE)) {
Log.d(TAG, "Received SKIP_CURRENT_EPISODE intent");
mediaPlayer.endPlayback(true, false);
mediaPlayer.endPlayback();
}
}
};
@ -1656,7 +1656,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void onSkipToNext() {
Log.d(TAG, "onSkipToNext()");
if(UserPreferences.shouldHardwareButtonSkip()) {
mediaPlayer.endPlayback(true, false);
mediaPlayer.endPlayback();
} else {
seekDelta(UserPreferences.getFastFowardSecs() * 1000);
}

View File

@ -233,7 +233,11 @@ public abstract class PlaybackServiceMediaPlayer {
protected abstract void setPlayable(Playable playable);
public abstract void endPlayback(boolean wasSkipped, boolean switchingPlayers);
public void endPlayback() {
endPlayback(true);
}
protected abstract void endPlayback(boolean wasSkipped);
/**
* Moves the PSMP into STOPPED state. This call is only valid if the player is currently in

View File

@ -182,7 +182,8 @@ public class PlaybackServiceFlavorHelper {
boolean wasLaunched) {
PlaybackServiceMediaPlayer mediaPlayer = callback.getMediaPlayer();
if (mediaPlayer != null) {
mediaPlayer.endPlayback(true, true);
//TODO change implementation to new protocol
// mediaPlayer.endPlayback(true, true);
mediaPlayer.shutdownQuietly();
}
mediaPlayer = newPlayer;

View File

@ -557,7 +557,7 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer {
}
@Override
public void endPlayback(boolean wasSkipped, boolean switchingPlayers) {
protected void endPlayback(boolean wasSkipped) {
Log.d(TAG, "endPlayback() called");
boolean isPlaying = playerStatus == PlayerStatus.PLAYING;
try {