Retain progress for voicemail playback when rebinding voicemail card.
When rebinding the voicemail card, onPrepared gets called and resets the
voicemail playback to 0 because mPosition is not updated to the most
recent value. Update mPosition in this case to the position of the media
player and then call onPrepared.
Bug: 25080811
Change-Id: Ief3a021f4c11bac7b8c0a563765e14c897cb43b5
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
index c0884ad..658aaec 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
@@ -246,6 +246,10 @@
// Handles cases where the same entry is binded again when scrolling in list, or where
// the MediaPlayer was retained after an orientation change.
if (mMediaPlayer != null && mIsPrepared && voicemailUri.equals(mVoicemailUri)) {
+ // If the voicemail card was rebinded, we need to set the position to the appropriate
+ // point. Since we retain the media player, we can just set it to the position of the
+ // media player.
+ mPosition = mMediaPlayer.getCurrentPosition();
onPrepared(mMediaPlayer);
} else {
if (!voicemailUri.equals(mVoicemailUri)) {