summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorGlen Kuhne <kuh@google.com>2016-03-30 19:02:08 -0700
committerGlen Kuhne <kuh@google.com>2016-04-08 11:14:12 -0700
commit0efd09fea566f4445807b6aff60b18e127e72d38 (patch)
tree383ddd010645047e7c983af1054f49719e5a3410 /service
parentf37079e3d8f4aca3242a971cbaef732fe1b75bde (diff)
Added buffering of filtered ScanDetails to QNS
Added logic to buffer the scanDetails considered by QualifiedNetworkSelection as potential candidates (has a saved config, and signal strength over threshold). And a getter to access these. BUG=27932650 Change-Id: I4e04194c944f7d8a18719d7dfc7b66cbf42eb5af
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java b/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java
index 1601f7361..8a3f7aa2b 100644
--- a/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java
+++ b/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java
@@ -55,6 +55,8 @@ public class WifiQualifiedNetworkSelector {
private String mCurrentBssid = null;
//buffer most recent scan results
private List<ScanDetail> mScanDetails = null;
+ //buffer of filtered scan results (Scan results considered by network selection)
+ private volatile List<ScanDetail> mFilteredScanDetails = null;
//Minimum time gap between last successful Qualified Network Selection and new selection attempt
//usable only when current state is connected state default 10 s
@@ -134,6 +136,16 @@ public class WifiQualifiedNetworkSelector {
}
/**
+ * @return the list of ScanDetails scored as potential candidates by the last run of
+ * selectQualifiedNetwork, this will be empty if QNS determined no selection was needed on last
+ * run. This includes scan details of sufficient signal strength, and had an associated
+ * WifiConfiguration.
+ */
+ public List<ScanDetail> getFilteredScanDetails() {
+ return mFilteredScanDetails;
+ }
+
+ /**
* set the user selected preferred band
*
* @param band preferred band user selected
@@ -615,6 +627,7 @@ public class WifiQualifiedNetworkSelector {
boolean isSupplicantTransient) {
qnsLog("==========start qualified Network Selection==========");
mScanDetails = scanDetails;
+ List<ScanDetail> filteredScanDetails = new ArrayList<>();
if (mCurrentConnectedNetwork == null) {
mCurrentConnectedNetwork =
mWifiConfigManager.getWifiConfiguration(mWifiInfo.getNetworkId());
@@ -628,6 +641,7 @@ public class WifiQualifiedNetworkSelector {
isDisconnected, isSupplicantTransient)) {
qnsLog("Quit qualified Network Selection since it is not forced and current network is"
+ " qualified already");
+ mFilteredScanDetails = filteredScanDetails;
return null;
}
@@ -705,11 +719,11 @@ public class WifiQualifiedNetworkSelector {
}
//check whether this scan result belong to a saved network
- boolean ephemeral = false;
+ boolean potentiallyEphemeral = false;
List<WifiConfiguration> associatedWifiConfigurations =
mWifiConfigManager.updateSavedNetworkWithNewScanDetail(scanDetail);
if (associatedWifiConfigurations == null) {
- ephemeral = true;
+ potentiallyEphemeral = true;
if (mDbg) {
notSavedScan.append(scanId + " / ");
}
@@ -717,14 +731,14 @@ public class WifiQualifiedNetworkSelector {
//if there are more than 1 associated network, it must be a passpoint network
WifiConfiguration network = associatedWifiConfigurations.get(0);
if (network.ephemeral) {
- ephemeral = true;
+ potentiallyEphemeral = true;
}
}
- if (ephemeral) {
+ if (potentiallyEphemeral) {
if (isUntrustedConnectionsAllowed && mNetworkScoreCache != null) {
int netScore = mNetworkScoreCache.getNetworkScore(scanResult, false);
- //get network score
+ //get network score (Determine if this is an 'Ephemeral' network)
if (netScore != WifiNetworkScoreCache.INVALID_NETWORK_SCORE) {
qnsLog(scanId + "has score: " + netScore);
if (netScore > unTrustedHighestScore) {
@@ -732,9 +746,14 @@ public class WifiQualifiedNetworkSelector {
untrustedScanResultCandidate = scanResult;
qnsLog(scanId + " become the new untrusted candidate");
}
+ // scanDetail is for available ephemeral network
+ filteredScanDetails.add(scanDetail);
}
}
continue;
+ } else {
+ // scanDetail is for available saved network
+ filteredScanDetails.add(scanDetail);
}
// calculate the core of each scanresult whose associated network is not ephemeral. Due
@@ -782,6 +801,8 @@ public class WifiQualifiedNetworkSelector {
}
}
+ mFilteredScanDetails = filteredScanDetails;
+
//kick the score manager if there is any unscored network
if (mScoreManager != null && unscoredNetworks.size() != 0) {
NetworkKey[] unscoredNetworkKeys =