summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2017-06-06 17:33:59 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-06-06 17:33:59 +0000
commitcbcfdbfcb8be58d6bcb0e4e486ef01ac0116799b (patch)
treeb62cc90d92e4c066beb6df674b117bf82d6ed82f /service
parent26834d60518e5f7d7255efb67c7f2af2003f96ad (diff)
parent90bdf19e29900ad48a8df1fbfbb10bec862319d7 (diff)
Merge "Log disabled networks only" into oc-dev
am: 90bdf19e29 Change-Id: I546a3b187b612d475c5f77e37256c219247f2217
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");
}
}