summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2017-06-01 12:14:39 -0700
committerRandy Pan <zpan@google.com>2017-06-01 12:14:39 -0700
commit39d6bdc92f98fd7100382d8fb5f7f7044dbcb083 (patch)
tree6ccb2b560f85f7ce31887e8904ffe2099ed9a7f1 /service
parent32a2c670100b84fb049f55ad5a8a300c60a48aa5 (diff)
Log disabled networks only
Previously a network could be logged as disabled before it has actually reached the max failure threshold. Bug: 62238322 Test: enter wrong password for a network, examine the bug report Change-Id: I18db0543a74fb619041e44193198f1c8ceb36708
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SavedNetworkEvaluator.java41
1 files changed, 18 insertions, 23 deletions
diff --git a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
index 720afd5a7..9ac70689b 100644
--- a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
+++ b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
@@ -107,9 +107,6 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
continue;
}
- WifiConfiguration.NetworkSelectionStatus status =
- network.getNetworkSelectionStatus();
-
// If a configuration is temporarily disabled, re-enable it before trying
// to connect to it.
mWifiConfigManager.tryEnableNetwork(network.networkId);
@@ -120,28 +117,26 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
// Clear the cached candidate, score and seen.
mWifiConfigManager.clearNetworkCandidateScanResult(network.networkId);
- boolean networkDisabled = false;
- boolean networkStringLogged = false;
- for (int index = WifiConfiguration.NetworkSelectionStatus
- .NETWORK_SELECTION_DISABLED_STARTING_INDEX;
- index < WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_DISABLED_MAX;
- index++) {
- int count = status.getDisableReasonCounter(index);
- if (count > 0) {
- networkDisabled = true;
- if (!networkStringLogged) {
- sbuf.append(" ").append(WifiNetworkSelector.toNetworkString(network))
- .append(" ");
- networkStringLogged = true;
+ // Log disabled network.
+ WifiConfiguration.NetworkSelectionStatus status = network.getNetworkSelectionStatus();
+ if (!status.isNetworkEnabled()) {
+ sbuf.append(" ").append(WifiNetworkSelector.toNetworkString(network)).append(" ");
+ for (int index = WifiConfiguration.NetworkSelectionStatus
+ .NETWORK_SELECTION_DISABLED_STARTING_INDEX;
+ index < WifiConfiguration.NetworkSelectionStatus
+ .NETWORK_SELECTION_DISABLED_MAX;
+ index++) {
+ int count = status.getDisableReasonCounter(index);
+ // Here we log the reason as long as its count is greater than zero. The
+ // network may not be disabled because of this particular reason. Logging
+ // this information anyway to help understand what happened to the network.
+ if (count > 0) {
+ sbuf.append("reason=")
+ .append(WifiConfiguration.NetworkSelectionStatus
+ .getNetworkDisableReasonString(index))
+ .append(", count=").append(count).append("; ");
}
- sbuf.append("reason=")
- .append(WifiConfiguration.NetworkSelectionStatus
- .getNetworkDisableReasonString(index))
- .append(", count=").append(count).append("; ");
}
- }
-
- if (networkDisabled) {
sbuf.append("\n");
}
}