am 8521dca6: am fb16e5cc: Merge change 23607 into eclair

Merge commit '8521dca69bb33a7f45c8233305618e540543b00d'

* commit '8521dca69bb33a7f45c8233305618e540543b00d':
  Reject (NAK) CDMA SMS with unknown teleservice ids.
This commit is contained in:
Tammo Spalink
2009-09-03 09:50:45 -07:00
committed by Android Git Automerger
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;
/**
* 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";
}
}

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_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;

View File

@@ -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).
@@ -416,15 +425,17 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
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;
}
}
}