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/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/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/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 China's National Standard for WLAN-GB 15629.11, and is compatible with 802.11i. In Android, you only need to add corresponding authentication.