summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-06-02 17:29:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-02 17:29:45 +0000
commit5e4d236c5a8833dccf38ff243b8db9e54ee75355 (patch)
tree725ea67ee8fa34d3e0be4b1fe6aca9c828a9b482
parent2b36667435ab8b8346b65d62fad38461406ed50d (diff)
parentb20213ee0e647efbc75d4546b837104b5657dff5 (diff)
Merge "Continue voicemail playback during rotation." into mnc-dev
-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;
}