diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-16 00:09:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-16 00:09:31 +0000 |
commit | c57430a61eab62e88372f386c75989dab6332608 (patch) | |
tree | b606f1899f80fcd0ea3ee753ce799883d5a673ab /java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java | |
parent | 9842b4a7fd1d852b1353af806da4913b4298d516 (diff) | |
parent | 0c9dbf507b53a12bdf577ff3e55c1686a2e089de (diff) |
Merge "Update Dialer to v10 RC32" into oc-dev
am: 0c9dbf507b
Change-Id: I5f90090090c6e430d83fcdd294082c1f5237ade8
Diffstat (limited to 'java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 1440218fb..893d6bed9 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -33,6 +33,7 @@ import com.android.dialer.app.voicemail.VoicemailPlaybackPresenter; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.util.PermissionsUtil; public class VisualVoicemailCallLogFragment extends CallLogFragment { @@ -54,19 +55,35 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { public void onActivityCreated(Bundle savedInstanceState) { mVoicemailPlaybackPresenter = VoicemailPlaybackPresenter.getInstance(getActivity(), savedInstanceState); - getActivity() - .getContentResolver() - .registerContentObserver( - VoicemailContract.Status.CONTENT_URI, true, mVoicemailStatusObserver); + + if (PermissionsUtil.hasReadVoicemailPermissions(getContext()) + && PermissionsUtil.hasAddVoicemailPermissions(getContext())) { + getActivity() + .getContentResolver() + .registerContentObserver( + VoicemailContract.Status.CONTENT_URI, true, mVoicemailStatusObserver); + } else { + LogUtil.w( + "VisualVoicemailCallLogFragment.onActivityCreated", + "read voicemail permission unavailable."); + } super.onActivityCreated(savedInstanceState); mVoicemailErrorManager = new VoicemailErrorManager(getContext(), getAdapter().getAlertManager(), mModalAlertManager); - getActivity() - .getContentResolver() - .registerContentObserver( - VoicemailContract.Status.CONTENT_URI, - true, - mVoicemailErrorManager.getContentObserver()); + + if (PermissionsUtil.hasReadVoicemailPermissions(getContext()) + && PermissionsUtil.hasAddVoicemailPermissions(getContext())) { + getActivity() + .getContentResolver() + .registerContentObserver( + VoicemailContract.Status.CONTENT_URI, + true, + mVoicemailErrorManager.getContentObserver()); + } else { + LogUtil.w( + "VisualVoicemailCallLogFragment.onActivityCreated", + "read voicemail permission unavailable."); + } } @Override @@ -118,7 +135,9 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { LogUtil.enterBlock("VisualVoicemailCallLogFragment.onPageSelected"); super.onVisible(); if (getActivity() != null) { - getActivity().sendBroadcast(new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL)); + Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL); + intent.setPackage(getActivity().getPackageName()); + getActivity().sendBroadcast(intent); Logger.get(getActivity()).logImpression(DialerImpression.Type.VVM_TAB_VIEWED); getActivity().setVolumeControlStream(VoicemailAudioManager.PLAYBACK_STREAM); } |