Android Network dialing process:
Frameworks \ base \ Services \ Java \ com \ Android \ Server \ connectivityservice. Java
-> [Myhandler-> handlemessage-> case event_set_mobile_data-> handlesetmobiledata]
Frameworks \ base \ Services \ Java \ com \ Android \ Server \ connectivityservice. Java
-> [Mnettrackers [connectivitymanager. type_mobile]. Reconnect ()]
Frameworks/base/CORE/Java/Android/NET/mobiledatastatetracker. Java
Extends networkstatetracker
-> [Reconnect ()]
Frameworks/base/CORE/Java/Android/NET/mobiledatastatetracker. Java
-> [Setenableapn]
.. \ Base \ telephony \ Java \ com \ Android \ internal \ telephony \ itelephony. Java
-> [Enableapntype]
Packages \ apps \ phone \ SRC \ com \ Android \ phone \
Phoneinterfacemanager. Java (extends itelephony. stub) Implementation
-> [Enableapntype-> mphone. enableapntype (type)]
{Where does this mphone come from? Through the source code, we can find that the phoneinterfacemanger constructor is passed in. Create a phoneinterfacemanger object in the oncreate function of phoneapp. Java, phonefactory. makedefaphphones (this );
Phone = phonefactory. getdefaultphone (); that is to say, the phone here is either a cdmaphone instance or a gsm phone instance, because cdmaphone extends phonebase and gsmphone extends phonebase .}
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \
Phonebase. Java extends handler implements phone
-> [Enableapntype]
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \
Dataconnectiontracker. Java
-> [Enableapntype ()-> setenabled ()-> handlemessage-> case event_enable_new_apn-> onenableapn ()]
{Here, we will explain that both cdmaphone and gsmphone inherit phonebase. dataconnectiontracker is a member field of phonebase. The initialization of this object is in the cdmaphone and gsmphone classes respectively, corresponding to the CDMA dataconnectiontracker and gsmdataconnectiontracker, because these two classes inherit the dataconnectiontracker, respectively, therefore, we need to call the function of that class according to the previous information about cdmaphone or gsmphone.
Example .}
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \ GSM \
Gsmdataconnectiontracker. Java extends dataconnectiontracker
-> [Onenablenewapn ()-> cleanupconnection ()-> conn. Disconnect (obtainmessage (event_disconnect_done, reason)]
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \
Dataconnectiontracker. Java
-> [Handlemessage-> case event_disconnect_done-> ondisconnectdone ()]
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \ GSM \
Gsmdataconnectiontracker. Java
-> [Ondisconnectdone ()-> trysetupdata (reason)-> setupdata (reason)]
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \
Dataconnection. Java
-> [Processmessage-> case event_connect-> onconnect (CP)]
Frameworks \ base \ telephony \ Java \ com \ Android \ internal \ telephony \ GSM \
Gsmdataconnection. Java
-> [Phone. mcm. setupdatacall ()]
{Phone. the MCM type is commandsinterface, which is determined based on javasaphone or gsmphone. The two are RIL instances. RIL implements commandsinterface is determined by the RIL constructor according to the networkint mode parameter. NOTE: If it is sip, the phone. MCM is passed to the phonebase constructor of the parent class through the sipphonebase constructor. The commandsinterface parameter is used to implement the sipcommandinterface.
Because sipphonebase implements phone, sipcommandinterface implements commandsinterface}
RIL
-> [Setupdatacall ()]
Here, the pppd request of the Java layer is sent to the C layer through RIL.
Framework diagram called:
Post reposted from: Click to open the link