Merge change 25535 into eclair
* changes: CDMA Check for network duplicate sms
This commit is contained in:
@@ -48,6 +48,7 @@ import com.android.internal.util.HexDump;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.lang.Boolean;
|
import java.lang.Boolean;
|
||||||
|
|
||||||
@@ -57,6 +58,9 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
|
|||||||
|
|
||||||
private CDMAPhone mCdmaPhone;
|
private CDMAPhone mCdmaPhone;
|
||||||
|
|
||||||
|
private byte[] mLastDispatchedSmsFingerprint;
|
||||||
|
private byte[] mLastAcknowledgedSmsFingerprint;
|
||||||
|
|
||||||
CdmaSMSDispatcher(CDMAPhone phone) {
|
CdmaSMSDispatcher(CDMAPhone phone) {
|
||||||
super(phone);
|
super(phone);
|
||||||
mCdmaPhone = phone;
|
mCdmaPhone = phone;
|
||||||
@@ -104,8 +108,14 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
|
|||||||
return Intents.RESULT_SMS_GENERIC_ERROR;
|
return Intents.RESULT_SMS_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode BD stream and set sms variables.
|
// See if we have a network duplicate SMS.
|
||||||
SmsMessage sms = (SmsMessage) smsb;
|
SmsMessage sms = (SmsMessage) smsb;
|
||||||
|
mLastDispatchedSmsFingerprint = sms.getIncomingSmsFingerprint();
|
||||||
|
if (mLastAcknowledgedSmsFingerprint != null &&
|
||||||
|
Arrays.equals(mLastDispatchedSmsFingerprint, mLastAcknowledgedSmsFingerprint)) {
|
||||||
|
return Intents.RESULT_SMS_HANDLED;
|
||||||
|
}
|
||||||
|
// Decode BD stream and set sms variables.
|
||||||
sms.parseSms();
|
sms.parseSms();
|
||||||
int teleService = sms.getTeleService();
|
int teleService = sms.getTeleService();
|
||||||
boolean handled = false;
|
boolean handled = false;
|
||||||
@@ -433,7 +443,13 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mCm != null) {
|
if (mCm != null) {
|
||||||
mCm.acknowledgeLastIncomingCdmaSms(success, resultToCause(result), response);
|
int causeCode = resultToCause(result);
|
||||||
|
mCm.acknowledgeLastIncomingCdmaSms(success, causeCode, response);
|
||||||
|
|
||||||
|
if (causeCode == 0) {
|
||||||
|
mLastAcknowledgedSmsFingerprint = mLastDispatchedSmsFingerprint;
|
||||||
|
}
|
||||||
|
mLastDispatchedSmsFingerprint = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -794,5 +794,20 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
return mBearerData.numberOfMessages;
|
return mBearerData.numberOfMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a byte array that can be use to uniquely identify a received SMS message.
|
||||||
|
* C.S0015-B 4.3.1.6 Unique Message Identification.
|
||||||
|
*
|
||||||
|
* @return byte array uniquely identifying the message.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
/* package */ byte[] getIncomingSmsFingerprint() {
|
||||||
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
output.write(mEnvelope.teleService);
|
||||||
|
output.write(mEnvelope.origAddress.origBytes, 0, mEnvelope.origAddress.origBytes.length);
|
||||||
|
output.write(mEnvelope.bearerData, 0, mEnvelope.bearerData.length);
|
||||||
|
|
||||||
|
return output.toByteArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user