1.processMessagePart
frameworks\opt\telephony\src\java\com\android\internal\telephony\InboundSmsHandler.java
private boolean processMessagePart(InboundSmsTracker tracker) {
if (destPort == SmsHeader.PORT_WAP_PUSH) { //彩信通知
// Build up the data stream
ByteArrayOutputStream output = new ByteArrayOutputStream();
for (byte[] pdu : pdus) {
// 3GPP needs to extract the User Data from the PDU; 3GPP2 has already done this
if (!tracker.is3gpp2()) {
SmsMessage msg = SmsMessage.createFromPdu(pdu, SmsConstants.FORMAT_3GPP);
if (msg != null) {
pdu = msg.getUserData();
} else {
loge("processMessagePart: SmsMessage.createFromPdu returned null");
return false;
}
}
output.write(pdu, 0, pdu.length);
}
int result = mWapPush.dispatchWapPdu(output.toByteArray(), resultReceiver, this); //往應用層拋
if (DBG) log("dispatchWapPdu() returned " + result);
// result is Activity.RESULT_OK if an ordered broadcast was sent
if (result == Activity.RESULT_OK) {
return true;
} else {
deleteFromRawTable(tracker.getDeleteWhere(), tracker.getDeleteWhereArgs(), MARK_DELETED);
return false;
}
}
}
2.dispatchWapPdu
frameworks\opt\telephony\src\java\com\android\internal\telephony\WapPushOverSms.java
public int dispatchWapPdu(byte[] pdu, BroadcastReceiver receiver, InboundSmsHandler handler) {
Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION);
intent.setType(result.mimeType);
intent.putExtra("transactionId", result.transactionId);
intent.putExtra("pduType", result.pduType);
intent.putExtra("header", result.header);
intent.putExtra("data", result.intentData);
intent.putExtra("contentTypeParameters", result.contentTypeParameters);
SubscriptionManager.putPhoneIdAndSubIdExtra(intent, result.phoneId);
handler.dispatchIntent(intent, getPermissionForType(result.mimeType),
getAppOpsPermissionForIntent(result.mimeType), options, receiver,
UserHandle.SYSTEM);
return Activity.RESULT_OK;
}
3.dispatchIntent
frameworks\opt\telephony\src\java\com\android\internal\telephony\InboundSmsHandler.java
public void dispatchIntent(Intent intent, String permission, int appOp,
Bundle opts, BroadcastReceiver resultReceiver, UserHandle user) {
mContext.sendOrderedBroadcastAsUser(intent, user, permission, appOp, opts,
resultReceiver, getHandler(), Activity.RESULT_OK, null, null);
}