上层:
packages/apps/settings/WifiSettings.java
packages/apps/settings/WifiEnabler.java
Framework层:
frameworks/base/wifi/java/android/net/wifi/WifiManager.java
frameworks/base/wifi/java/android/net/wifi/IWifiManager.aidl
Native:
frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiSeviceImpl.java
frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiController.java(状态机)
frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiStateMachinePrime.java(状态机,仅3状态)
frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiService.java
调用:publishBinderService(Context.WIFI_SERVICE, mImpl);
frameworks/base/services/core/java/com/android/server/SystemService.java
frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeManager.java
frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiNative.java
启动Hal:startHal()
启动supplicant:startSupplicant()
加载驱动(loadDriver):setupInterfaceForClientMode()
启动WifiMonitor:WifiMonitor.startMonitoring()
WifiMonitor.startMonitoring():这一步主要是在WifiMonitor中建立与wpa_supplicant通信的socket通道、创建一个线程接收底层事件并分发处理。这里会创建两个socket通道与wpa_s通信,一个用于下发指令,另一个用于接收事件。成功后WifiMonitor会向WifiStateMachine发送一个代表socket通信建立成功的消息:SUP_CONNECTION_EVENT;收到这个消息就表示Wifi已经启动成功了。
见:weixin_42093428/article/details/80822632
文|力卉编程
网友评论