Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 444a3aea authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix assert when disabling VVM"

parents f9af28c9 26fe89b6
Loading
Loading
Loading
Loading
+17 −20
Original line number Diff line number Diff line
@@ -142,10 +142,14 @@ public class OmtpVvmCarrierConfigHelper {

  @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 class OmtpVvmCarrierConfigHelper {
  }

  public void startActivation() {
    Assert.checkArgument(isValid());
    PhoneAccountHandle phoneAccountHandle = getPhoneAccountHandle();
    if (phoneAccountHandle == null) {
      // This should never happen
@@ -353,18 +356,13 @@ public class OmtpVvmCarrierConfigHelper {
      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);
  }
  }

  public void activateSmsFilter() {
    Assert.checkArgument(isValid());
@@ -378,8 +376,8 @@ public class OmtpVvmCarrierConfigHelper {
  }

  public void startDeactivation() {
    Assert.checkArgument(isValid());
    VvmLog.i(TAG, "startDeactivation");
    if (isValid()) {
      if (!isLegacyModeEnabled()) {
        // SMS should still be filtered in legacy mode
        context
@@ -388,7 +386,6 @@ public class OmtpVvmCarrierConfigHelper {
            .setVisualVoicemailSmsFilterSettings(null);
        VvmLog.i(TAG, "filter disabled");
      }
    if (protocol != null) {
      protocol.startDeactivation(this);
    }
    VvmAccountManager.removeAccount(context, getPhoneAccountHandle());