Disable MWI when VVM is available.

Since we don't want to see two separate notifications each time we get a
new voicemail. Ignore MWI notifications when a corresponding pstn visual
voicemail source is available.

Bug: 20121229

Change-Id: I963e5eea5d66f10656a7c34926e4b10c175434f5
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 54dfb75..c5a9f12 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -52,6 +52,7 @@
 import com.android.internal.telephony.PhoneBase;
 import com.android.internal.telephony.TelephonyCapabilities;
 import com.android.phone.settings.VoicemailSettingsActivity;
+import com.android.phone.vvm.omtp.sync.VoicemailStatusQueryHelper;
 import com.android.phone.settings.VoicemailNotificationSettingsUtil;
 import com.android.phone.settings.VoicemailProviderSettingsUtil;
 
@@ -299,11 +300,20 @@
             return;
         }
 
+        Phone phone = PhoneGlobals.getPhone(subId);
+        if (visible && phone != null) {
+            VoicemailStatusQueryHelper queryHelper = new VoicemailStatusQueryHelper(mContext);
+            PhoneAccountHandle phoneAccount = PhoneUtils.makePstnPhoneAccountHandle(phone);
+            if (queryHelper.isNotificationsChannelActive(phoneAccount)) {
+                Log.v(LOG_TAG, "Notifications channel active for visual voicemail, hiding mwi.");
+                visible = false;
+            }
+        }
+
         Log.i(LOG_TAG, "updateMwi(): subId " + subId + " update to " + visible);
         mMwiVisible.put(subId, visible);
 
         if (visible) {
-            Phone phone = PhoneGlobals.getPhone(subId);
             if (phone == null) {
                 Log.w(LOG_TAG, "Found null phone for: " + subId);
                 return;