1.这里是从log中通过搜索关键字wpa_supplicant: wlan0: State过滤之后的log:
Line 1: 11-25 20:10:14.968120 1104 1104 D wpa_supplicant: wlan0: State: COMPLETED -> ASSOCIATING//从连接状态,配对
Line 2: 11-25 20:10:15.147982 1104 1104 D wpa_supplicant: wlan0: State: ASSOCIATING -> DISCONNECTED//配对失败,断开连接
Line 3: 11-25 20:10:15.149809 1104 1104 D wpa_supplicant: wlan0: State: DISCONNECTED -> DISCONNECTED
Line 4: 11-25 20:10:15.150663 1104 1104 D wpa_supplicant: wlan0: State: DISCONNECTED -> SCANNING//断开连接,扫描网络
Line 5: 11-25 20:10:16.264344 1104 1104 D wpa_supplicant: wlan0: State: SCANNING -> ASSOCIATING//扫描网络,配对
Line 6: 11-25 20:10:16.490507 1104 1104 D wpa_supplicant: wlan0: State: ASSOCIATING -> DISCONNECTED//配对失败,断开连接
Line 7: 11-25 20:10:16.490851 1104 1104 D wpa_supplicant: wlan0: State: DISCONNECTED -> DISCONNECTED//断开连接
Line 8: 11-25 20:10:16.491079 1104 1104 D wpa_supplicant: wlan0: State: DISCONNECTED -> SCANNING//断开连接,重新扫描
Line 9: 11-25 20:10:17.640759 1104 1104 D wpa_supplicant: wlan0: State: SCANNING -> ASSOCIATING//扫描网络,重新配对
Line 10: 11-25 20:10:17.660149 1104 1104 D wpa_supplicant: wlan0: State: ASSOCIATING -> ASSOCIATED//重新配对,配对成功
Line 11: 11-25 20:10:17.661741 1104 1104 D wpa_supplicant: wlan0: State: ASSOCIATED -> 4WAY_HANDSHAKE//四次握手
Line 12: 11-25 20:10:18.660734 1104 1104 D wpa_supplicant: wlan0: State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE
Line 13: 11-25 20:10:18.673596 1104 1104 D wpa_supplicant: wlan0: State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE
Line 14: 11-25 20:10:18.674133 1104 1104 D wpa_supplicant: wlan0: State: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE
Line 15: 11-25 20:10:18.674501 1104 1104 D wpa_supplicant: wlan0: State: GROUP_HANDSHAKE -> COMPLETED//建立连接
也就是说1~8行我们可以理解为当前状态处于断开状态,第9~15行为从扫描到匹配,再到四次握手,最后连接成功。
2.这里从log中搜索关键字rssi过滤时候的log:
11-26 19:54:08.700871: D/WifiHW(809): leave --> reply=RSSI=-73
11-26 19:54:08.701265: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-73, newLinkSpeed:81, SSID:"11-04-701-2"
11-26 19:54:08.701335: E/WifiManager(809): calculateSignalLevel rssi:-73,numLevels:5,signalLevel:3
11-26 19:54:09.162510: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:09.172199: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:11.718324: D/WifiHW(809): leave --> reply=RSSI=-73
11-26 19:54:11.718702: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-73, newLinkSpeed:81, SSID:"11-04-701-2"
11-26 19:54:11.718773: E/WifiManager(809): calculateSignalLevel rssi:-73,numLevels:5,signalLevel:3
11-26 19:54:12.734200: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:14.722926: D/WifiHW(809): leave --> reply=RSSI=-66
11-26 19:54:14.723305: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-66, newLinkSpeed:135, SSID:"11-04-701-2"
11-26 19:54:14.723381: E/WifiManager(809): calculateSignalLevel rssi:-66,numLevels:5,signalLevel:3
11-26 19:54:14.851915: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:17.748482: D/WifiHW(809): leave --> reply=RSSI=-66
11-26 19:54:17.748870: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-66, newLinkSpeed:135, SSID:"11-04-701-2"
11-26 19:54:17.748962: E/WifiManager(809): calculateSignalLevel rssi:-66,numLevels:5,signalLevel:3
11-26 19:54:20.768479: D/WifiHW(809): leave --> reply=RSSI=-67
11-26 19:54:20.768923: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-67, newLinkSpeed:135, SSID:"11-04-701-2"
11-26 19:54:20.769008: E/WifiManager(809): calculateSignalLevel rssi:-67,numLevels:5,signalLevel:3
11-26 19:54:22.144824: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:23.771013: D/WifiHW(809): leave --> reply=RSSI=-67
11-26 19:54:23.771282: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-67, newLinkSpeed:135, SSID:"11-04-701-2"
11-26 19:54:23.771329: E/WifiManager(809): calculateSignalLevel rssi:-67,numLevels:5,signalLevel:3
11-26 19:54:24.255851: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:25.461048: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.461189: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.502412: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.502584: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.506683: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.507044: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.512010: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.512126: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.689530: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.689664: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.692669: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.692794: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.701451: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.701609: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.705994: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.706128: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.712247: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.712395: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.720826: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.720943: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.723849: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.723980: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:25.731212: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:25.731402: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:26.003017: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:26.003117: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:26.008034: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:26.008168: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:26.016209: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:26.016420: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:26.018635: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:26.018742: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:54:26.772879: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:26.773185: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-81, newLinkSpeed:54, SSID:"11-4-701"
11-26 19:54:26.773256: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:26.774126: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:26.774210: D/WifiWatchdogStateMachine(809): RSSI current: 3 new: -81, 2
11-26 19:54:26.774345: D/StatusBar.NetworkController(919): onReceive, intent action = android.net.wifi.RSSI_CHANGED
11-26 19:54:26.774464: E/WifiManager(919): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:26.774506: D/StatusBar.NetworkController(919): updateWifiState: mWifiLevel = 2 mWifiRssi=-81 mWifiConnected is true
11-26 19:54:29.779139: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:29.779601: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-81, newLinkSpeed:54, SSID:"11-4-701"
11-26 19:54:29.779725: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:31.570899: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:32.784597: D/WifiHW(809): leave --> reply=RSSI=-83
11-26 19:54:32.784891: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-83, newLinkSpeed:27, SSID:"11-4-701"
11-26 19:54:32.784959: E/WifiManager(809): calculateSignalLevel rssi:-83,numLevels:5,signalLevel:1
11-26 19:54:32.785818: E/WifiManager(809): calculateSignalLevel rssi:-83,numLevels:5,signalLevel:1
11-26 19:54:32.785893: D/WifiWatchdogStateMachine(809): RSSI current: 2 new: -83, 1
11-26 19:54:32.786174: D/StatusBar.NetworkController(919): onReceive, intent action = android.net.wifi.RSSI_CHANGED
11-26 19:54:32.786257: E/WifiManager(919): calculateSignalLevel rssi:-83,numLevels:5,signalLevel:1
11-26 19:54:32.786296: D/StatusBar.NetworkController(919): updateWifiState: mWifiLevel = 1 mWifiRssi=-83 mWifiConnected is true
11-26 19:54:35.787114: D/WifiHW(809): leave --> reply=RSSI=-83
11-26 19:54:35.787387: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-83, newLinkSpeed:27, SSID:"11-4-701"
11-26 19:54:35.787479: E/WifiManager(809): calculateSignalLevel rssi:-83,numLevels:5,signalLevel:1
11-26 19:54:38.789561: D/WifiHW(809): leave --> reply=RSSI=-83
11-26 19:54:38.789843: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-83, newLinkSpeed:13, SSID:"11-4-701"
11-26 19:54:38.789912: E/WifiManager(809): calculateSignalLevel rssi:-83,numLevels:5,signalLevel:1
11-26 19:54:40.979140: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:41.807662: D/WifiHW(809): leave --> reply=RSSI=-83
11-26 19:54:41.807996: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-83, newLinkSpeed:13, SSID:"11-4-701"
11-26 19:54:41.808087: E/WifiManager(809): calculateSignalLevel rssi:-83,numLevels:5,signalLevel:1
11-26 19:54:43.085509: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:44.831510: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:44.831993: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-84, newLinkSpeed:13, SSID:"11-4-701"
11-26 19:54:44.832119: E/WifiManager(809): calculateSignalLevel rssi:-84,numLevels:5,signalLevel:1
11-26 19:54:46.428142: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:46.428356: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:47.848676: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:47.848951: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-84, newLinkSpeed:13, SSID:"11-4-701"
11-26 19:54:47.849047: E/WifiManager(809): calculateSignalLevel rssi:-84,numLevels:5,signalLevel:1
11-26 19:54:50.395173: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:54:50.868477: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:50.868742: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-84, newLinkSpeed:13, SSID:"11-4-701"
11-26 19:54:50.868785: E/WifiManager(809): calculateSignalLevel rssi:-84,numLevels:5,signalLevel:1
11-26 19:54:51.048190: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.048412: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.056166: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.056304: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.063571: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.063718: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.088187: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.088329: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.092893: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.093022: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.568120: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.568268: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.573064: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.573182: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.582558: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.582692: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:51.584831: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:51.584952: I/WifiStateMachine(809): fetchRssiNative, newRssi:-84
11-26 19:54:53.888146: D/WifiHW(809): leave --> reply=RSSI=-84
11-26 19:54:53.888545: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-84, newLinkSpeed:13, SSID:"11-4-701"
11-26 19:54:53.888626: E/WifiManager(809): calculateSignalLevel rssi:-84,numLevels:5,signalLevel:1
11-26 19:54:56.822526: D/StatusBar.NetworkController(919): updateWifiState: mWifiLevel = 1 mWifiRssi=-83 mWifiConnected is false
11-26 19:54:56.828461: D/StatusBar.NetworkController(919): updateWifiState: mWifiLevel = 1 mWifiRssi=-83 mWifiConnected is false
11-26 19:54:58.116329: D/StatusBar.NetworkController(919): updateWifiState: mWifiLevel = 1 mWifiRssi=-83 mWifiConnected is false
11-26 19:54:58.124940: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:58.125241: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-81, newLinkSpeed:54, SSID:"11-4-701"
11-26 19:54:58.125327: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:58.126499: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:58.126684: D/WifiWatchdogStateMachine(809): RSSI current: 1 new: -81, 2
11-26 19:54:58.143947: D/StatusBar.NetworkController(919): onReceive, intent action = android.net.wifi.RSSI_CHANGED
11-26 19:54:58.144257: E/WifiManager(919): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:54:58.144295: D/StatusBar.NetworkController(919): updateWifiState: mWifiLevel = 2 mWifiRssi=-81 mWifiConnected is false
11-26 19:54:58.146592: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:54:58.146733: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:55:00.004198: D/StatusBar.NetworkController(919): path = /data/data/com.android.systemui/rssi_report.txt
11-26 19:55:01.128538: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:55:01.128946: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-81, newLinkSpeed:54, SSID:"11-4-701"
11-26 19:55:01.129044: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:55:04.134671: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:55:04.135048: I/WifiStateMachine(809): fetchRssiAndLinkSpeedNative, newRssi:-81, newLinkSpeed:54, SSID:"11-4-701"
11-26 19:55:04.135970: E/WifiManager(809): calculateSignalLevel rssi:-81,numLevels:5,signalLevel:2
11-26 19:55:04.211568: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC;otherSsid = CMCC-AUTO
11-26 19:55:04.211790: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC-AUTO;otherSsid = CMCC
11-26 19:55:04.218408: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC;otherSsid = CMCC-AUTO
11-26 19:55:04.314868: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC;otherSsid = CMCC-AUTO
11-26 19:55:04.460730: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:55:04.460863: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:55:04.463681: D/WifiHW(809): leave --> reply=RSSI=-81
11-26 19:55:04.463811: I/WifiStateMachine(809): fetchRssiNative, newRssi:-81
11-26 19:55:04.466031: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC-AUTO;otherSsid = CMCC-AUTO
11-26 19:55:04.466127: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC;otherSsid = CMCC
11-26 19:55:04.470775: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC;otherSsid = CMCC-AUTO
11-26 19:55:04.470988: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC-AUTO;otherSsid = CMCC
11-26 19:55:04.475982: D/WifiExt(20299): WifiExt getaporder() currentSsid = CMCC;otherSsid = CMCC-AUTO
从上面的log中我们可以看到如:
11-26 19:54:53.888626: E/WifiManager(809): calculateSignalLevel rssi:-84,numLevels:5,signalLevel:1
singalLevel为当前的信号强度为1格(信号强度共为5格),而且rssi值为-84(RSSI为Received Signal Strength Indication接收的信号强度指示)。表示当前wifi信号非常微弱。