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

Commit 1ffc9adf authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Handle alternative form VVM SMS as legacy notification if the account is not activated yet."

parents 564c41f3 5dcad7ed
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -244,4 +244,9 @@ public class OmtpConstants {
  private static final String truncate(String string, int length) {
    return string.substring(0, Math.min(length, string.length()));
  }

  // Alternative form of sync message: MBOXUPDATE?m=<new_message_count>;<key>=<value>;

  public static final String ALTERNATIVE_MAILBOX_UPDATE = "MBOXUPDATE";
  public static final String ALTERNATIVE_NUM_MESSAGE_COUNT = "m";
}
+11 −1
Original line number Diff line number Diff line
@@ -62,11 +62,21 @@ public class LegacyModeSmsHandler {
        case OmtpConstants.NEW_MESSAGE:
        case OmtpConstants.MAILBOX_UPDATE:
          sendLegacyVoicemailNotification(context, handle, message.getNewMessageCount());

          break;
        default:
          break;
      }
    } else if (OmtpConstants.ALTERNATIVE_MAILBOX_UPDATE.equals(eventType)) {
      VvmLog.w(TAG, "receiving alternative VVM SMS on non-activated account");
      int messageCount = 0;
      try {
        messageCount =
            Integer.parseInt(
                sms.getFields().getString(OmtpConstants.ALTERNATIVE_NUM_MESSAGE_COUNT));
      } catch (NumberFormatException e) {
        VvmLog.e(TAG, "missing message count");
      }
      sendLegacyVoicemailNotification(context, handle, messageCount);
    }
  }

+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil;
import com.android.voicemail.impl.sync.SyncOneTask;
import com.android.voicemail.impl.sync.SyncTask;
import com.android.voicemail.impl.sync.VoicemailsQueryHelper;
import com.android.voicemail.impl.sync.VvmAccountManager;
import com.android.voicemail.impl.utils.VoicemailDatabaseUtil;

/** Receive SMS messages and send for processing by the OMTP visual voicemail source. */
@@ -69,6 +70,12 @@ public class OmtpMessageReceiver extends BroadcastReceiver {
      return;
    }

    if (!VvmAccountManager.isAccountActivated(context, phone)) {
      VvmLog.i(TAG, "Received message on non-activated account");
      LegacyModeSmsHandler.handle(context, sms);
      return;
    }

    OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(this.context, phone);
    if (!helper.isValid()) {
      VvmLog.e(TAG, "vvm config no longer valid");