diff options
author | vandwalle <vandwalle@google.com> | 2014-10-10 15:03:53 -0700 |
---|---|---|
committer | vandwalle <vandwalle@google.com> | 2014-10-11 15:23:09 -0700 |
commit | a5283c01ac413e378e2261050cac3a6d6e9cf385 (patch) | |
tree | ec52faf7379b9ae6987e40d1ca94473474b74094 | |
parent | f15171c10c8df5603c3ba7a2fa80138e151028fc (diff) | |
download | wifi-a5283c01ac413e378e2261050cac3a6d6e9cf385.tar.gz |
reenable networks completely, 5 mins after DHCP failure blacklist; revert aggressive wifi to cellular handover when handing over due to link speed
Bug:17949093
Bug:17947372
Bug:17897698
Change-Id: I1d398238022fd380952cb8dc28f47cc38d0b7b06
Conflicts:
service/java/com/android/server/wifi/WifiStateMachine.java
3 files changed, 35 insertions, 24 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java index 7d8edc6ea..7bca628bf 100644 --- a/service/java/com/android/server/wifi/WifiConfigStore.java +++ b/service/java/com/android/server/wifi/WifiConfigStore.java @@ -328,7 +328,7 @@ public class WifiConfigStore extends IpConfigStore { public int maxAuthErrorsToBlacklist = 4; public int maxConnectionErrorsToBlacklist = 4; - public int wifiConfigBlacklistMinTimeMilli = 1000 * 60 * 20; + public int wifiConfigBlacklistMinTimeMilli = 1000 * 60 * 5; // Boost RSSI values of associated networks public int associatedHysteresisHigh = +14; @@ -704,6 +704,7 @@ public class WifiConfigStore extends IpConfigStore { boolean networkEnabledStateChanged = false; for(WifiConfiguration config : mConfiguredNetworks.values()) { + if(config != null && config.status == Status.DISABLED && (config.autoJoinStatus <= WifiConfiguration.AUTO_JOIN_DISABLED_ON_AUTH_FAILURE)) { @@ -723,10 +724,14 @@ public class WifiConfigStore extends IpConfigStore { if(mWifiNative.enableNetwork(config.networkId, false)) { networkEnabledStateChanged = true; config.status = Status.ENABLED; + // Reset the blacklist condition config.numConnectionFailures = 0; config.numIpConfigFailures = 0; config.numAuthFailures = 0; + + // Reenable the wifi configuration + config.setAutoJoinStatus(WifiConfiguration.AUTO_JOIN_ENABLED); } else { loge("Enable network failed on " + config.networkId); } @@ -3822,7 +3827,7 @@ public class WifiConfigStore extends IpConfigStore { bssidDbg = BSSID + " ipfail=" + result.numIpConfigFailures; if (result.numIpConfigFailures > 3) { // Tell supplicant to stop trying this BSSID - mWifiNative.blackListBSSID(BSSID); + mWifiNative.addToBlacklist(BSSID); result.setAutoJoinStatus(ScanResult.AUTO_JOIN_DISABLED); } } @@ -3831,8 +3836,9 @@ public class WifiConfigStore extends IpConfigStore { loge("blacklisted " + config.configKey() + " to " + config.autoJoinStatus + " due to IP config failures, count=" - + config.numIpConfigFailures + " " - + bssidDbg); + + config.numIpConfigFailures + + " disableReason=" + config.disableReason + + " " + bssidDbg); } } else if (message.contains("CONN_FAILED")) { config.numConnectionFailures++; diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index e808f6768..eb812296a 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -328,15 +328,6 @@ public class WifiNative { } } - public String blackListBSSID(String BSSID) { - if (BSSID == null) { - return doStringCommand("blacklist clear"); - } else { - return doStringCommand("blacklist" + BSSID); - } - } - - public String getMacAddress() { //Macaddr = XX.XX.XX.XX.XX.XX String ret = doStringCommand("DRIVER MACADDR"); diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 4ed4e13fe..aadfc6740 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -2680,6 +2680,15 @@ public class WifiStateMachine extends StateMachine { sb.append(Integer.toString(msg.arg2)); sb.append(" num=").append(mWifiConfigStore.getConfiguredNetworksSize()); break; + case DhcpStateMachine.CMD_PRE_DHCP_ACTION: + sb.append(" "); + sb.append(Integer.toString(msg.arg1)); + sb.append(" "); + sb.append(Integer.toString(msg.arg2)); + sb.append(" txpkts=").append(mWifiInfo.txSuccess); + sb.append(",").append(mWifiInfo.txBad); + sb.append(",").append(mWifiInfo.txRetries); + break; case DhcpStateMachine.CMD_POST_DHCP_ACTION: sb.append(" "); sb.append(Integer.toString(msg.arg1)); @@ -2741,15 +2750,22 @@ public class WifiStateMachine extends StateMachine { sb.append("/"); sb.append(Integer.toString(mWifiConfigStore.getMaxDhcpRetries())); if (mWifiInfo.getBSSID() != null) { - sb.append(mWifiInfo.getBSSID()); + sb.append(" ").append(mWifiInfo.getBSSID()); } - if (c.scanResultCache != null) { - for (ScanResult r : c.scanResultCache.values()) { - if (r.BSSID.equals(mWifiInfo.getBSSID())) { - sb.append(" ipfail=").append(r.numIpConfigFailures); - sb.append(",st=").append(r.autoJoinStatus); + if (c != null) { + if (c.scanResultCache != null) { + for (ScanResult r : c.scanResultCache.values()) { + if (r.BSSID.equals(mWifiInfo.getBSSID())) { + sb.append(" ipfail=").append(r.numIpConfigFailures); + sb.append(",st=").append(r.autoJoinStatus); + } } } + sb.append(" -> ajst=").append(c.autoJoinStatus); + sb.append(" ").append(c.disableReason); + sb.append(" txpkts=").append(mWifiInfo.txSuccess); + sb.append(",").append(mWifiInfo.txBad); + sb.append(",").append(mWifiInfo.txRetries); } break; case CMD_UPDATE_LINKPROPERTIES: @@ -3451,7 +3467,7 @@ public class WifiStateMachine extends StateMachine { if (isGoodLinkspeed) sb.append(" gl"); /** - * We want to make sure that we use the 24GHz RSSI thresholds is + * We want to make sure that we use the 24GHz RSSI thresholds if * there are 2.4GHz scan results * otherwise we end up lowering the score based on 5GHz values * which may cause a switch to LTE before roaming has a chance to try 2.4GHz @@ -3611,8 +3627,7 @@ public class WifiStateMachine extends StateMachine { sb.append(String.format(",%d", score)); if (isBadLinkspeed) { - // Aggressively drop the score if link speed is bad - score -= 2 * mBadLinkspeedcount; + score -= 4 ; if (PDBG) { loge(" isBadLinkspeed ---> count=" + mBadLinkspeedcount + " score=" + Integer.toString(score)); @@ -4290,7 +4305,7 @@ public class WifiStateMachine extends StateMachine { // this will typically happen if the user walks away and come back to his arrea // TODO: implement blacklisting based on a timer, i.e. keep BSSID blacklisted // in supplicant for a couple of hours or a day - mWifiNative.blackListBSSID(null); + mWifiNative.clearBlacklist(); } } } @@ -4349,7 +4364,6 @@ public class WifiStateMachine extends StateMachine { }).start(); } - /* * Read a MAC address in /proc/arp/table, used by WifistateMachine * so as to record MAC address of default gateway. |