Fix assert when disabling VVM

The SIM may no longer be valid, but the rest of the deactivation process should still go through.

TEST=TAP
Bug: 79476712
Test: TAP
PiperOrigin-RevId: 199174445
Change-Id: I52d6030320f2675ac74fc06470e3cd8f33b613b8
diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
index 4c4df27..3b97e3d 100644
--- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
+++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
@@ -142,10 +142,14 @@
 
   @VisibleForTesting
   OmtpVvmCarrierConfigHelper(
-      Context context, PersistableBundle carrierConfig, PersistableBundle telephonyConfig) {
+      Context context,
+      PersistableBundle carrierConfig,
+      PersistableBundle telephonyConfig,
+      @Nullable PhoneAccountHandle phoneAccountHandle) {
     this.context = context;
     this.carrierConfig = carrierConfig;
     this.telephonyConfig = telephonyConfig;
+    this.phoneAccountHandle = phoneAccountHandle;
     overrideConfig = null;
     vvmType = getVvmType();
     protocol = VisualVoicemailProtocolFactory.create(this.context.getResources(), vvmType);
@@ -345,7 +349,6 @@
   }
 
   public void startActivation() {
-    Assert.checkArgument(isValid());
     PhoneAccountHandle phoneAccountHandle = getPhoneAccountHandle();
     if (phoneAccountHandle == null) {
       // This should never happen
@@ -353,17 +356,12 @@
       return;
     }
 
-    if (vvmType == null || vvmType.isEmpty()) {
-      // The VVM type is invalid; we should never have gotten here in the first place since
-      // this is loaded initially in the constructor, and callers should check isValid()
-      // before trying to start activation anyways.
-      VvmLog.e(TAG, "startActivation : vvmType is null or empty for account " + phoneAccountHandle);
+    if (!isValid()) {
+      VvmLog.e(TAG, "startActivation : invalid config for account " + phoneAccountHandle);
       return;
     }
 
-    if (protocol != null) {
-      ActivationTask.start(context, this.phoneAccountHandle, null);
-    }
+    ActivationTask.start(context, this.phoneAccountHandle, null);
   }
 
   public void activateSmsFilter() {
@@ -378,17 +376,16 @@
   }
 
   public void startDeactivation() {
-    Assert.checkArgument(isValid());
     VvmLog.i(TAG, "startDeactivation");
-    if (!isLegacyModeEnabled()) {
-      // SMS should still be filtered in legacy mode
-      context
-          .getSystemService(TelephonyManager.class)
-          .createForPhoneAccountHandle(getPhoneAccountHandle())
-          .setVisualVoicemailSmsFilterSettings(null);
-      VvmLog.i(TAG, "filter disabled");
-    }
-    if (protocol != null) {
+    if (isValid()) {
+      if (!isLegacyModeEnabled()) {
+        // SMS should still be filtered in legacy mode
+        context
+            .getSystemService(TelephonyManager.class)
+            .createForPhoneAccountHandle(getPhoneAccountHandle())
+            .setVisualVoicemailSmsFilterSettings(null);
+        VvmLog.i(TAG, "filter disabled");
+      }
       protocol.startDeactivation(this);
     }
     VvmAccountManager.removeAccount(context, getPhoneAccountHandle());