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

Commit 7e207afd authored by Tammo Spalink's avatar Tammo Spalink
Browse files

Reject (NAK) CDMA SMS with unknown teleservice ids.

Addresses issue:
http://buganizer/issue?id=2066191

Change-Id: I56124379534bf19f128b6228749c7ee2ef455fed
parent c937b5ce
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -489,6 +489,13 @@ public final class Telephony {
             */
            public static final int RESULT_SMS_OUT_OF_MEMORY = 3;

            /**
             * Set by BroadcastReceiver. Indicates the message, while
             * possibly valid, is of a format or encoding that is not
             * supported.
             */
            public static final int RESULT_SMS_UNSUPPORTED = 4;

            /**
             * Broadcast Action: A new text based SMS message has been received
             * by the device. The intent will have the following extra
@@ -1696,7 +1703,3 @@ public final class Telephony {
        public static final String EXTRA_SPN        = "spn";
    }
}



+2 −1
Original line number Diff line number Diff line
@@ -144,7 +144,8 @@ public interface CommandsInterface {
    static final int GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED    = 0xD3;
    static final int GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR           = 0xFF;

    // CDMA SMS fail cause for acknowledgeLastIncomingCdmaSms.  From TS N.S00005, 6.5.2.125.
    // CDMA SMS fail cause for acknowledgeLastIncomingCdmaSms.  From TS N.S0005, 6.5.2.125.
    static final int CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID     = 4;
    static final int CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE          = 35;
    static final int CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM     = 39;

+22 −11
Original line number Diff line number Diff line
@@ -128,7 +128,15 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
                    sms.getOriginatingAddress());
        }

        /**
        // Reject (NAK) any messages with teleservice ids that have
        // not yet been handled and also do not correspond to the two
        // kinds that are processed below.
        if ((SmsEnvelope.TELESERVICE_WMT != teleService) &&
                (SmsEnvelope.TELESERVICE_WEMT != teleService)) {
            return Intents.RESULT_SMS_UNSUPPORTED;
        }

        /*
         * TODO(cleanup): Why are we using a getter method for this
         * (and for so many other sms fields)?  Trivial getters and
         * setters like this are direct violations of the style guide.
@@ -141,11 +149,12 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
         */
        SmsHeader smsHeader = sms.getUserDataHeader();

        /**
        /*
         * TODO(cleanup): Since both CDMA and GSM use the same header
         * format, this dispatch processing is naturally identical,
         * and code should probably not be replicated explicitly.
         */

        // See if message is partial or port addressed.
        if ((smsHeader == null) || (smsHeader.concatRef == null)) {
            // Message is not partial (not part of concatenated sequence).
@@ -422,6 +431,8 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
            return 0;
        case Intents.RESULT_SMS_OUT_OF_MEMORY:
            return CommandsInterface.CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE;
        case Intents.RESULT_SMS_UNSUPPORTED:
            return CommandsInterface.CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID;
        case Intents.RESULT_SMS_GENERIC_ERROR:
        default:
            return CommandsInterface.CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM;