Android 2.3发短信详细流程(4)
sendRawPdu(pdu.encodedScAddress, pdu.encodedMessage, sentIntent, deliveryIntent);
}
......
到这儿,"sendText()"这个字眼就没了,换成了另外一个方法名:sendRawPdu(),追踪这个方法可以发现它是SMSDispatcher.java的一个方法,这个类看着很眼熟吧?不错,在第四阶段我们已经和它打过交道了!我们来看看它的sendRawPdu到底是干嘛的:view plaincopy to clipboardprint?protected void sendRawPdu(byte[] smsc, byte[] pdu, PendingIntent sentIntent,
PendingIntent deliveryIntent) {
......
sendSms(tracker);
.....
}
protected void sendRawPdu(byte[] smsc, byte[] pdu, PendingIntent sentIntent,
PendingIntent deliveryIntent) {
......
sendSms(tracker);
.....
}又来了一个新方法名:sendSms(),从sendRawPdu()传来的信息经过封装传递给sendSms()方法进行处理,而在SMSDispatcher.java中,这个方法只是声明了一下,它的具体实现由子类:GsmSMSDispatcher.java完成。下面我们来看GsmSMSDispatcher.java
7. 第六阶段:GsmSMSDispatcher.java(frameworks/base/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java)
GsmSMSDispatcher.java的sendSms()方法核心代码如下:
view plaincopy to clipboardprint?protected CommandsInterface mCm;
protected void sendSms(SmsTracker tracker) {
HashMap map = tracker.mData;
byte smsc[] = (byte[]) map.get("smsc");
byte pdu[] = (byte[]) map.get("pdu");
Message reply = obtainMessage(EVENT_SEND_SMS_COMPLETE, tracker);
mCm.sendSMS(IccUtils.bytesToHexString(smsc),
IccUtils.bytesToHexString(pdu), reply);
}
protected CommandsInterface mCm;
protected void sendSms(SmsTracker tracker) {
HashMap map = tracker.mData;
byte smsc[] = (byte[]) map.get("smsc");
byte pdu[] = (byte[]) map.get("pdu");
Message reply = obtainMessage(EVENT_SEND_SMS_COMPLETE, tracker);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>