1.Ril.java
class RILReceiver implements Runnable{
......
processResponse(p);}
private void processResponse (Parcel p) {
if (type == RESPONSE_UNSOLICITED) {
processUnsolicited (p);}}
private void processUnsolicited (Parcel p) {
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: ret = responseVoid(p); break;
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
if (RILJ_LOGD) unsljLog(response);
mCallStateRegistrants
.notifyRegistrants(new AsyncResult(null, null, null));
break;
2.BaseCommands.java
protected RegistrantList mCallStateRegistrants = new RegistrantList();
public void registerForCallStateChanged(Handler h, int what, Object obj) {
Registrant r = new Registrant (h, what, obj);
mCallStateRegistrants.add(r);
}
3.GsmCallTracker.java
cm.registerForCallStateChanged(this, EVENT_CALL_STATE_CHANGE, null);
case EVENT_CALL_STATE_CHANGE:
pollCallsWhenSafe();
break;
4.CallTracker.java
protected void pollCallsWhenSafe() {
needsPoll = true;
if (checkNoOperationsPending()) {
lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
cm.getCurrentCalls(lastRelevantPoll);
}
}
5.RIL.java
public void getCurrentCalls (Message result) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_CURRENT_CALLS, result);
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
private void send(RILRequest rr) {
Message msg;
if (mSocket == null) {
rr.onError(RADIO_NOT_AVAILABLE, null);
rr.release();
return;
}
msg = mSender.obtainMessage(EVENT_SEND, rr);
acquireWakeLock();
msg.sendToTarget();
}
int type;
type = p.readInt();
if (type == RESPONSE_UNSOLICITED) {
processUnsolicited (p);
} else if (type == RESPONSE_SOLICITED) {
processSolicited (p);
}
releaseWakeLockIfDone();
}
private void processSolicited (Parcel p) {
case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break;
AsyncResult.forMessage(rr.mResult, ret, null);
rr.mResult.sendToTarget();
}
6.GsmCallTracker.java
public void handleMessage (Message msg) {
AsyncResult ar;
switch (msg.what) {
case EVENT_POLL_CALLS_RESULT:
ar = (AsyncResult)msg.obj;
if (msg == lastRelevantPoll) {
if (DBG_POLL) log(
"handle EVENT_POLL_CALL_RESULT: set needsPoll=F");
needsPoll = false;
lastRelevantPoll = null;
handlePollCalls((AsyncResult)msg.obj);
}
break;
protected void handlePollCalls(AsyncResult ar) {
if (newRinging != null) {
phone.notifyNewRingingConnection(newRinging);
}
7.GSMPhone.java
/*package*/ void notifyNewRingingConnection(Connection c) {
/* we'd love it if this was package-scoped*/
super.notifyNewRingingConnectionP(c);
}
8.PhoneBase.java
protected void notifyNewRingingConnectionP(Connection cn) {
if (!mIsVoiceCapable)
return;
AsyncResult ar = new AsyncResult(null, cn, null);
mNewRingingConnectionRegistrants.notifyRegistrants(ar);
}
= new RegistrantList();
public void registerForNewRingingConnection(
Handler h, int what, Object obj) {
checkCorrectThread(h);
mNewRingingConnectionRegistrants.addUnique(h, what, obj);
}
9.CallNotifier.java
private void registerForNotifications() {
mCM.registerForNewRingingConnection(this, PHONE_NEW_RINGING_CONNECTION, null);
public void handleMessage(Message msg) {
switch (msg.what) {
case PHONE_NEW_RINGING_CONNECTION:
log("RINGING... (new)");
onNewRingingConnection((AsyncResult) msg.obj);
mSilentRingerRequested = false;
break;
private void onNewRingingConnection(AsyncResult r) {
startIncomingCallQuery(c);;
private void startIncomingCallQuery(Connection c) {
mRinger.ring(); showIncomingCall();