Reject (NAK) CDMA SMS with unknown teleservice ids.
Addresses issue:
http://buganizer/issue?id=2066191
Change-Id: I56124379534bf19f128b6228749c7ee2ef455fed
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java
index 4584382..c637e02 100644
--- a/core/java/android/provider/Telephony.java
+++ b/core/java/android/provider/Telephony.java
@@ -490,6 +490,13 @@
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
* values:</p>
@@ -1696,7 +1703,3 @@
public static final String EXTRA_SPN = "spn";
}
}
-
-
-
-
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index ed8bc1e..63bdc2c 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -144,7 +144,8 @@
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;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index 1e3a2e1..bf42257 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -128,7 +128,15 @@
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 @@
*/
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).
@@ -416,15 +425,17 @@
private int resultToCause(int rc) {
switch (rc) {
- case Activity.RESULT_OK:
- case Intents.RESULT_SMS_HANDLED:
- // Cause code is ignored on success.
- return 0;
- case Intents.RESULT_SMS_OUT_OF_MEMORY:
- return CommandsInterface.CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE;
- case Intents.RESULT_SMS_GENERIC_ERROR:
- default:
- return CommandsInterface.CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM;
+ case Activity.RESULT_OK:
+ case Intents.RESULT_SMS_HANDLED:
+ // Cause code is ignored on success.
+ 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;
}
}
}