wifisettings部分就不说了,从wificontroller开始:
1.WifiController: 接收到CMD_WIFI_TOGGLED,调用transitionTo(mDeviceActiveState)切换状态->DeviceActiveState::mWifiStateMachinePrime.enterClientMode()
2.WifiStateMachinePrime: changeMode(ModeStateMachine.CMD_START_CLIENT_MODE)->ModeStateMachine::ClientModeActiveState::enter::mManager.start()
3.ClientModeManager: mStateMachine.sendMessage(ClientModeStateMachine.CMD_START)->ClientModeStateMachine::IdleState::mWifiNative.setupInterfaceForClientMode(这里做了①startHal②startSupplicant③createStaIface创建wlan0接口④mWifiMonitor.startMonitoring)->transitionTo(mStartedState)->StartedState::processMessage::CMD_INTERFACE_STATUS_CHANGED::onUpChanged(isUp)::mWifiStateMachine.setOperationalMode(WifiStateMachine.CONNECT_MODE, mClientInterfaceName)->updateWifiState(WifiManager.WIFI_STATE_ENABLED, WifiManager.WIFI_STATE_ENABLING)
在这里发送wifi已经enabled的广播
4.WifiStateMachine: