diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-18 18:19:20 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-06-19 18:16:32 -0700 |
commit | 053b9c7a4b2662588706211fd8aa1f8a03ec2901 (patch) | |
tree | a9a933161af013c40bf64a9a457a86a86df3637e /src/com/android/dialer/calllog/CallLogFragment.java | |
parent | b67f24eb6229ea10afb83f8ef2bf2bc6ba29a8f6 (diff) |
Rewrite of MediaPlayer logic.
+ Control MediaPlayer instance more tightly. Wait until
prepareContent to initialize instance. Release MediaPlayer when it
is no longer needed.
+ Instead of using isFinishing, check explicitly for orientation
change to know whether to release MediaPlayer.
+ Change Presenter to singleton, to address audio change wonkiness.
+ Only create a Presenter if the call log fragment shows voicemail.
+ ... fixing a variety of cases.
- Temporarily disable proximity sensor until blocking issue is fixed.
Bug: 21856243
Change-Id: Ic06e98bb5278467c3cce726a06b6cf3d855861a2
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogFragment.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 0f19f1491..21ea97ea6 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -187,7 +187,10 @@ public class CallLogFragment extends Fragment resolver.registerContentObserver(Status.CONTENT_URI, true, mVoicemailStatusObserver); setHasOptionsMenu(true); - mVoicemailPlaybackPresenter = new VoicemailPlaybackPresenter(activity, state); + if (mCallTypeFilter == Calls.VOICEMAIL_TYPE) { + mVoicemailPlaybackPresenter = VoicemailPlaybackPresenter + .getInstance(activity, state); + } } /** Called by the CallLogQueryHandler when the list of calls has been fetched or updated. */ @@ -321,23 +324,28 @@ public class CallLogFragment extends Fragment @Override public void onPause() { - mVoicemailPlaybackPresenter.onPause(getActivity().isFinishing()); + if (mVoicemailPlaybackPresenter != null) { + mVoicemailPlaybackPresenter.onPause(); + } mAdapter.pauseCache(); super.onPause(); } @Override public void onStop() { - super.onStop(); - updateOnTransition(false /* onEntry */); + + super.onStop(); } @Override public void onDestroy() { mAdapter.pauseCache(); mAdapter.changeCursor(null); - mVoicemailPlaybackPresenter.onDestroy(getActivity().isFinishing()); + + if (mVoicemailPlaybackPresenter != null) { + mVoicemailPlaybackPresenter.onDestroy(); + } getActivity().getContentResolver().unregisterContentObserver(mCallLogObserver); getActivity().getContentResolver().unregisterContentObserver(mContactsObserver); @@ -353,7 +361,10 @@ public class CallLogFragment extends Fragment outState.putLong(KEY_DATE_LIMIT, mDateLimit); mAdapter.onSaveInstanceState(outState); - mVoicemailPlaybackPresenter.onSaveInstanceState(outState); + + if (mVoicemailPlaybackPresenter != null) { + mVoicemailPlaybackPresenter.onSaveInstanceState(outState); + } } @Override |