[RK3288][Android6.0] WiFi之开机自动连接过程

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

当上一次有连接过wifi,下次开机默认wifi有打开的情况下,系统会自动连接上最佳的无线网络。
手动连接和选择最优网络前面有提过了,这里给出自动连接的流程。

流程:
processMessage -> //SupplicantStartedState, 起来后会获取scan resulut: cmd:WifiMonitor.SCAN_RESULTS_EVENT 
 setScanResults ->
 mWifiAutoJoinController.newSupplicantResults -> //attemptAutoJoin为true,设置里手动连接的时候是false
  newSupplicantResults -> WifiAutoJoinController.java
  attemptAutoJoin -> //Wifi的auto join机制
  compareWifiConfigurations //如果之前有连过多个无线网络,会根据评分规则以及用户选择得到最优网络
  mWifiStateMachine.sendMessage -> //发送自动连接给wifi状态机WifiStateMachine.CMD_AUTO_CONNECT
  processMessage -> //ConnectModeState,当前状态是DisconnectedState,上面SupplicantStartedState和这里的状态只是父类调用而已
   mWifiConfigStore.saveNetwork //保存网络
   mWifiConfigStore.selectNetwork //选择前面计算出的最佳网络并使能

调试log:

07-06 15:41:00.357 557 608 D WifiAutoJoinController : attemptAutoJoin() status=wpa_state=SCANNING
07-06 15:41:00.357 557 608 D WifiAutoJoinController : p2p_device_address=b2:f1:ec:49:50:cb
07-06 15:41:00.357 557 608 D WifiAutoJoinController : address=b0:f1:ec:49:50:cb
07-06 15:41:00.357 557 608 D WifiAutoJoinController : uuid=544ae0ce-fa0a-58d2-af21-81be288cb44c
07-06 15:41:00.358 557 608 D WifiAutoJoinController : attemptAutoJoin() num recent config 2 —> suppNetId=-1
07-06 15:41:00.358 557 608 D WifiAutoJoinController : attemptAutoJoin good candidate seen, bumped hard -> status=”Kris”WPA_PSK status=0
07-06 15:41:00.358 557 608 D WifiAutoJoinController : attemptAutoJoin trying id=1 “Kris”WPA_PSK status=0
07-06 15:41:00.359 557 608 D WifiAutoJoinController : attemptAutoJoin good candidate seen, bumped hard -> status=”RD-TA100-2.4G”WPA_PSK status=0
07-06 15:41:00.359 557 608 D WifiAutoJoinController : attemptAutoJoin trying id=0 “RD-TA100-2.4G”WPA_PSK status=0 current candidate “Kris”WPA_PSK
07-06 15:41:00.359 557 608 D WifiAutoJoinController : attemptAutoJoin will compare candidate “Kris”WPA_PSK with “RD-TA100-2.4G”WPA_PSK
07-06 15:41:00.359 557 608 D WifiAutoJoinController : compareWifiConfigurationsRSSI: “Kris”WPA_PSK rssi=-55,-127 boost=0 “RD-TA100-2.4G”WPA_PSK rssi=-47,-127 boost=0
07-06 15:41:00.359 557 608 D WifiAutoJoinController : “Kris”WPA_PSK is5=false score=-55 “RD-TA100-2.4G”WPA_PSK is5=false score=-47
07-06 15:41:00.359 557 608 D WifiAutoJoinController : compareWifiConfigurationsRSSI “Kris”WPA_PSK rssi=(-55,-127) num=(1,0) < “RD-TA100-2.4G”WPA_PSK rssi=(-47,-127) num=(1,0) -> 8
07-06 15:41:00.360 557 608 D WifiAutoJoinController : compareWifiConfigurations prefers “Kris”WPA_PSK over “RD-TA100-2.4G”WPA_PSK due to user choice of 60 order -> -52
07-06 15:41:00.360 557 608 D WifiAutoJoinController : compareWifiConfigurations: “Kris”WPA_PSK > “RD-TA100-2.4G”WPA_PSK order -52
07-06 15:41:00.360 557 608 D WifiAutoJoinController : attemptAutoJoin compareWifiConfigurations returned -52
07-06 15:41:00.360 557 608 D WifiAutoJoinController : attemptAutoJoin networkSwitching candidate “Kris”WPA_PSK linked=false : delta=1000
07-06 15:41:00.361 557 608 D WifiStateMachine: shouldSwitchNetwork txSuccessRate=0.00 rxSuccessRate=0.00 delta 1000 -> 1000
07-06 15:41:00.361 557 608 D WifiAutoJoinController : AutoJoin auto connect with netId 1 to “Kris”WPA_PSK
07-06 15:41:00.361 557 608 D WifiAutoJoinController : attemptRoam: “Kris”WPA_PSK Found ee:29:f5:be:c5:6b rssi=-55 freq=2437
07-06 15:41:00.361 557 608 D WifiAutoJoinController : Done attemptAutoJoin status=3
07-06 15:41:00.364 557 608 D WifiStateMachine: handleMessage: X
07-06 15:41:00.365 557 608 D WIFI : got request NetworkRequest [ id=1, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
07-06 15:41:00.365 557 608 D WIFI_UT : got request NetworkRequest [ id=1, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ] with score 0
07-06 15:41:00.365 557 608 D WifiStateMachine: handleMessage: E msg.what=131215
07-06 15:41:00.365 557 608 D WifiStateMachine: processMsg: DisconnectedState
07-06 15:41:00.369 557 608 D WifiStateMachine: processMsg: ConnectModeState
07-06 15:41:00.374 557 608 D WifiStateMachine: CMD_AUTO_CONNECT sup state ScanState my state DisconnectedState nid=1 roam=3
07-06 15:41:00.374 557 608 E WifiConfigStore: saveWifiConfigBSSID Setting BSSID for “Kris”WPA_PSK to any
07-06 15:41:00.382 557 608 D WifiStateMachine: CMD_AUTO_CONNECT will save config -> “Kris” nid=1
07-06 15:41:00.452 557 608 D WifiStateMachine: CMD_AUTO_CONNECT did save config -> nid=1
07-06 15:41:00.456 867 867 I wpa_supplicant: wlan0: Trying to associate with ee:29:f5:be:c5:6b (SSID=’Kris’ freq=2437 MHz)
07-06 15:41:00.458 557 608 E WifiConfigStore: rewrite network history for “Kris”WPA_PSK

你可能感兴趣的:(子类__WiFi)