Android 源码阅读之建立3G网络流程

彩信是通过http协议发送数据的,因此,要先建立数据通路3G

发彩信时,会自动启动建立3G网络,不好跟代码,还是从设置中跟踪代码简单些

com.android.phone.Settings.java

onPreferenceTreeClick -> if (preference == mButtonDataEnabled) - ConnectivityManager.setMobileDataEnabled(true)

frameworks/base/core/java/android/net/ConnectivityManager.java

setMobileDataEnabled -> ConnectivityService.setMobileDataEnabled

frameworks/base/services/java/com/android/server/ConnectivityService.java

setMobileDataEnabled -> MyHandler.sendMessage[EVENT_SET_MOBILE_DATA] -> handleMessage EVENT_SET_MOBILE_DATA ->handleSetMobileData -> MobileDataStateTracker.reconnect()

frameworks/base/core/java/android/net/MobileDataStateTracker.java

reconnect -> setEnableApn -> CompositePhoneInterfaceManager.enableApnType

...

frameworks/base/telephony/java/com/android/internal/telephony/DataConnectionTracker.java

setEnabled:EVENT_ENABLE_NEW_APN -> handleMessage -> onEnableApn -> onEnableNewApn

frameworks/base/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java

onEnableNewApn() -> cleanUpConnection -> DataConnection.disconnect[EVENT_DISCONNECT_DONE] -> onDisconnectDone -> trySetupData ->setupData -> DataConnection.connect EVENT_CONNECT -> CdmaDataConnection.onConnect -> phone.mCM.setupDataCall

 

你可能感兴趣的:(android)