summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2017-06-06 17:40:04 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-06-06 17:40:04 +0000
commitd8fe6e83c6abb4819715c2d5acd18cc0d8e81bfd (patch)
tree47d17d4fc3d6660884d9c3f57dafed976cb98896 /service
parent8eaa7b85c7eccea62f5e75aeec6fbf81afdd4f84 (diff)
parentcbcfdbfcb8be58d6bcb0e4e486ef01ac0116799b (diff)
Merge "Log disabled networks only" into oc-dev am: 90bdf19e29
am: cbcfdbfcb8 Change-Id: Ifd88b24e501aaa5ff2710433e32dfcd0bc7a110a
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 fc2dbead4..59d4ab260 100644
--- a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
+++ b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
@@ -108,9 +108,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);
@@ -121,28 +118,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");
}
}