diff options
author | vandwalle <vandwalle@google.com> | 2014-09-19 15:21:35 -0700 |
---|---|---|
committer | vandwalle <vandwalle@google.com> | 2014-09-23 12:38:06 -0700 |
commit | 176a27f3abf18af18a1ad4012ca3eadbff12ba96 (patch) | |
tree | 720711162e5adc1c352bc572e961739ee9bdfd55 /wifi/java/android | |
parent | a7bf56e7e09b0ef80e716d87dd6b8e6c9a434c8e (diff) | |
download | frameworks_base-176a27f3abf18af18a1ad4012ca3eadbff12ba96.zip frameworks_base-176a27f3abf18af18a1ad4012ca3eadbff12ba96.tar.gz frameworks_base-176a27f3abf18af18a1ad4012ca3eadbff12ba96.tar.bz2 |
handle bssid blacklist in case of dhcp failures
Change-Id: Iba13db478ed69976c37bd4882f59bf0cae2212e6
Diffstat (limited to 'wifi/java/android')
-rw-r--r-- | wifi/java/android/net/wifi/ScanResult.java | 9 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 57 |
2 files changed, 61 insertions, 5 deletions
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java index 27c2541..29656c9 100644 --- a/wifi/java/android/net/wifi/ScanResult.java +++ b/wifi/java/android/net/wifi/ScanResult.java @@ -107,6 +107,12 @@ public class ScanResult implements Parcelable { public int autoJoinStatus; /** + * num IP configuration failures + * @hide + */ + public int numIpConfigFailures; + + /** * @hide * Last time we blacklisted the ScanResult */ @@ -256,6 +262,7 @@ public class ScanResult implements Parcelable { untrusted = source.untrusted; numConnection = source.numConnection; numUsage = source.numUsage; + numIpConfigFailures = source.numIpConfigFailures; } } @@ -320,6 +327,7 @@ public class ScanResult implements Parcelable { dest.writeInt(untrusted ? 1 : 0); dest.writeInt(numConnection); dest.writeInt(numUsage); + dest.writeInt(numIpConfigFailures); if (informationElements != null) { dest.writeInt(informationElements.length); for (int i = 0; i < informationElements.length; i++) { @@ -355,6 +363,7 @@ public class ScanResult implements Parcelable { sr.untrusted = in.readInt() != 0; sr.numConnection = in.readInt(); sr.numUsage = in.readInt(); + sr.numIpConfigFailures = in.readInt(); int n = in.readInt(); if (n != 0) { sr.informationElements = new InformationElement[n]; diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index d27c2f7..4f5f31a 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -203,6 +203,12 @@ public class WifiConfiguration implements Parcelable { public int status; /** + * The configuration needs to be written to networkHistory.txt + * @hide + */ + public boolean dirty; + + /** * The code referring to a reason for disabling the network * Valid when {@link #status} == Status.DISABLED * @hide @@ -621,6 +627,18 @@ public class WifiConfiguration implements Parcelable { /** * @hide + * Number of IP config failures + */ + public int numIpConfigFailures; + + /** + * @hide + * Number of Auth failures + */ + public int numAuthFailures; + + /** + * @hide * Last time we blacklisted the configuration */ public long blackListTimestamp; @@ -884,7 +902,10 @@ public class WifiConfiguration implements Parcelable { } else if (status > autoJoinStatus) { blackListTimestamp = System.currentTimeMillis(); } - autoJoinStatus = status; + if (status != autoJoinStatus) { + autoJoinStatus = status; + dirty = true; + } } @Override @@ -893,7 +914,7 @@ public class WifiConfiguration implements Parcelable { if (this.status == WifiConfiguration.Status.CURRENT) { sbuf.append("* "); } else if (this.status == WifiConfiguration.Status.DISABLED) { - sbuf.append("- DSBLE: ").append(this.disableReason).append(" "); + sbuf.append("- DSBLE"); } sbuf.append("ID: ").append(this.networkId).append(" SSID: ").append(this.SSID). append(" BSSID: ").append(this.BSSID).append(" FQDN: ").append(this.FQDN). @@ -902,8 +923,20 @@ public class WifiConfiguration implements Parcelable { if (this.numConnectionFailures > 0) { sbuf.append(" numConnectFailures ").append(this.numConnectionFailures).append("\n"); } + if (this.numIpConfigFailures > 0) { + sbuf.append(" numIpConfigFailures ").append(this.numIpConfigFailures).append("\n"); + } + if (this.numAuthFailures > 0) { + sbuf.append(" numAuthFailures ").append(this.numAuthFailures).append("\n"); + } if (this.autoJoinStatus > 0) { - sbuf.append(" autoJoinStatus ").append(this.numConnectionFailures).append("\n"); + sbuf.append(" autoJoinStatus ").append(this.autoJoinStatus).append("\n"); + } + if (this.disableReason > 0) { + sbuf.append(" disableReason ").append(this.disableReason).append("\n"); + } + if (this.numAssociation > 0) { + sbuf.append(" numAssociation ").append(this.numAssociation).append("\n"); } if (this.didSelfAdd) sbuf.append(" didSelfAdd"); if (this.selfAdded) sbuf.append(" selfAdded"); @@ -1028,10 +1061,17 @@ public class WifiConfiguration implements Parcelable { } } if (this.scanResultCache != null) { - sbuf.append("scan cache: "); + sbuf.append("Scan Cache: "); for(ScanResult result : this.scanResultCache.values()) { sbuf.append("{").append(result.BSSID).append(",").append(result.frequency); - sbuf.append(",").append(result.level).append(",st="); + sbuf.append(",").append(result.level); + if (result.autoJoinStatus > 0) { + sbuf.append(",st=").append(result.autoJoinStatus); + } + if (result.numIpConfigFailures > 0) { + sbuf.append(",ipfail="); + sbuf.append(result.numIpConfigFailures); + } sbuf.append(result.autoJoinStatus).append("} "); } sbuf.append('\n'); @@ -1356,6 +1396,8 @@ public class WifiConfiguration implements Parcelable { lastDisconnected = source.lastDisconnected; lastConnectionFailure = source.lastConnectionFailure; numConnectionFailures = source.numConnectionFailures; + numIpConfigFailures = source.numIpConfigFailures; + numAuthFailures = source.numAuthFailures; numScorerOverride = source.numScorerOverride; numScorerOverrideAndSwitchedNetwork = source.numScorerOverrideAndSwitchedNetwork; numAssociation = source.numAssociation; @@ -1370,6 +1412,7 @@ public class WifiConfiguration implements Parcelable { autoJoinUseAggressiveJoinAttemptThreshold = source.autoJoinUseAggressiveJoinAttemptThreshold; autoJoinBailedDueToLowRssi = source.autoJoinBailedDueToLowRssi; + dirty = source.dirty; } } @@ -1420,6 +1463,8 @@ public class WifiConfiguration implements Parcelable { dest.writeLong(blackListTimestamp); dest.writeLong(lastConnectionFailure); dest.writeInt(numConnectionFailures); + dest.writeInt(numIpConfigFailures); + dest.writeInt(numAuthFailures); dest.writeInt(numScorerOverride); dest.writeInt(numScorerOverrideAndSwitchedNetwork); dest.writeInt(numAssociation); @@ -1478,6 +1523,8 @@ public class WifiConfiguration implements Parcelable { config.blackListTimestamp = in.readLong(); config.lastConnectionFailure = in.readLong(); config.numConnectionFailures = in.readInt(); + config.numIpConfigFailures = in.readInt(); + config.numAuthFailures = in.readInt(); config.numScorerOverride = in.readInt(); config.numScorerOverrideAndSwitchedNetwork = in.readInt(); config.numAssociation = in.readInt(); |