Add WSP header to WAP_PUSH_RECEIVED intent in addition to data
Import CL 146651 from //branches/cupcake_dcm
This commit is contained in:
@@ -553,7 +553,8 @@ public final class Telephony {
|
|||||||
* <li><em>transactionId (Integer)</em> - The WAP transaction
|
* <li><em>transactionId (Integer)</em> - The WAP transaction
|
||||||
* ID</li>
|
* ID</li>
|
||||||
* <li><em>pduType (Integer)</em> - The WAP PDU type</li>
|
* <li><em>pduType (Integer)</em> - The WAP PDU type</li>
|
||||||
* <li><em>data</em> - The data payload of the message</li>
|
* <li><em>header (byte[])</em> - The header of the message</li>
|
||||||
|
* <li><em>data (byte[])</em> - The data payload of the message</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p>If a BroadcastReceiver encounters an error while processing
|
* <p>If a BroadcastReceiver encounters an error while processing
|
||||||
|
|||||||
@@ -161,28 +161,31 @@ public class WapPushOverSms {
|
|||||||
}
|
}
|
||||||
index += pduDecoder.getDecodedDataLength();
|
index += pduDecoder.getDecodedDataLength();
|
||||||
|
|
||||||
int dataIndex = headerStartIndex + headerLength;
|
|
||||||
boolean dispatchedByApplication = false;
|
boolean dispatchedByApplication = false;
|
||||||
switch (binaryContentType) {
|
switch (binaryContentType) {
|
||||||
case WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO:
|
case WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO:
|
||||||
dispatchWapPdu_PushCO(pdu, transactionId, pduType);
|
dispatchWapPdu_PushCO(pdu, transactionId, pduType, headerStartIndex, headerLength);
|
||||||
dispatchedByApplication = true;
|
dispatchedByApplication = true;
|
||||||
break;
|
break;
|
||||||
case WspTypeDecoder.CONTENT_TYPE_B_MMS:
|
case WspTypeDecoder.CONTENT_TYPE_B_MMS:
|
||||||
dispatchWapPdu_MMS(pdu, transactionId, pduType, dataIndex);
|
dispatchWapPdu_MMS(pdu, transactionId, pduType, headerStartIndex, headerLength);
|
||||||
dispatchedByApplication = true;
|
dispatchedByApplication = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dispatchedByApplication == false) {
|
if (dispatchedByApplication == false) {
|
||||||
dispatchWapPdu_default(pdu, transactionId, pduType, mimeType, dataIndex);
|
dispatchWapPdu_default(pdu, transactionId, pduType, mimeType,
|
||||||
|
headerStartIndex, headerLength);
|
||||||
}
|
}
|
||||||
return Activity.RESULT_OK;
|
return Activity.RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispatchWapPdu_default(
|
private void dispatchWapPdu_default(byte[] pdu, int transactionId, int pduType,
|
||||||
byte[] pdu, int transactionId, int pduType, String mimeType, int dataIndex) {
|
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;
|
byte[] data;
|
||||||
|
|
||||||
data = new byte[pdu.length - dataIndex];
|
data = new byte[pdu.length - dataIndex];
|
||||||
@@ -192,31 +195,40 @@ public class WapPushOverSms {
|
|||||||
intent.setType(mimeType);
|
intent.setType(mimeType);
|
||||||
intent.putExtra("transactionId", transactionId);
|
intent.putExtra("transactionId", transactionId);
|
||||||
intent.putExtra("pduType", pduType);
|
intent.putExtra("pduType", pduType);
|
||||||
|
intent.putExtra("header", header);
|
||||||
intent.putExtra("data", data);
|
intent.putExtra("data", data);
|
||||||
|
|
||||||
mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_WAP_PUSH");
|
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 intent = new Intent(Intents.WAP_PUSH_RECEIVED_ACTION);
|
||||||
intent.setType(WspTypeDecoder.CONTENT_MIME_TYPE_B_PUSH_CO);
|
intent.setType(WspTypeDecoder.CONTENT_MIME_TYPE_B_PUSH_CO);
|
||||||
intent.putExtra("transactionId", transactionId);
|
intent.putExtra("transactionId", transactionId);
|
||||||
intent.putExtra("pduType", pduType);
|
intent.putExtra("pduType", pduType);
|
||||||
|
intent.putExtra("header", header);
|
||||||
intent.putExtra("data", pdu);
|
intent.putExtra("data", pdu);
|
||||||
|
|
||||||
mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_WAP_PUSH");
|
mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_WAP_PUSH");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispatchWapPdu_MMS(byte[] pdu, int transactionId, int pduType, int dataIndex) {
|
private void dispatchWapPdu_MMS(byte[] pdu, int transactionId, int pduType,
|
||||||
byte[] data;
|
int headerStartIndex, int headerLength) {
|
||||||
|
byte[] header = new byte[headerLength];
|
||||||
data = new byte[pdu.length - dataIndex];
|
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);
|
System.arraycopy(pdu, dataIndex, data, 0, data.length);
|
||||||
|
|
||||||
Intent intent = new Intent(Intents.WAP_PUSH_RECEIVED_ACTION);
|
Intent intent = new Intent(Intents.WAP_PUSH_RECEIVED_ACTION);
|
||||||
intent.setType(WspTypeDecoder.CONTENT_MIME_TYPE_B_MMS);
|
intent.setType(WspTypeDecoder.CONTENT_MIME_TYPE_B_MMS);
|
||||||
intent.putExtra("transactionId", transactionId);
|
intent.putExtra("transactionId", transactionId);
|
||||||
intent.putExtra("pduType", pduType);
|
intent.putExtra("pduType", pduType);
|
||||||
|
intent.putExtra("header", header);
|
||||||
intent.putExtra("data", data);
|
intent.putExtra("data", data);
|
||||||
|
|
||||||
mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_MMS");
|
mSmsDispatcher.dispatch(intent, "android.permission.RECEIVE_MMS");
|
||||||
|
|||||||
Reference in New Issue
Block a user