Android RIL源码分析(3)

第三部分, 流程分析

1.Outgoing Call流程。

v
TwelveKeyDialer.java

|_onKeyUp()

|_placeCall()

v
OutgoingCallBroadcaster.java,

|_onCreate()

|_sendOrderedBroadcast(broadcastIntent, PERMISSION,

new OutgoingCallReceiver(), null, Activity.RESULT_OK, number,null);


|_
OutgoingCallReceiver


|_onReceive()

|_ doReceive()

|_context.startActivity(newIntent);

v
InCallScreen.java

|_ onCreate()

|_onNewIntent()

|_placeCall()

v
PhoneUtils.java

|_placeCall()

v
GSMPhone.java,

|_dial()

v
GsmCallTracker.java,

|_dial()

v
RIL.java

|_dial()

|_
RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);


|...


|send(rr);

2.
Incoming Call的流程:

v
创建GsmPhone时,mCT = new GsmCallTracker(this);

v
创建GsmCallTracker时:

Ø
cm.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE,null);

Ø
mCallStateRegistrants.add(r);

v
RIL中的RILReceiver线程首先读取从rild中传来的数据:

Ø
processResponse()

Ø
processUnsolicited()

v
对应于incoming call,RIL收到RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED消息,触发mCallStateRegistrants中的所有记录。

v
GsmCallTracker处理EVENT_CALL_STATE_CHANGE,调用pollCallsWhenSafe

v
函数pllCallsWhenSafe 处理:

§
lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);

§
cm.getCurrentCalls(lastRelevantPoll);

v
RIL::getCurrentCalls

§
RILRequestrr = RILRequest.obtain(RIL_REQUEST_GET_CURRENT_CALLS,result);

§
...

§
send(rr);

v
接着RIL调用processSolicited处理RIL_REQUEST_GET_CURRENT_CALLS的返回结果

v
GsmCallTracker的handleMessage被触发,处理事件EVENT_POLL_CALLS_RESULT,调用函数 handlePollCalls

v
handlPollCalls 调用phone.notifyNewRingingConnection(newRinging);

v
PhoneApp中创建CallNotifier

v
CallNotifier注册:

§
registerForNewRingingConnection ->mNewRingingConnectionRegistrants.addUnique(h, what, obj);

你可能感兴趣的:(android,null)