* commit 'd8f9a83cab34de38981dc3ba5ca9df8dda02dbc0': Ignore duplicate WAP push PDU source/destination port if configured
This commit is contained in:
@@ -628,4 +628,11 @@
|
|||||||
<!-- Set to true if the RSSI should always display CDMA signal strength
|
<!-- Set to true if the RSSI should always display CDMA signal strength
|
||||||
even on EVDO -->
|
even on EVDO -->
|
||||||
<bool name="config_alwaysUseCdmaRssi">false</bool>
|
<bool name="config_alwaysUseCdmaRssi">false</bool>
|
||||||
|
|
||||||
|
<!-- If this value is true, duplicate Source/Destination port fields
|
||||||
|
in WDP header of some carriers OMADM wap push are supported.
|
||||||
|
ex: MSGTYPE-TotalSegments-CurrentSegment
|
||||||
|
-SourcePortDestPort-SourcePortDestPort-OMADM PDU
|
||||||
|
If false, not supported. -->
|
||||||
|
<bool name="config_duplicate_port_omadm_wappush">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
0
telephony/java/com/android/internal/telephony/WapPushOverSms.java
Normal file → Executable file
0
telephony/java/com/android/internal/telephony/WapPushOverSms.java
Normal file → Executable file
1
telephony/java/com/android/internal/telephony/WspTypeDecoder.java
Normal file → Executable file
1
telephony/java/com/android/internal/telephony/WspTypeDecoder.java
Normal file → Executable file
@@ -194,6 +194,7 @@ public class WspTypeDecoder {
|
|||||||
|
|
||||||
public static final String CONTENT_TYPE_B_PUSH_CO = "application/vnd.wap.coc";
|
public static final String CONTENT_TYPE_B_PUSH_CO = "application/vnd.wap.coc";
|
||||||
public static final String CONTENT_TYPE_B_MMS = "application/vnd.wap.mms-message";
|
public static final String CONTENT_TYPE_B_MMS = "application/vnd.wap.mms-message";
|
||||||
|
public static final String CONTENT_TYPE_B_PUSH_SYNCML_NOTI = "application/vnd.syncml.notification";
|
||||||
|
|
||||||
byte[] wspData;
|
byte[] wspData;
|
||||||
int dataLength;
|
int dataLength;
|
||||||
|
|||||||
51
telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
Normal file → Executable file
51
telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
Normal file → Executable file
@@ -42,6 +42,7 @@ import com.android.internal.telephony.SmsHeader;
|
|||||||
import com.android.internal.telephony.SmsMessageBase;
|
import com.android.internal.telephony.SmsMessageBase;
|
||||||
import com.android.internal.telephony.SmsMessageBase.TextEncodingDetails;
|
import com.android.internal.telephony.SmsMessageBase.TextEncodingDetails;
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
|
import com.android.internal.telephony.WspTypeDecoder;
|
||||||
import com.android.internal.telephony.cdma.sms.SmsEnvelope;
|
import com.android.internal.telephony.cdma.sms.SmsEnvelope;
|
||||||
import com.android.internal.telephony.cdma.sms.UserData;
|
import com.android.internal.telephony.cdma.sms.UserData;
|
||||||
import com.android.internal.util.HexDump;
|
import com.android.internal.util.HexDump;
|
||||||
@@ -51,6 +52,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import android.content.res.Resources;
|
||||||
|
|
||||||
|
|
||||||
final class CdmaSMSDispatcher extends SMSDispatcher {
|
final class CdmaSMSDispatcher extends SMSDispatcher {
|
||||||
private static final String TAG = "CDMA";
|
private static final String TAG = "CDMA";
|
||||||
@@ -58,6 +61,9 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
|
|||||||
private byte[] mLastDispatchedSmsFingerprint;
|
private byte[] mLastDispatchedSmsFingerprint;
|
||||||
private byte[] mLastAcknowledgedSmsFingerprint;
|
private byte[] mLastAcknowledgedSmsFingerprint;
|
||||||
|
|
||||||
|
private boolean mCheckForDuplicatePortsInOmadmWapPush = Resources.getSystem().getBoolean(
|
||||||
|
com.android.internal.R.bool.config_duplicate_port_omadm_wappush);
|
||||||
|
|
||||||
CdmaSMSDispatcher(CDMAPhone phone) {
|
CdmaSMSDispatcher(CDMAPhone phone) {
|
||||||
super(phone);
|
super(phone);
|
||||||
}
|
}
|
||||||
@@ -254,6 +260,13 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
|
|||||||
sourcePort |= 0xFF & pdu[index++];
|
sourcePort |= 0xFF & pdu[index++];
|
||||||
destinationPort = (0xFF & pdu[index++]) << 8;
|
destinationPort = (0xFF & pdu[index++]) << 8;
|
||||||
destinationPort |= 0xFF & pdu[index++];
|
destinationPort |= 0xFF & pdu[index++];
|
||||||
|
// Some carriers incorrectly send duplicate port fields in omadm wap pushes.
|
||||||
|
// If configured, check for that here
|
||||||
|
if (mCheckForDuplicatePortsInOmadmWapPush) {
|
||||||
|
if (checkDuplicatePortOmadmWappush(pdu,index)) {
|
||||||
|
index = index + 4; // skip duplicate port fields
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup all other related parts
|
// Lookup all other related parts
|
||||||
@@ -503,4 +516,42 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
|
|||||||
return CommandsInterface.CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM;
|
return CommandsInterface.CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional check to see if the received WapPush is an OMADM notification with erroneous
|
||||||
|
* extra port fields.
|
||||||
|
* - Some carriers make this mistake.
|
||||||
|
* ex: MSGTYPE-TotalSegments-CurrentSegment
|
||||||
|
* -SourcePortDestPort-SourcePortDestPort-OMADM PDU
|
||||||
|
* @param origPdu The WAP-WDP PDU segment
|
||||||
|
* @param index Current Index while parsing the PDU.
|
||||||
|
* @return True if OrigPdu is OmaDM Push Message which has duplicate ports.
|
||||||
|
* False if OrigPdu is NOT OmaDM Push Message which has duplicate ports.
|
||||||
|
*/
|
||||||
|
private boolean checkDuplicatePortOmadmWappush(byte[] origPdu, int index) {
|
||||||
|
index += 4;
|
||||||
|
byte[] omaPdu = new byte[origPdu.length - index];
|
||||||
|
System.arraycopy(origPdu, index, omaPdu, 0, omaPdu.length);
|
||||||
|
|
||||||
|
WspTypeDecoder pduDecoder = new WspTypeDecoder(omaPdu);
|
||||||
|
int wspIndex = 2;
|
||||||
|
|
||||||
|
// Process header length field
|
||||||
|
if (pduDecoder.decodeUintvarInteger(wspIndex) == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wspIndex += pduDecoder.getDecodedDataLength(); // advance to next field
|
||||||
|
|
||||||
|
// Process content type field
|
||||||
|
if (pduDecoder.decodeContentType(wspIndex) == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String mimeType = pduDecoder.getValueString();
|
||||||
|
if (mimeType != null && mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_SYNCML_NOTI)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user