Fix ghost-seeks.

The pending seek info loaded from the state may not be used if the user hits < or > to restore the playback service.
If we keep the seek around, we would do an unexpected seek if we ever reach the saved song, which is not what we want.
This commit is contained in:
Adrian Ulrich 2017-09-07 21:23:59 +02:00
parent 674a34d6c2
commit 65fc2929b6

View File

@ -1368,8 +1368,12 @@ public final class PlaybackService extends Service
mHandler.removeMessages(MSG_GAPLESS_UPDATE);
mHandler.sendEmptyMessage(MSG_GAPLESS_UPDATE);
if (mPendingSeek != 0 && mPendingSeekSong == song.id) {
mMediaPlayer.seekTo(mPendingSeek);
if (mPendingSeek != 0) {
if (mPendingSeekSong == song.id)
mMediaPlayer.seekTo(mPendingSeek);
// Clear this even if we did not seek:
// We somehow managed to play a different song, so
// whatever we were supposed to seek to, is invalid now.
mPendingSeek = 0;
}