When I see so many hangup () of phoneutil, the headers are a bit dizzy. Let's just repeat it in detail.
------- Gsmo. Java ---------
Public void hangup () throws callstateexception
{
If (! Disconnected ){
Owner. hangup (this); // The owner is the gsmcalltracker object.
} Else {
Throw new callstateexception ("disconnected ");
}
}
-------- Gsmcall -------------------
Public void hangup () throws callstateexception
{
Owner. hangup (this); // The owner is the gsmcalltracker object.
}
It can be seen that the hangup () is polymorphism by gsmcalltracker, and then the commandinterface object cm. hangupconnection () must be used for hanging up. Commandinterface is originally an interface class. After RIL implement is passed, and then> A commandinterface object is created in phonefactory.
In phonefactory. Java, new phoneproxy (New gsmphone (context, scommandsinterface, sphonenotifier); phoneproxy is the proxy of cdmaphone and gsmphone. The context parameter is actually a phoneapp object.
After talking about phonefactory. makedefaltphones (this) and passing it to phonefactory, scommandsinterface is the object traced back from the RIL object. scommandsinterface = new RIL (context, networkmode, cdmasub.pdf );
In RIL. Java
Public void hangupconnection (INT gsmindex, message result ){
If (rilj_logd) riljlog ("hangupconnection: gsmindex =" + gsmindex );
Rilrequest RR = rilrequest. Obtain (ril_request_hangup, result );
If (rilj_logd)
Riljlog (RR. serialstring () + ">" + requesttostring (RR. mrequest) + "" + gsmindex );
Rr. MP. writeint (1 );
Rr. MP. writeint (gsmindex );
Send (RR );
}
After the rilsender in RIL receives the sent message, it will eventually send the hanging request through socket.
S. getoutputstream (). Write (datalength );
S. getoutputstream (). Write (data );