As we all know, Android is based on the Linux kernel, so it directly supports the Linux WLAN interface. The kernel driver of WLAN is dynamically loaded based on user settings on the UI. the control and security of WLAN are achieved through ctrl_interface and openssl, and TCPIP is implemented based on WLAN standards.
The architecture of WLAN on Android is as follows:
Application Framework: base/wifi/java/android/net/wifi
WifiManager/WifiMonitor/WifiConfiguration...
Service Framework: base/services/java/com/android/server/
WifiService/WifiWatchdogService
JNI (Java Native Interface)
Jni/android_net_wifi_Wifi.cpp
HAL (Hardware Abstract Layer)
Hardware/libhardware/wifi. c
Wpa_supplicant/ctrl_interface
Kernel driver
The process for enabling WIFI on an Android phone is as follows:
1) Application Framework: WifiManager
SetWifiEnabled ()
2) Service: WifiService
SetWifiEnabled ()
HandleMessage (): MESSAGE_ENABLE_WIFI
3) JNI: android_net_wifi_Wifi.cpp:
JNINativeMethod: loadDriver
Android_net_wifi_loadDriver ()
4) HAL: hardware/libhardware/wifi. c
Wifi_load_driver ()
5) Kernel: load the Kernel driver
The WLAN search process is as follows:
1) Application Framework: WifiManager
StartScan ()
2) Service:
WifiService: startScan ()
WifiNative: scanCommand ();
3) JNI: android_net_wifi_Wifi.cpp:
JNINativeMethod: scanCommand/scanResultsCommand
Android_net_wifi_scanCommand/android_net_wifi_scanResultsCommand
4) HAL: hardware/libhardware/wifi. c
Wifi_send_command: SCAN/SCAN_RESULTS
Wpa_supplicant/driver_wext.c
Wpa_driver_wext_scan (): SIOCSIWSCAN
5) Kernel: Command for WLAN driver to process related interfaces
WAPI is the national standard for WLAN in China-GB 15629.11, and is compatible with 802.11i. To implement WAPI on Android, you only need to add corresponding authentication.