概述
Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92
当Setting选项中打开Wifi时, 调用流程如下,入口主要是setWifiEnabled()函数.
onSwitchChanged -> WifiEnabler.java settings apk中.
mWifiManager.setWifiEnabled ->setWifiEnabled -> WifiManager.java
mService.setWifiEnabled ->
setWifiEnabled -> WifiServiceImpl.java
mSettingsStore.handleWifiToggled WifiSettingsStore.java //检查airplaymode下是否能打开wifi
mWifiController.sendMessage(CMD_WIFI_TOGGLED);
processMessage -> WifiController.java //ApStaDisabledState类
transitionTo(mDeviceActiveState); ->
enter //StaEnabledState类(ApStaDisabledState的父类)
mWifiStateMachine.setSupplicantRunning -> StaEnabledState
setSupplicantRunning WifiStateMachine.java
sendMessage(CMD_START_SUPPLICANT); ->
enter -> DeviceActiveState类
mWifiStateMachine.setOperationalMode(WifiStateMachine.CONNECT_MODE) ->
sendMessage(CMD_SET_OPERATIONAL_MODE, mode, 0)
mWifiStateMachine.setDriverStart(true) ->
sendMessage(CMD_START_DRIVER)
processMessage -> InitialState类
mWifiNative.loadDriver //wifi驱动在开机已经加载完成,这里不做处理。
mNwService.wifiFirmwareReload //wifi固件在开机已经加载完成,这里不做处理。
mNwService.setInterfaceDown(mInterfaceName); //关闭网卡,设置interfaceDriverStartedState
WifiNative.startHal
startHalNative
new MonitorThread //接收来自WPS的消息
mWifiNative.startSupplicant //开启supplicantmWifiMonitor.startMonitoring -> //创建两个socket和wps交互
mWifiNative.connectToSupplicant
m.mStateMachine.sendMessage(SUP_CONNECTION_EVENT);
MonitorThread(mWifiNative, this).start ->
run -> WifiMonitor.java
mWifiNative.waitForEvent //收取wps发上来的event
mWifiMonitorSingleton.dispatchEvent
transitionTo(mSupplicantStartingState) ->
processMessage -> SupplicantStartingState类,上面发送了SUP_CONNECTION_EVENT
mWifiInfo.setMacAddress
setFrequencyBand
mWifiNative.enableSaveConfig ->
doBooleanCommand //发送命令给wps
mWifiConfigStore.loadAndEnableAllNetworks ->
loadAndEnableAllNetworks -> WifiConfigStore.java
mWifiNative.listNetworks
readNetworkVariables
enableAllNetworks
transitionTo(mDriverStartedState) ->
enter -> SupplicantStartedState类(DriverStartedState的父类)
mWifiNative.enableAutoConnect
enter -> DriverStartedState类
transitionTo(mDisconnectedState) ->
enter -> DisconnectedState类
startScan
processMessage -> //这时前面的下一条消息CMD_SET_OPERATIONAL_MODE会被处理
processMessage -> 处理最后之后的一条消息CMD_START_DRIVER
最后
以上就是优雅热狗为你收集整理的[RK3288][Android6.0] WiFi在Setting中的开启过程小结的全部内容,希望文章能够帮你解决[RK3288][Android6.0] WiFi在Setting中的开启过程小结所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复