Android 2.3发短信详细流程(5)
mCm.sendSMS(IccUtils.bytesToHexString(smsc),
IccUtils.bytesToHexString(pdu), reply);
}离成功已经不远了....
我们知道,CommandsInterface是一个特殊的接口,它的RIL.java息息相关,而在上面的代码中sendSms()调用来CommandsInterface对象的sendSMS()方法来做事情,而CommandsIterface是一个接口,所以事情只好由它的儿子(其实是孙子,RIL的爸爸BaseCommands是CommandsInterface的儿子)来完成,好,进入RIL.java.
8. 第七阶段:RIL.java(/frameworks/base/telephony/java/com/android/internal/telephony/RIL.java)
只要研究过ril层的,对这玩意都一定很熟悉,所以直接看它的sendSMS()方法:
view plaincopy to clipboardprint?public void sendSMS (String smscPDU, String pdu, Message result) {
RILRequest rr
= RILRequest.obtain(RIL_REQUEST_SEND_SMS, result);
rr.mp.writeInt(2);
rr.mp.writeString(smscPDU);
rr.mp.writeString(pdu);
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
//send(RILRequest rr)
<pre name="code" class="java">private void
send(RILRequest rr) {
Message msg;
msg = mSender.obtainMessage(EVENT_SEND, rr);
acquireWakeLock();
msg.sendToTarget();
}
public void sendSMS (String smscPDU, String pdu, Message result) {
RILRequest rr
= RILRequest.obtain(RIL_REQUEST_SEND_SMS, result);
rr.mp.writeInt(2);
rr.mp.writeString(smscPDU);
rr.mp.writeString(pdu);
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
//send(RILRequest rr)
<pre name="code" class="java">private void
send(RILRequest rr) {
相关新闻>>
- 发表评论
-
- 最新评论 更多>>