From d5b325aaaca7e5197851d26332f48b917d961b9d Mon Sep 17 00:00:00 2001 From: "Takaoka G. Tadashi" Date: Wed, 4 Nov 2009 14:36:21 +0900 Subject: [PATCH] Add WSP header to WAP_PUSH_RECEIVED intent in addition to data Import CL 146651 from //branches/cupcake_dcm --- core/java/android/provider/Telephony.java | 3 +- .../internal/telephony/WapPushOverSms.java | 34 +++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 6380a8d9a016f..4860cbded3b8b 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -553,7 +553,8 @@ public final class Telephony { *
  • transactionId (Integer) - The WAP transaction * ID
  • *
  • pduType (Integer) - The WAP PDU type
  • - *
  • data - The data payload of the message
  • + *
  • header (byte[]) - The header of the message
  • + *
  • data (byte[]) - The data payload of the message
  • * * *

    If a BroadcastReceiver encounters an error while processing diff --git a/telephony/java/com/android/internal/telephony/WapPushOverSms.java b/telephony/java/com/android/internal/telephony/WapPushOverSms.java index 4deb29c6c6339..a636a4b3b702d 100644 --- a/telephony/java/com/android/internal/telephony/WapPushOverSms.java +++ b/telephony/java/com/android/internal/telephony/WapPushOverSms.java @@ -161,28 +161,31 @@ public class WapPushOverSms { } index += pduDecoder.getDecodedDataLength(); - int dataIndex = headerStartIndex + headerLength; boolean dispatchedByApplication = false; switch (binaryContentType) { case WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO: - dispatchWapPdu_PushCO(pdu, transactionId, pduType); + dispatchWapPdu_PushCO(pdu, transactionId, pduType, headerStartIndex, headerLength); dispatchedByApplication = true; break; case WspTypeDecoder.CONTENT_TYPE_B_MMS: - dispatchWapPdu_MMS(pdu, transactionId, pduType, dataIndex); + dispatchWapPdu_MMS(pdu, transactionId, pduType, headerStartIndex, headerLength); dispatchedByApplication = true; break; default: break; } if (dispatchedByApplication == false) { - dispatchWapPdu_default(pdu, transactionId, pduType, mimeType, dataIndex); + dispatchWapPdu_default(pdu, transactionId, pduType, mimeType, + headerStartIndex, headerLength); } return Activity.RESULT_OK; } - private void dispatchWapPdu_default( - byte[] pdu, int transactionId, int pduType, String mimeType, int dataIndex) { + private void dispatchWapPdu_default(byte[] pdu, int transactionId, int pduType, + String mimeType, int headerStartIndex, int headerLength) { + byte[] header = new byte[headerLength]; + System.arraycopy(pdu, headerStartIndex, header, 0, header.length); + int dataIndex = headerStartIndex + headerLength; byte[] data; data = new byte[pdu.length - dataIndex]; @@ -192,31 +195,40 @@ public class WapPushOverSms { intent.setType(mimeType); intent.putExtra("transactionId", transactionId); intent.putExtra("pduType", pduType); + intent.putExtra("header", header); intent.putExtra("data", data); mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_WAP_PUSH"); } - private void dispatchWapPdu_PushCO(byte[] pdu, int transactionId, int pduType) { + private void dispatchWapPdu_PushCO(byte[] pdu, int transactionId, int pduType, + int headerStartIndex, int headerLength) { + byte[] header = new byte[headerLength]; + System.arraycopy(pdu, headerStartIndex, header, 0, header.length); + Intent intent = new Intent(Intents.WAP_PUSH_RECEIVED_ACTION); intent.setType(WspTypeDecoder.CONTENT_MIME_TYPE_B_PUSH_CO); intent.putExtra("transactionId", transactionId); intent.putExtra("pduType", pduType); + intent.putExtra("header", header); intent.putExtra("data", pdu); mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_WAP_PUSH"); } - private void dispatchWapPdu_MMS(byte[] pdu, int transactionId, int pduType, int dataIndex) { - byte[] data; - - data = new byte[pdu.length - dataIndex]; + private void dispatchWapPdu_MMS(byte[] pdu, int transactionId, int pduType, + int headerStartIndex, int headerLength) { + byte[] header = new byte[headerLength]; + System.arraycopy(pdu, headerStartIndex, header, 0, header.length); + int dataIndex = headerStartIndex + headerLength; + byte[] data = new byte[pdu.length - dataIndex]; System.arraycopy(pdu, dataIndex, data, 0, data.length); Intent intent = new Intent(Intents.WAP_PUSH_RECEIVED_ACTION); intent.setType(WspTypeDecoder.CONTENT_MIME_TYPE_B_MMS); intent.putExtra("transactionId", transactionId); intent.putExtra("pduType", pduType); + intent.putExtra("header", header); intent.putExtra("data", data); mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_MMS");