summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoojung Shin <sj46.shin@samsung.com>2011-06-10 21:37:23 +0900
committerSimon Wilson <simonwilson@google.com>2011-06-10 13:48:36 -0700
commitd027329cd6105c05c157e3858a170e4f04eb0e3e (patch)
tree2e53dce64706a7c77898fc476bd8ec826fde7d1b
parent8688d4708117db446d6ba2855f1d8ad715bb4d72 (diff)
downloadbase-d027329cd6105c05c157e3858a170e4f04eb0e3e.tar.gz
Ignore duplicate WAP push PDU source/destination port if configured
Some carriers duplicate the OMADM wap push PDU source/destination port. e.g. MSGTYPE-TotalSegments-CurrentSegment -SourcePortDestPort-SourcePortDestPort-OMADM PDU So the client has to ignore the duplicate source/destination port. Change-Id: I83df6e8e7d2e2e4275036a1b574247f9f40c5cf4 Signed-off-by: Soojung Shin <sj46.shin@samsung.com>
-rwxr-xr-xcore/res/res/values/config.xml7
-rwxr-xr-x[-rw-r--r--]telephony/java/com/android/internal/telephony/WapPushOverSms.java5
-rwxr-xr-x[-rw-r--r--]telephony/java/com/android/internal/telephony/WspTypeDecoder.java4
-rwxr-xr-x[-rw-r--r--]telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java54
4 files changed, 69 insertions, 1 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 032ec295101f..779028e82bdd 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -461,4 +461,11 @@
<!-- Set to true if the RSSI should always display CDMA signal strength
even on EVDO -->
<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>
diff --git a/telephony/java/com/android/internal/telephony/WapPushOverSms.java b/telephony/java/com/android/internal/telephony/WapPushOverSms.java
index 168b63bb3e00..d6616404bd75 100644..100755
--- a/telephony/java/com/android/internal/telephony/WapPushOverSms.java
+++ b/telephony/java/com/android/internal/telephony/WapPushOverSms.java
@@ -135,6 +135,9 @@ public class WapPushOverSms {
case WspTypeDecoder.CONTENT_TYPE_B_SUPL_INIT:
mimeType = WspTypeDecoder.CONTENT_MIME_TYPE_B_SUPL_INIT;
break;
+ case WspTypeDecoder.CONTENT_TYPE_B_PUSH_SYNCML_NOTI:
+ mimeType = WspTypeDecoder.CONTENT_MIME_TYPE_B_PUSH_SYNCML_NOTI;
+ break;
default:
if (Config.LOGD) {
Log.w(LOG_TAG,
@@ -159,6 +162,8 @@ public class WapPushOverSms {
binaryContentType = WspTypeDecoder.CONTENT_TYPE_B_VND_DOCOMO_PF;
} else if (mimeType.equals(WspTypeDecoder.CONTENT_MIME_TYPE_B_SUPL_INIT)) {
binaryContentType = WspTypeDecoder.CONTENT_TYPE_B_SUPL_INIT;
+ } else if (mimeType.equals(WspTypeDecoder.CONTENT_MIME_TYPE_B_PUSH_SYNCML_NOTI)) {
+ binaryContentType = WspTypeDecoder.CONTENT_TYPE_B_PUSH_SYNCML_NOTI;
} else {
if (Config.LOGD) Log.w(LOG_TAG, "Received PDU. Unknown Content-Type = " + mimeType);
return Intents.RESULT_SMS_HANDLED;
diff --git a/telephony/java/com/android/internal/telephony/WspTypeDecoder.java b/telephony/java/com/android/internal/telephony/WspTypeDecoder.java
index 5dc89f064a43..01206fdd946f 100644..100755
--- a/telephony/java/com/android/internal/telephony/WspTypeDecoder.java
+++ b/telephony/java/com/android/internal/telephony/WspTypeDecoder.java
@@ -41,6 +41,7 @@ public class WspTypeDecoder {
public static final int CONTENT_TYPE_B_MMS = 0x3e;
public static final int CONTENT_TYPE_B_VND_DOCOMO_PF = 0x0310;
public static final int CONTENT_TYPE_B_SUPL_INIT = 0x312;
+ public static final int CONTENT_TYPE_B_PUSH_SYNCML_NOTI = 0x44;
public static final String CONTENT_MIME_TYPE_B_DRM_RIGHTS_XML =
"application/vnd.oma.drm.rights+xml";
@@ -52,10 +53,11 @@ public class WspTypeDecoder {
public static final String CONTENT_MIME_TYPE_B_MMS = "application/vnd.wap.mms-message";
public static final String CONTENT_MIME_TYPE_B_VND_DOCOMO_PF = "application/vnd.docomo.pf";
public static final String CONTENT_MIME_TYPE_B_SUPL_INIT = "application/vnd.omaloc-supl-init";
+ public static final String CONTENT_MIME_TYPE_B_PUSH_SYNCML_NOTI =
+ "application/vnd.syncml.notification";
public static final int PARAMETER_ID_X_WAP_APPLICATION_ID = 0x2f;
-
byte[] wspData;
int dataLength;
long unsigned32bit;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index 45b58e50d90d..e409646d7c90 100644..100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -42,6 +42,7 @@ import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase;
import com.android.internal.telephony.SmsMessageBase.TextEncodingDetails;
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.UserData;
import com.android.internal.util.HexDump;
@@ -51,6 +52,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import android.content.res.Resources;
+
final class CdmaSMSDispatcher extends SMSDispatcher {
private static final String TAG = "CDMA";
@@ -58,6 +61,9 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
private byte[] mLastDispatchedSmsFingerprint;
private byte[] mLastAcknowledgedSmsFingerprint;
+ private boolean mCheckForDuplicatePortsInOmadmWapPush = Resources.getSystem().getBoolean(
+ com.android.internal.R.bool.config_duplicate_port_omadm_wappush);
+
CdmaSMSDispatcher(CDMAPhone phone) {
super(phone);
}
@@ -245,6 +251,13 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
sourcePort |= 0xFF & pdu[index++];
destinationPort = (0xFF & pdu[index++]) << 8;
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
@@ -488,4 +501,45 @@ final class CdmaSMSDispatcher extends SMSDispatcher {
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) {
+ int binaryContentType = (int)pduDecoder.getValue32();
+ if (binaryContentType == WspTypeDecoder.CONTENT_TYPE_B_PUSH_SYNCML_NOTI) {
+ return true;
+ }
+ }
+ return false;
+ }
}