Merge "Fix issue where multiple anonymous participants don't show up correctly." into nyc-mr1-dev
diff --git a/src/com/android/phone/VoicemailStatus.java b/src/com/android/phone/VoicemailStatus.java
index 2d8bcc3..c5cd52c 100644
--- a/src/com/android/phone/VoicemailStatus.java
+++ b/src/com/android/phone/VoicemailStatus.java
@@ -120,6 +120,18 @@
         return new Editor(context, PhoneAccountHandleConverter.fromSubId(subId));
     }
 
+    /**
+     * Reset the status to the "disabled" state, which the UI should not show anything for this
+     * subId.
+     */
+    public static void disable(Context context, int subId) {
+        edit(context, subId)
+                .setConfigurationState(Status.CONFIGURATION_STATE_NOT_CONFIGURED)
+                .setDataChannelState(Status.DATA_CHANNEL_STATE_NO_CONNECTION)
+                .setNotificationChannelState(Status.NOTIFICATION_CHANNEL_STATE_NO_CONNECTION)
+                .apply();
+    }
+
     public static DeferredEditor deferredEdit(Context context, int subId) {
         return new DeferredEditor(context, PhoneAccountHandleConverter.fromSubId(subId));
     }
diff --git a/src/com/android/phone/vvm/omtp/ActivationTask.java b/src/com/android/phone/vvm/omtp/ActivationTask.java
index 5998950..aa262c0 100644
--- a/src/com/android/phone/vvm/omtp/ActivationTask.java
+++ b/src/com/android/phone/vvm/omtp/ActivationTask.java
@@ -127,6 +127,11 @@
         int subId = getSubId();
 
         OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(getContext(), subId);
+        if (!helper.isValid()) {
+            VvmLog.i(TAG, "VVM not supported on subId " + subId);
+            VoicemailStatus.disable(getContext(), subId);
+            return;
+        }
         PhoneAccountHandle phoneAccountHandle = PhoneAccountHandleConverter.fromSubId(subId);
         if (!OmtpVvmSourceManager.getInstance(getContext())
                 .isVvmSourceRegistered(phoneAccountHandle)) {
diff --git a/src/com/android/phone/vvm/omtp/SimChangeReceiver.java b/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
index 92bca53..ea7dfa6 100644
--- a/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
+++ b/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
@@ -29,6 +29,7 @@
 import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.TelephonyIntents;
+import com.android.phone.VoicemailStatus;
 import com.android.phone.settings.VisualVoicemailSettingsUtil;
 import com.android.phone.vvm.omtp.sync.OmtpVvmSourceManager;
 import com.android.phone.vvm.omtp.utils.PhoneAccountHandleConverter;
@@ -109,6 +110,7 @@
             String mccMnc = context.getSystemService(TelephonyManager.class).getSimOperator(subId);
             VvmLog.d(TAG,
                     "visual voicemail not supported for carrier " + mccMnc + " on subId " + subId);
+            VoicemailStatus.disable(context, subId);
         }
     }