android 撥接流程

來源:互聯網
上載者:User

android 網路撥號流程:

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 ) 實現
->[enableApnType-> mPhone.enableApnType(type)]
{那麼這個mPhone是哪裡來的,通過原始碼我們發現在PhoneInterfaceManger的建構函式傳進去的。在PhoneApp.java 的OnCreate 函數裡建立了一個PhoneInterfaceManger對象, PhoneFactory.makeDefaultPhones(this);

phone = PhoneFactory.getDefaultPhone(); 也就是說這裡的Phone要麼是CDMAPhone 的執行個體要麼是GSMPhone 的執行個體,因為CDMAPhone extends PhoneBase,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()]
{這裡稍微解釋下, CDMAPhone ,GSMPhone 都是繼承 PhoneBase. 而DataConnectionTracker 是PhoneBase 的一個成員欄位,該對象的初始化分別是在CDMAPhone ,GSMPhone 類裡,對應CdmaDataConnectionTracker, GsmDataConnectionTracker ,因為此二類分別繼承DataConnectionTracker,所以具體是調用那個類的函數,要根據前面傳進的是CDMAPhone 或者GSMPhone ,這個流程以GSMPhone
樣本。}
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.mCM 類型為CommandsInterface,也是根據CMDAPhone 或者GSMPhone 決定的,那麼兩者都是RIL 的執行個體,RIL implements CommandsInterface , 其實是根據RIL的建構函式,根據參數int networkMode 來決定。 注意:如果是Sip 就另當別論了,那麼phone.mCM 就是通過SipPhoneBase 建構函式傳給父類PhoneBase的建構函式,參數CommandsInterface,其實現 SipCommandInterface
,因為SipPhoneBase implements Phone, SipCommandInterface implements CommandsInterface }
RIL
->[setupDataCall()]
到這裡, java層的pppd請求就通過RIL發到C層了。

所調用的架構圖:

文章轉載自:點擊開啟連結

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.