summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2017-04-26 14:59:04 -0700
committerRandy Pan <zpan@google.com>2017-05-01 17:17:17 -0700
commit5213be94c3b27fff928f5f221e5951c7ede1058b (patch)
tree6a4bd9a817355488b2bc58e11fb3c65df52b3f84 /service
parent25a5dee0ddf8b6b93f5cd37399eca5b4ba78565d (diff)
Wifi network selection logging improvement
1) Only log saved networks which are disabled. Print the disable reason and count in a human readable fashion. 2) Log user connection preference only if it affects network selection. Bug: 36872201 Test: runtest.sh Test: Flash, run connection tests and check the bug reports Change-Id: I56df97e43ef01ff8d14e79a26bf98bb60abedee2
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SavedNetworkEvaluator.java40
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSelector.java14
2 files changed, 39 insertions, 15 deletions
diff --git a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
index 7565f7819..5e75fbe8f 100644
--- a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
+++ b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
@@ -33,7 +33,7 @@ import java.util.List;
* saved networks.
*/
public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluator {
- private static final String NAME = "WifiSavedNetworkEvaluator";
+ private static final String NAME = "SavedNetworkEvaluator";
private final WifiConfigManager mWifiConfigManager;
private final Clock mClock;
private final LocalLog mLocalLog;
@@ -96,7 +96,7 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
return;
}
- StringBuffer sbuf = new StringBuffer("Saved Networks List: \n");
+ StringBuffer sbuf = new StringBuffer();
for (WifiConfiguration network : savedNetworks) {
/**
* Ignore Passpoint networks. Passpoint networks are also considered as "saved"
@@ -120,20 +120,36 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
// Clear the cached candidate, score and seen.
mWifiConfigManager.clearNetworkCandidateScanResult(network.networkId);
- sbuf.append(" ").append(WifiNetworkSelector.toNetworkString(network)).append(" ")
- .append(" User Preferred BSSID: ").append(network.BSSID)
- .append(" FQDN: ").append(network.FQDN).append(" ")
- .append(status.getNetworkStatusString()).append(" Disable account: ");
- for (int index = WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLE;
+ boolean networkDisabled = false;
+ boolean networkStringLogged = false;
+ for (int index = WifiConfiguration.NetworkSelectionStatus
+ .NETWORK_SELECTION_DISABLED_STARTING_INDEX;
index < WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_DISABLED_MAX;
index++) {
- sbuf.append(status.getDisableReasonCounter(index)).append(" ");
+ int count = status.getDisableReasonCounter(index);
+ if (count > 0) {
+ networkDisabled = true;
+ if (!networkStringLogged) {
+ sbuf.append(" ").append(WifiNetworkSelector.toNetworkString(network))
+ .append(" ");
+ networkStringLogged = true;
+ }
+ sbuf.append("reason=")
+ .append(WifiConfiguration.NetworkSelectionStatus
+ .getNetworkDisableReasonString(index))
+ .append(", count=").append(count).append("; ");
+ }
+ }
+
+ if (networkDisabled) {
+ sbuf.append("\n");
}
- sbuf.append("Connect Choice: ").append(status.getConnectChoice())
- .append(" set time: ").append(status.getConnectChoiceTimestamp())
- .append("\n");
}
- localLog(sbuf.toString());
+
+ if (sbuf.length() > 0) {
+ localLog("Disabled saved networks:");
+ localLog(sbuf.toString());
+ }
}
/**
diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java
index 5b84537ae..ce04bd28e 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSelector.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java
@@ -385,6 +385,7 @@ public class WifiNetworkSelector {
private WifiConfiguration overrideCandidateWithUserConnectChoice(
@NonNull WifiConfiguration candidate) {
WifiConfiguration tempConfig = candidate;
+ WifiConfiguration originalCandidate = candidate;
ScanResult scanResultCandidate = candidate.getNetworkSelectionStatus().getCandidate();
while (tempConfig.getNetworkSelectionStatus().getConnectChoice() != null) {
@@ -403,9 +404,12 @@ public class WifiNetworkSelector {
break;
}
}
- localLog("After user selection adjustment, the final candidate is:"
- + WifiNetworkSelector.toNetworkString(candidate) + " : "
- + scanResultCandidate.BSSID);
+
+ if (candidate != originalCandidate) {
+ localLog("After user selection adjustment, the final candidate is:"
+ + WifiNetworkSelector.toNetworkString(candidate) + " : "
+ + scanResultCandidate.BSSID);
+ }
return candidate;
}
@@ -461,10 +465,14 @@ public class WifiNetworkSelector {
WifiConfiguration selectedNetwork = null;
for (NetworkEvaluator registeredEvaluator : mEvaluators) {
if (registeredEvaluator != null) {
+ localLog("About to run " + registeredEvaluator.getName() + " :");
selectedNetwork = registeredEvaluator.evaluateNetworks(filteredScanDetails,
currentNetwork, currentBssid, connected,
untrustedNetworkAllowed, mConnectableNetworks);
if (selectedNetwork != null) {
+ localLog(registeredEvaluator.getName() + " selects "
+ + WifiNetworkSelector.toNetworkString(selectedNetwork) + " : "
+ + selectedNetwork.getNetworkSelectionStatus().getCandidate().BSSID);
break;
}
}