summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-06-01 14:38:59 -0700
committerAndrew Lee <anwlee@google.com>2015-06-01 14:40:27 -0700
commitb20213ee0e647efbc75d4546b837104b5657dff5 (patch)
tree25fce1d22cd3b220e6d5eef48e231048a195cf57
parentb49d8cda7502782408e7a2434584f2d9377ae2cb (diff)
Continue voicemail playback during rotation.
Don't pause playback or release the media player during onPause or onDestroy. Bug: 21235334 Change-Id: I0eccd4e38e89c3416817d80aa25cc3bb529a9d6b
-rw-r--r--src/com/android/dialer/CallDetailActivity.java4
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java16
2 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index 7fa3750d2..ce29049d3 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -272,7 +272,7 @@ public class CallDetailActivity extends Activity {
@Override
public void onPause() {
if (mVoicemailPlaybackPresenter != null) {
- mVoicemailPlaybackPresenter.onPause();
+ mVoicemailPlaybackPresenter.onPause(isFinishing());
}
super.onPause();
}
@@ -280,7 +280,7 @@ public class CallDetailActivity extends Activity {
@Override
public void onDestroy() {
if (mVoicemailPlaybackPresenter != null) {
- mVoicemailPlaybackPresenter.onDestroy();
+ mVoicemailPlaybackPresenter.onDestroy(isFinishing());
}
super.onDestroy();
}
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
index 1ee376582..e8b04602d 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java
@@ -170,24 +170,28 @@ public class VoicemailPlaybackPresenter
PlaybackView view, Uri voicemailUri, boolean startPlayingImmediately) {
mView = view;
mVoicemailUri = voicemailUri;
- setPosition(0, startPlayingImmediately);
mView.setPresenter(this);
- mIsPrepared = false;
+ if (!mMediaPlayer.isPlaying()) {
+ setPosition(0, startPlayingImmediately);
+ mIsPrepared = false;
+ }
checkForContent();
}
- public void onPause() {
- if (mMediaPlayer.isPlaying()) {
+ public void onPause(boolean isFinishing) {
+ // Do not pause for orientation changes.
+ if (mMediaPlayer.isPlaying() && isFinishing) {
pausePlayback(mMediaPlayer.getCurrentPosition(), mIsPlaying);
}
disableProximitySensor(false /* waitForFarState */);
}
- public void onDestroy() {
- if (mIsPrepared) {
+ public void onDestroy(boolean isFinishing) {
+ // Do not release for orientation changes.
+ if (mIsPrepared && isFinishing) {
mMediaPlayer.release();
mIsPrepared = false;
}