wappush: Use valid index for pdu including garbages
Sungmin Choi [Thu, 29 Aug 2013 00:12:06 +0000 (17:12 -0700)]
For some operators, pdu has garbages. As a result, device does not receive
MMS or operator some requests.
To fix it, re-index pdu to use valid index for operators.

Bug: 10492745
Change-Id: Ic7262f7369403bd060d94c5da0e09f18c96ff3db

src/java/com/android/internal/telephony/WapPushOverSms.java

index b600606..87b3810 100755 (executable)
@@ -96,8 +96,25 @@ public class WapPushOverSms implements ServiceConnection {
 
         if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) &&
                 (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) {
-            if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
-            return Intents.RESULT_SMS_HANDLED;
+            index = mContext.getResources().getInteger(
+                    com.android.internal.R.integer.config_valid_wappush_index);
+            if(index != -1) {
+                transactionId = pdu[index++] & 0xff;
+                pduType = pdu[index++] & 0xff;
+                if (DBG)
+                    Rlog.d(TAG, "index = " + index + " PDU Type = " + pduType +
+                            " transactionID = " + transactionId);
+
+                // recheck wap push pduType
+                if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH)
+                        && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) {
+                    if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
+                    return Intents.RESULT_SMS_HANDLED;
+                }
+            } else {
+                if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType);
+                return Intents.RESULT_SMS_HANDLED;
+            }
         }
 
         WspTypeDecoder pduDecoder = new WspTypeDecoder(pdu);