diff options
author | twyen <twyen@google.com> | 2018-05-21 14:44:52 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-21 16:24:23 -0700 |
commit | b780cb914e8ae07da39e771539c73bc915ac2e7c (patch) | |
tree | 938562efaa620c9400247f9f1d703c1408b060ce /java | |
parent | 00d7edeabd1100fa0a9ce6090df0402e771a735f (diff) |
Ignore dialer OMTP VVM error if VVM is disabled
The status will be stale.
TEST=TAP
Bug: 78831353
Test: TAP
PiperOrigin-RevId: 197462056
Change-Id: Iaeeae9007f6b5ad8319889a860fdcce782be8a0d
Diffstat (limited to 'java')
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: |