diff options
Diffstat (limited to 'java/com/android')
4 files changed, 26 insertions, 5 deletions
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index dba43a2f7..5b6eb0387 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -182,10 +182,10 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { } @VisibleForTesting - static boolean shouldAutoSync( + boolean shouldAutoSync( VoicemailErrorMessageCreator errorMessageCreator, List<VoicemailStatus> statuses) { for (VoicemailStatus status : statuses) { - if (!status.isActive()) { + if (!status.isActive(getContext())) { continue; } if (errorMessageCreator.isSyncBlockingError(status)) { diff --git a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java index ffaf16d18..a441e7986 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java +++ b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java @@ -86,9 +86,11 @@ public class VoicemailErrorManager implements CallLogQueryHandler.Listener, Voic List<VoicemailStatus> statuses = new ArrayList<>(); while (statusCursor.moveToNext()) { VoicemailStatus status = new VoicemailStatus(context, statusCursor); - if (status.isActive()) { + if (status.isActive(context)) { statuses.add(status); addServiceStateListener(status); + } else { + LogUtil.i("VisualVoicemailCallLogFragment.shouldAutoSync", "inactive source ignored"); } } alertItem.updateStatus(statuses, this); diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java index b2052c61e..243dc6a86 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java @@ -280,7 +280,9 @@ public final class NewVoicemailFragment extends Fragment implements LoaderCallba while (cursor.moveToNext()) { VoicemailStatus status = new VoicemailStatus(context, cursor); - if (status.isActive()) { + if (status.isActive(context)) { + LogUtil.i( + "NewVoicemailFragment.queryVoicemailStatus", "inactive source ignored"); statuses.add(status); // TODO(a bug): Handle Service State Listeners } diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java index 4f4dbbbe8..ebda0e658 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatus.java @@ -34,6 +34,8 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.voicemailstatus.VoicemailStatusQuery; +import com.android.voicemail.VoicemailClient; +import com.android.voicemail.VoicemailComponent; /** Structured data from {@link android.provider.VoicemailContract.Status} */ public class VoicemailStatus { @@ -232,7 +234,22 @@ public class VoicemailStatus { } } - public boolean isActive() { + public boolean isActive(Context context) { + VoicemailClient voicemailClient = VoicemailComponent.get(context).getVoicemailClient(); + if (context.getPackageName().equals(sourcePackage)) { + if (!voicemailClient.isVoicemailModuleEnabled()) { + LogUtil.i("VoicemailStatus.isActive", "module disabled"); + return false; + } + if (!voicemailClient.hasCarrierSupport(context, getPhoneAccountHandle())) { + LogUtil.i("VoicemailStatus.isActive", "carrier not supported"); + return false; + } + if (!voicemailClient.isVoicemailEnabled(context, getPhoneAccountHandle())) { + LogUtil.i("VoicemailStatus.isActive", "VVM disabled"); + return false; + } + } switch (configurationState) { case Status.CONFIGURATION_STATE_NOT_CONFIGURED: case Status.CONFIGURATION_STATE_DISABLED: |