diff options
author | Nancy Chen <nancychen@google.com> | 2015-07-14 14:23:56 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2015-07-15 16:02:32 -0700 |
commit | 97c15d1b0b62764b84a911669b11a52c5bff989d (patch) | |
tree | 2361cffa0b16cc3c7417bca9846fe54318095145 | |
parent | 515575ebcf136c215579536c209d9e2644da16ce (diff) |
Pause playback when voicemail is deleted.
We don't want the voicemail to continue playing after deleted, so
perform the pause behavior when the delete button is pressed.
Bug: 22462516
Change-Id: I664c5aed0c2bd1910cdf1f20a33c0117dde8d0cc
-rw-r--r-- | src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java | 1 | ||||
-rw-r--r-- | src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java index 2017bc578..70d6c6133 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java @@ -183,6 +183,7 @@ public class VoicemailPlaybackLayout extends LinearLayout if (mPresenter == null) { return; } + mPresenter.pausePlayback(); CallLogAsyncTaskUtil.deleteVoicemail(mContext, mVoicemailUri, null); } }; diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java index f76af59a4..90617df79 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java @@ -627,7 +627,8 @@ public class VoicemailPlaybackPresenter mMediaPlayer.pause(); } - mPosition = mMediaPlayer.getCurrentPosition(); + mPosition = mMediaPlayer == null ? 0 : mMediaPlayer.getCurrentPosition(); + Log.d(TAG, "Paused playback at " + mPosition + "."); if (mView != null) { @@ -646,7 +647,9 @@ public class VoicemailPlaybackPresenter * playing to know whether to resume playback once the user selects a new position. */ public void pausePlaybackForSeeking() { - mShouldResumePlaybackAfterSeeking = mMediaPlayer.isPlaying(); + if (mMediaPlayer != null) { + mShouldResumePlaybackAfterSeeking = mMediaPlayer.isPlaying(); + } pausePlayback(); } |