WifiWatchdog changes for poor link detection
- use packet loss (wlutil pktcnt) instead of frame loss, retune all parameters - use wpa_supplicant to get packet loss counters, instead of netd - handle BSSID roaming in all situations - improve flapping avoidance mechanism by setting different target RSSI - handle high packet loss in high RSSI (never seen in real testing) - add more comments on how to set all parameters Signed-off-by yuhaozheng@google.com Change-Id: I33429f063d8625a458be4791edd83a86d5a723df
This commit is contained in:
committed by
Irfan Sheriff
parent
527d14dc3c
commit
b33227d23e
@@ -368,6 +368,14 @@ public class WifiNative {
|
||||
return doStringCommand("SIGNAL_POLL");
|
||||
}
|
||||
|
||||
/** Example outout:
|
||||
* TXGOOD=396
|
||||
* TXBAD=1
|
||||
*/
|
||||
public String pktcntPoll() {
|
||||
return doStringCommand("PKTCNT_POLL");
|
||||
}
|
||||
|
||||
public boolean startWpsPbc(String bssid) {
|
||||
if (TextUtils.isEmpty(bssid)) {
|
||||
return doBooleanCommand("WPS_PBC");
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.net.LinkProperties;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.NetworkInfo.DetailedState;
|
||||
import android.net.NetworkUtils;
|
||||
import android.net.wifi.WifiWatchdogStateMachine.RssiPktcntStat;
|
||||
import android.net.wifi.WpsResult.Status;
|
||||
import android.net.wifi.p2p.WifiP2pManager;
|
||||
import android.net.wifi.p2p.WifiP2pService;
|
||||
@@ -1163,7 +1164,7 @@ public class WifiStateMachine extends StateMachine {
|
||||
case CMD_RSSI_POLL:
|
||||
case CMD_DELAYED_STOP_DRIVER:
|
||||
case WifiMonitor.SCAN_RESULTS_EVENT:
|
||||
case WifiWatchdogStateMachine.RSSI_FETCH:
|
||||
case WifiWatchdogStateMachine.RSSI_PKTCNT_FETCH:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
@@ -1514,6 +1515,30 @@ public class WifiStateMachine extends StateMachine {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch TX packet counters on current connection
|
||||
*/
|
||||
private void fetchPktcntNative(RssiPktcntStat stat) {
|
||||
String pktcntPoll = mWifiNative.pktcntPoll();
|
||||
|
||||
if (pktcntPoll != null) {
|
||||
String[] lines = pktcntPoll.split("\n");
|
||||
for (String line : lines) {
|
||||
String[] prop = line.split("=");
|
||||
if (prop.length < 2) continue;
|
||||
try {
|
||||
if (prop[0].equals("TXGOOD")) {
|
||||
stat.txgood = Integer.parseInt(prop[1]);
|
||||
} else if (prop[0].equals("TXBAD")) {
|
||||
stat.txbad = Integer.parseInt(prop[1]);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
//Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void configureLinkProperties() {
|
||||
if (mWifiConfigStore.isUsingStaticIp(mLastNetworkId)) {
|
||||
mLinkProperties = mWifiConfigStore.getLinkProperties(mLastNetworkId);
|
||||
@@ -1613,10 +1638,7 @@ public class WifiStateMachine extends StateMachine {
|
||||
mWifiInfo.setNetworkId(WifiConfiguration.INVALID_NETWORK_ID);
|
||||
}
|
||||
|
||||
if (state == SupplicantState.ASSOCIATING) {
|
||||
/* BSSID is valid only in ASSOCIATING state */
|
||||
mWifiInfo.setBSSID(stateChangeResult.BSSID);
|
||||
}
|
||||
mWifiInfo.setBSSID(stateChangeResult.BSSID);
|
||||
mWifiInfo.setSSID(stateChangeResult.SSID);
|
||||
|
||||
mSupplicantStateTracker.sendMessage(Message.obtain(message));
|
||||
@@ -1925,8 +1947,8 @@ public class WifiStateMachine extends StateMachine {
|
||||
replyToMessage(message, WifiManager.DISABLE_NETWORK_FAILED,
|
||||
WifiManager.BUSY);
|
||||
break;
|
||||
case WifiWatchdogStateMachine.RSSI_FETCH:
|
||||
replyToMessage(message, WifiWatchdogStateMachine.RSSI_FETCH_FAILED);
|
||||
case WifiWatchdogStateMachine.RSSI_PKTCNT_FETCH:
|
||||
replyToMessage(message, WifiWatchdogStateMachine.RSSI_PKTCNT_FETCH_FAILED);
|
||||
break;
|
||||
default:
|
||||
loge("Error! unhandled message" + message);
|
||||
@@ -3129,10 +3151,13 @@ public class WifiStateMachine extends StateMachine {
|
||||
mRssiPollToken, 0), POLL_RSSI_INTERVAL_MSECS);
|
||||
}
|
||||
break;
|
||||
case WifiWatchdogStateMachine.RSSI_FETCH:
|
||||
case WifiWatchdogStateMachine.RSSI_PKTCNT_FETCH:
|
||||
RssiPktcntStat stat = (RssiPktcntStat) message.obj;
|
||||
fetchRssiAndLinkSpeedNative();
|
||||
replyToMessage(message, WifiWatchdogStateMachine.RSSI_FETCH_SUCCEEDED,
|
||||
mWifiInfo.getRssi());
|
||||
stat.rssi = mWifiInfo.getRssi();
|
||||
fetchPktcntNative(stat);
|
||||
replyToMessage(message, WifiWatchdogStateMachine.RSSI_PKTCNT_FETCH_SUCCEEDED,
|
||||
stat);
|
||||
break;
|
||||
default:
|
||||
return NOT_HANDLED;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user