Personal hotspot function
Function: Provide wireless network access, allowing other devices to access the network.
1. Shared cellular network: The terminal acts as a wireless AP, and other portable devices are interconnected with it through the 802.11 protocol, and the network internet sharing function is realized through tethering technology. (DNS, DHCP, Firewall)
2. Share the upper-level wlan
Personal hotspot on/off
settings and systemUI call ConnectivityManager.startTethering(TETHERING_WIFI) to start
ConnectivityManager.stopTethering(TETHERING_WIFI) to close
Since the power consumption of softAp is relatively large, there is no device connection for 10 minutes, and the timer triggers to close the softAp
Personal Hotspot Configuration
WifiManager.setWifiApConfiguration(WifiConfiguration wifiConfig) Get configuration interface WifiManager.getWifiApConfiguration()
Channel selection strategy:
2.4G:1\6\11 Randomly select
5G: After excluding DFS and indoor channels, give priority to 149, if there is no 149, choose randomly
For example: setting obtains hotspot 5G available channels; framework issues country codes to obtain supported channels 5G channel; driver returns all supported channels (excluding DFS);
blacklist
The personal hotspot is currently connected to the device list, and the connected device is notified by broadcasting that there is a change.
After configuring the blacklist, the device must be disconnected.