Merge change 23607 into eclair

* changes:
  Reject (NAK) CDMA SMS with unknown teleservice ids.
This commit is contained in:
Android (Google) Code Review
2009-09-02 20:29:09 -07:00
3 changed files with 31 additions and 16 deletions

View File

@@ -489,6 +489,13 @@ public final class Telephony {
*/ */
public static final int RESULT_SMS_OUT_OF_MEMORY = 3; 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 * Broadcast Action: A new text based SMS message has been received
* by the device. The intent will have the following extra * 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"; public static final String EXTRA_SPN = "spn";
} }
} }

View File

@@ -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_MEMORY_CAPACITY_EXCEEDED = 0xD3;
static final int GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR = 0xFF; 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_RESOURCE_SHORTAGE = 35;
static final int CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM = 39; static final int CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM = 39;

View File

@@ -128,7 +128,15 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
sms.getOriginatingAddress()); 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 * TODO(cleanup): Why are we using a getter method for this
* (and for so many other sms fields)? Trivial getters and * (and for so many other sms fields)? Trivial getters and
* setters like this are direct violations of the style guide. * setters like this are direct violations of the style guide.
@@ -141,11 +149,12 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
*/ */
SmsHeader smsHeader = sms.getUserDataHeader(); SmsHeader smsHeader = sms.getUserDataHeader();
/** /*
* TODO(cleanup): Since both CDMA and GSM use the same header * TODO(cleanup): Since both CDMA and GSM use the same header
* format, this dispatch processing is naturally identical, * format, this dispatch processing is naturally identical,
* and code should probably not be replicated explicitly. * and code should probably not be replicated explicitly.
*/ */
// See if message is partial or port addressed. // See if message is partial or port addressed.
if ((smsHeader == null) || (smsHeader.concatRef == null)) { if ((smsHeader == null) || (smsHeader.concatRef == null)) {
// Message is not partial (not part of concatenated sequence). // Message is not partial (not part of concatenated sequence).
@@ -416,15 +425,17 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
private int resultToCause(int rc) { private int resultToCause(int rc) {
switch (rc) { switch (rc) {
case Activity.RESULT_OK: case Activity.RESULT_OK:
case Intents.RESULT_SMS_HANDLED: case Intents.RESULT_SMS_HANDLED:
// Cause code is ignored on success. // Cause code is ignored on success.
return 0; return 0;
case Intents.RESULT_SMS_OUT_OF_MEMORY: case Intents.RESULT_SMS_OUT_OF_MEMORY:
return CommandsInterface.CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE; return CommandsInterface.CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE;
case Intents.RESULT_SMS_GENERIC_ERROR: case Intents.RESULT_SMS_UNSUPPORTED:
default: return CommandsInterface.CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID;
return CommandsInterface.CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM; case Intents.RESULT_SMS_GENERIC_ERROR:
default:
return CommandsInterface.CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM;
} }
} }
} }