WifiService: Implements the IWifiManager 3rd party API. The API and the device state information (screen on/off, battery state, sleep policy) go as input into the WifiController which tracks high level states as to whether STA or AP mode is operational and controls the WifiStateMachine to handle and shut down.
实现IWifiManager第三方API。API和设备信息(比如屏幕亮/暗,电量状态,睡眠方案)作为WifiController的输入。WifiController跟踪高级别状态(STA或者AP模式是否可用)
并且控制WifiStateMachine去操控
WifiController: Acts as a controller to the WifiStateMachine based on various inputs (API and device state). Runs on the same thread created in WifiService.
基于各种API和设备状态的输入,充当WifiStateMachine的控制器。和WifiService运行在同一个线程
WifiSettingsStore: Tracks the various settings (wifi toggle, airplane toggle, tethering toggle, scan mode toggle) and provides API to figure if wifi should be turned on or off.
跟踪各种用户设置(wifi,飞行模式,网络分享,扫描模式的切换),并将这些设置提供给API,去计算出wifi需要开还是关 Tethering,意指通過智能手機或平板電腦等行動裝置,將它的上網功能分享給其他裝置使用的功能。中文尚未有合適譯名,有人譯為Internet 共享、網絡共享、以手機作為數據機、手機帶動電腦上網、共用上網、继流联等。
如果是以WiFi進行分享,通常稱為行動熱點(Mobile Hotspot)。
WifiTrafficPoller: Polls traffic on wifi and notifies apps listening on it.
wifi传输量轮询:轮询wifi传输量,通知监听传输量的app
WifiNotificationController: Controls whether the open network notification is displayed or not based on the scan results.
控制 wifi扫描结果中的开放网络是否通过nodification通知给用户
WifiStateMachine: Tracks the various states on STA and AP connectivity and handles
跟踪STA和AP连接的各种状态。控制开启和关闭
Feature description:
Scan-only mode with Wi-Fi turned off:
- Setup wizard opts user into allowing scanning for improved location. We show no further dialogs in setup wizard since the user has just opted into the feature. This is the reason WifiService listens to DEVICE_PROVISIONED setting.
- Once the user has his device provisioned, turning off Wi-Fi from settings or from a third party app will show up a dialog reminding the user that scan mode will be on even though Wi-Fi is being turned off. The user has the choice to turn this notification off.
- In the scan mode, the device continues to allow scanning from any app with Wi-Fi turned off. This is done by disabling all networks and allowing only scans to be passed.