summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java162
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java106
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java2
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java2
-rw-r--r--service/res/values/config.xml2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java325
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java183
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java7
8 files changed, 251 insertions, 538 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 4e4f51d60..087320177 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -71,7 +71,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -2601,167 +2600,6 @@ public class WifiConfigManager {
}
/**
- * Helper method to fetch list of channels for a network from the associated ScanResult's cache
- * and add it to the provided channel as long as the size of the set is less than
- * |maxChannelSetSize|.
- *
- * @param channelSet Channel set holding all the channels for the network.
- * @param scanDetailCache ScanDetailCache entry associated with the network.
- * @param nowInMillis current timestamp to be used for age comparison.
- * @param ageInMillis only consider scan details whose timestamps are earlier than this
- * value.
- * @param maxChannelSetSize Maximum number of channels to be added to the set.
- * @return false if the list is full, true otherwise.
- */
- private boolean addToChannelSetForNetworkFromScanDetailCache(
- Set<Integer> channelSet, ScanDetailCache scanDetailCache,
- long nowInMillis, long ageInMillis, int maxChannelSetSize) {
- if (scanDetailCache != null && scanDetailCache.size() > 0) {
- for (ScanDetail scanDetail : scanDetailCache.values()) {
- ScanResult result = scanDetail.getScanResult();
- boolean valid = (nowInMillis - result.seen) < ageInMillis;
- if (mVerboseLoggingEnabled) {
- Log.v(TAG, "fetchChannelSetForNetwork has " + result.BSSID + " freq "
- + result.frequency + " age " + (nowInMillis - result.seen)
- + " ?=" + valid);
- }
- if (valid) {
- channelSet.add(result.frequency);
- }
- if (channelSet.size() >= maxChannelSetSize) {
- return false;
- }
- }
- }
- return true;
- }
-
- /**
- * Retrieves a list of channels for partial single scans
- *
- * @param ageInMillis only consider scan details whose timestamps are more recent than this.
- * @param maxCount maximum number of channels in the set
- * @return Set containing the frequeincies which were used for connection recently.
- */
- public Set<Integer> fetchChannelSetForPartialScan(long ageInMillis, int maxCount) {
- List<WifiConfiguration> networks = getConfiguredNetworks();
-
- // Remove any permanently or temporarily disabled networks.
- Iterator<WifiConfiguration> iter = networks.iterator();
- while (iter.hasNext()) {
- WifiConfiguration config = iter.next();
- if (config.ephemeral || config.isPasspoint()
- || config.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()
- || config.getNetworkSelectionStatus().isNetworkTemporaryDisabled()) {
- iter.remove();
- }
- }
-
- if (networks.isEmpty()) {
- return null;
- }
-
- // Sort the networks with the most frequent ones at the front of the network list.
- Collections.sort(networks, mScanListComparator);
-
- Set<Integer> channelSet = new HashSet<>();
- long nowInMillis = mClock.getWallClockMillis();
-
- for (WifiConfiguration config : networks) {
- ScanDetailCache scanDetailCache = getScanDetailCacheForNetwork(config.networkId);
- if (scanDetailCache == null) {
- continue;
- }
-
- // Add channels for the network to the output, and exit when it reaches max size
- if (!addToChannelSetForNetworkFromScanDetailCache(channelSet, scanDetailCache,
- nowInMillis, ageInMillis, maxCount)) {
- break;
- }
- }
-
- return channelSet;
- }
-
- /**
- * Retrieve a set of channels on which AP's for the provided network was seen using the
- * internal ScanResult's cache {@link #mScanDetailCaches}. This is used for initiating partial
- * scans for the currently connected network.
- *
- * @param networkId network ID corresponding to the network.
- * @param ageInMillis only consider scan details whose timestamps are earlier than this value.
- * @param homeChannelFreq frequency of the currently connected network.
- * @return Set containing the frequencies on which this network was found, null if the network
- * was not found or there are no associated scan details in the cache.
- */
- public Set<Integer> fetchChannelSetForNetworkForPartialScan(int networkId, long ageInMillis,
- int homeChannelFreq) {
- WifiConfiguration config = getInternalConfiguredNetwork(networkId);
- if (config == null) {
- return null;
- }
- ScanDetailCache scanDetailCache = getScanDetailCacheForNetwork(networkId);
- if (scanDetailCache == null && config.linkedConfigurations == null) {
- Log.i(TAG, "No scan detail and linked configs associated with networkId " + networkId);
- return null;
- }
- final int maxNumActiveChannelsForPartialScans = mContext.getResources().getInteger(
- R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels);
- if (mVerboseLoggingEnabled) {
- StringBuilder dbg = new StringBuilder();
- dbg.append("fetchChannelSetForNetworkForPartialScan ageInMillis ")
- .append(ageInMillis)
- .append(" for ")
- .append(config.getKey())
- .append(" max ")
- .append(maxNumActiveChannelsForPartialScans);
- if (scanDetailCache != null) {
- dbg.append(" bssids " + scanDetailCache.size());
- }
- if (config.linkedConfigurations != null) {
- dbg.append(" linked " + config.linkedConfigurations.size());
- }
- Log.v(TAG, dbg.toString());
- }
- Set<Integer> channelSet = new HashSet<>();
-
- // First add the currently connected network channel.
- if (homeChannelFreq > 0) {
- channelSet.add(homeChannelFreq);
- if (channelSet.size() >= maxNumActiveChannelsForPartialScans) {
- return channelSet;
- }
- }
-
- long nowInMillis = mClock.getWallClockMillis();
-
- // Then get channels for the network.
- if (!addToChannelSetForNetworkFromScanDetailCache(
- channelSet, scanDetailCache, nowInMillis, ageInMillis,
- maxNumActiveChannelsForPartialScans)) {
- return channelSet;
- }
-
- // Lastly get channels for linked networks.
- if (config.linkedConfigurations != null) {
- for (String configKey : config.linkedConfigurations.keySet()) {
- WifiConfiguration linkedConfig = getInternalConfiguredNetwork(configKey);
- if (linkedConfig == null) {
- continue;
- }
- ScanDetailCache linkedScanDetailCache =
- getScanDetailCacheForNetwork(linkedConfig.networkId);
- if (!addToChannelSetForNetworkFromScanDetailCache(
- channelSet, linkedScanDetailCache, nowInMillis, ageInMillis,
- maxNumActiveChannelsForPartialScans)) {
- break;
- }
- }
- }
- return channelSet;
- }
-
- /**
* Retrieves a list of all the saved hidden networks for scans
*
* Hidden network list sent to the firmware has limited size. If there are a lot of saved
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 712dbcd7f..9a21068e8 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -159,6 +159,7 @@ public class WifiConnectivityManager {
private final LinkedList<Long> mConnectionAttemptTimeStamps;
private final BssidBlocklistMonitor mBssidBlocklistMonitor;
private WifiScanner mScanner;
+ private WifiScoreCard mWifiScoreCard;
private boolean mDbg = false;
private boolean mWifiEnabled = false;
@@ -744,7 +745,7 @@ public class WifiConnectivityManager {
WifiNetworkSelector networkSelector, WifiConnectivityHelper connectivityHelper,
WifiLastResortWatchdog wifiLastResortWatchdog, OpenNetworkNotifier openNetworkNotifier,
WifiMetrics wifiMetrics, Handler handler,
- Clock clock, LocalLog localLog) {
+ Clock clock, LocalLog localLog, WifiScoreCard scoreCard) {
mContext = context;
mStateMachine = stateMachine;
mWifiInjector = injector;
@@ -768,6 +769,7 @@ public class WifiConnectivityManager {
mBssidBlocklistMonitor = mWifiInjector.getBssidBlocklistMonitor();
mWifiChannelUtilization = mWifiInjector.getWifiChannelUtilizationScan();
mNetworkSelector.setWifiChannelUtilization(mWifiChannelUtilization);
+ mWifiScoreCard = scoreCard;
}
/** Initialize single scanning schedules, and validate them */
@@ -953,10 +955,9 @@ public class WifiConnectivityManager {
R.integer.config_wifiInitialPartialScanChannelCacheAgeMins);
int maxCount = mContext.getResources().getInteger(
R.integer.config_wifiInitialPartialScanChannelMaxCount);
- freqs = mConfigManager.fetchChannelSetForPartialScan(ageInMillis, maxCount);
+ freqs = fetchChannelSetForPartialScan(maxCount);
} else {
- freqs = mConfigManager.fetchChannelSetForNetworkForPartialScan(
- config.networkId, CHANNEL_LIST_AGE_MS, mWifiInfo.getFrequency());
+ freqs = fetchChannelSetForNetworkForPartialScan(config.networkId);
}
if (freqs != null && freqs.size() != 0) {
@@ -972,6 +973,72 @@ public class WifiConnectivityManager {
}
}
+ /**
+ * Add the channels into the channel set with a size limit.
+ * If maxCount equals to 0, will add all available channels into the set.
+ * @param channelSet Target set for adding channel to.
+ * @param config Network for query channel from WifiScoreCard
+ * @param maxCount Size limit of the set. If equals to 0, means no limit.
+ * @return True if all available channels for this network are added, otherwise false.
+ */
+ private boolean addChannelFromWifiScoreCard(@NonNull Set<Integer> channelSet,
+ @NonNull WifiConfiguration config, int maxCount) {
+ WifiScoreCard.PerNetwork network = mWifiScoreCard.lookupNetwork(config.SSID);
+ List<Integer> channelList = network.getFrequencies();
+ for (Integer channel : channelList) {
+ if (maxCount > 0 && channelSet.size() >= maxCount) {
+ return false;
+ }
+ channelSet.add(channel);
+ }
+ return true;
+ }
+
+ /**
+ * Fetch channel set for target network.
+ */
+ @VisibleForTesting
+ public Set<Integer> fetchChannelSetForNetworkForPartialScan(int networkId) {
+ WifiConfiguration config = mConfigManager.getConfiguredNetwork(networkId);
+ if (config == null) {
+ return null;
+ }
+ final int maxNumActiveChannelsForPartialScans = mContext.getResources().getInteger(
+ R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels);
+ Set<Integer> channelSet = new HashSet<>();
+ // First add the currently connected network channel.
+ if (mWifiInfo.getFrequency() > 0) {
+ channelSet.add(mWifiInfo.getFrequency());
+ }
+ // Then get channels for the network.
+ addChannelFromWifiScoreCard(channelSet, config, maxNumActiveChannelsForPartialScans);
+ return channelSet;
+ }
+
+ /**
+ * Fetch channel set for all saved and suggestion non-passpoint network for partial scan.
+ */
+ @VisibleForTesting
+ public Set<Integer> fetchChannelSetForPartialScan(int maxCount) {
+ List<WifiConfiguration> networks = getAllScanOptimizationNetworks();
+ if (networks.isEmpty()) {
+ return null;
+ }
+
+ // Sort the networks with the most frequent ones at the front of the network list.
+ Collections.sort(networks, mConfigManager.getScanListComparator());
+
+ Set<Integer> channelSet = new HashSet<>();
+
+ for (WifiConfiguration config : networks) {
+ if (!addChannelFromWifiScoreCard(channelSet, config, maxCount)) {
+ return channelSet;
+ }
+ }
+
+ return channelSet;
+ }
+
// Watchdog timer handler
private void watchdogHandler() {
// Schedule the next timer and start a single scan if we are in disconnected state.
@@ -1287,26 +1354,29 @@ public class WifiConnectivityManager {
mWifiMetrics.logPnoScanStart();
}
- /**
- * Retrieve the PnoNetworks from Saved and suggestion non-passpoint network.
- */
- @VisibleForTesting
- public List<PnoSettings.PnoNetwork> retrievePnoNetworkList() {
+ private @NonNull List<WifiConfiguration> getAllScanOptimizationNetworks() {
List<WifiConfiguration> networks = mConfigManager.getSavedNetworks(-1);
networks.addAll(mWifiInjector.getWifiNetworkSuggestionsManager()
- .getAllPnoAvailableSuggestionNetworks());
+ .getAllScanOptimizationSuggestionNetworks());
// remove all auto-join disabled or network selection disabled network.
networks.removeIf(config -> !config.allowAutojoin
|| !config.getNetworkSelectionStatus().isNetworkEnabled());
+ return networks;
+ }
+
+ /**
+ * Retrieve the PnoNetworks from Saved and suggestion non-passpoint network.
+ */
+ @VisibleForTesting
+ public List<PnoSettings.PnoNetwork> retrievePnoNetworkList() {
+ List<WifiConfiguration> networks = getAllScanOptimizationNetworks();
+
if (networks.isEmpty()) {
return Collections.EMPTY_LIST;
}
Collections.sort(networks, mConfigManager.getScanListComparator());
-
- WifiScoreCard scoreCard = null;
- if (mContext.getResources().getBoolean(R.bool.config_wifiPnoFrequencyCullingEnabled)) {
- scoreCard = mWifiInjector.getWifiScoreCard();
- }
+ boolean pnoFrequencyCullingEnabled = mContext.getResources()
+ .getBoolean(R.bool.config_wifiPnoFrequencyCullingEnabled);
List<PnoSettings.PnoNetwork> pnoList = new ArrayList<>();
Set<WifiScanner.PnoSettings.PnoNetwork> pnoSet = new HashSet<>();
@@ -1318,11 +1388,11 @@ public class WifiConnectivityManager {
}
pnoList.add(pnoNetwork);
pnoSet.add(pnoNetwork);
- if (scoreCard == null) {
+ if (!pnoFrequencyCullingEnabled) {
continue;
}
- WifiScoreCard.PerNetwork network = scoreCard.lookupNetwork(config.SSID);
- List<Integer> channelList = network.getFrequencies();
+ Set<Integer> channelList = new HashSet<>();
+ addChannelFromWifiScoreCard(channelList, config, 0);
pnoNetwork.frequencies = channelList.stream().mapToInt(Integer::intValue).toArray();
localLog("retrievePnoNetworkList " + pnoNetwork.ssid + ":"
+ Arrays.toString(pnoNetwork.frequencies));
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 85ccfd11f..594008975 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -623,7 +623,7 @@ public class WifiInjector {
mWifiNetworkSelector, mWifiConnectivityHelper,
mWifiLastResortWatchdog, mOpenNetworkNotifier,
mWifiMetrics, new Handler(mWifiHandlerThread.getLooper()),
- mClock, mConnectivityLocalLog);
+ mClock, mConnectivityLocalLog, mWifiScoreCard);
}
/**
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
index 19c9da156..bf2a5aaa1 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
@@ -1208,7 +1208,7 @@ public class WifiNetworkSuggestionsManager {
/**
* Get all user approved, non-passpoint networks from suggestion.
*/
- public List<WifiConfiguration> getAllPnoAvailableSuggestionNetworks() {
+ public List<WifiConfiguration> getAllScanOptimizationSuggestionNetworks() {
List<WifiConfiguration> networks = new ArrayList<>();
for (PerAppInfo info : mActiveNetworkSuggestionsPerApp.values()) {
if (!info.hasUserApproved && info.carrierId == TelephonyManager.UNKNOWN_CARRIER_ID) {
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index b5037b74a..4d351b105 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -159,7 +159,7 @@
<!-- Boolean indicating performing a partial initial scan is enabled -->
<bool translatable="false" name="config_wifiEnablePartialInitialScan">false</bool>
- <!-- Integer for maximum number of channels to use in initial partial scan -->
+ <!-- Integer for maximum number of channels to use in initial partial scan. If equals to 0, means add all available channels for networks -->
<integer translatable="false" name="config_wifiInitialPartialScanChannelMaxCount">10</integer>
<!-- Integer for maximum age for scan results used to identify channels for partial initial
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index a8928313a..89b069894 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -2612,331 +2612,6 @@ public class WifiConfigManagerTest extends WifiBaseTest {
}
/**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForPartialScan(long, int)}.
- */
- @Test
- public void testFetchChannelSetForPartialScan() {
- WifiConfiguration network1 = WifiConfigurationTestUtil.createPskNetwork();
- NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(network1);
-
- // Set it to enabled.
- verifyUpdateNetworkSelectionStatus(
- result.getNetworkId(), NetworkSelectionStatus.DISABLED_NONE, 0);
-
- WifiConfiguration network2 = WifiConfigurationTestUtil.createOpenNetwork();
- result = verifyAddNetworkToWifiConfigManager(network2);
- // Set it to enabled.
- verifyUpdateNetworkSelectionStatus(
- result.getNetworkId(), NetworkSelectionStatus.DISABLED_NONE, 0);
-
- // Create 3 scan results with different bssid's & frequencies to network1
- String test_bssid_base = "af:89:56:34:56:6";
- for (int i = 0; i < 3; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network1, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- }
-
- // Create 2 scan results with different bssid's & frequencies to network2
- for (int i = 3; i < TEST_FREQ_LIST.length; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network2, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- }
-
- assertEquals(new HashSet<Integer>(Arrays.asList(TEST_FREQ_LIST)),
- mWifiConfigManager.fetchChannelSetForPartialScan(100, 5));
- }
-
- /**
- * Verify that the length of frequency set will not exceed the provided max value
- */
- @Test
- public void testFetchChannelSetForPartialScanMaxCount() {
- WifiConfiguration network1 = WifiConfigurationTestUtil.createPskNetwork();
- NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(network1);
-
- // Set it to enabled.
- verifyUpdateNetworkSelectionStatus(
- result.getNetworkId(), NetworkSelectionStatus.DISABLED_NONE, 0);
-
- WifiConfiguration network2 = WifiConfigurationTestUtil.createOpenNetwork();
- result = verifyAddNetworkToWifiConfigManager(network2);
- // Set it to enabled.
- verifyUpdateNetworkSelectionStatus(
- result.getNetworkId(), NetworkSelectionStatus.DISABLED_NONE, 0);
-
- // Create 3 scan results with different bssid's & frequencies to network1
- String test_bssid_base = "af:89:56:34:56:6";
- for (int i = 0; i < 3; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network1, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- }
-
- // Create 2 scan results with different bssid's & frequencies to network2
- for (int i = 3; i < TEST_FREQ_LIST.length; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network2, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- }
-
- assertEquals(3, mWifiConfigManager.fetchChannelSetForPartialScan(100, 3).size());
- }
-
- /**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)}.
- */
- @Test
- public void testFetchChannelSetForNetwork() {
- WifiConfiguration network = WifiConfigurationTestUtil.createPskNetwork();
- verifyAddNetworkToWifiConfigManager(network);
-
- // Create 5 scan results with different bssid's & frequencies.
- String test_bssid_base = "af:89:56:34:56:6";
- for (int i = 0; i < TEST_FREQ_LIST.length; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
-
- }
- assertEquals(new HashSet<Integer>(Arrays.asList(TEST_FREQ_LIST)),
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(network.networkId, 1,
- TEST_FREQ_LIST[4]));
- }
-
- /**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)} and
- * ensures that the frequenecy of the currently connected network is in the returned
- * channel set.
- */
- @Test
- public void testFetchChannelSetForNetworkIncludeCurrentNetwork() {
- WifiConfiguration network = WifiConfigurationTestUtil.createPskNetwork();
- verifyAddNetworkToWifiConfigManager(network);
-
- // Create 5 scan results with different bssid's & frequencies.
- String test_bssid_base = "af:89:56:34:56:6";
- for (int i = 0; i < TEST_FREQ_LIST.length; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
-
- }
-
- // Currently connected network frequency 2427 is not in the TEST_FREQ_LIST
- Set<Integer> freqs = mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(
- network.networkId, 1, 2427);
-
- assertEquals(true, freqs.contains(2427));
- }
-
- /**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)} and
- * ensures that scan results which have a timestamp beyond the provided age are not used
- * in the channel list.
- */
- @Test
- public void testFetchChannelSetForNetworkIgnoresStaleScanResults() {
- WifiConfiguration network = WifiConfigurationTestUtil.createPskNetwork();
- verifyAddNetworkToWifiConfigManager(network);
-
- long wallClockBase = 0;
- // Create 5 scan results with different bssid's & frequencies.
- String test_bssid_base = "af:89:56:34:56:6";
- for (int i = 0; i < TEST_FREQ_LIST.length; i++) {
- // Increment the seen value in the scan results for each of them.
- when(mClock.getWallClockMillis()).thenReturn(wallClockBase + i);
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
-
- }
- int ageInMillis = 4;
- // Now fetch only scan results which are 4 millis stale. This should ignore the first
- // scan result.
- assertEquals(
- new HashSet<>(Arrays.asList(
- Arrays.copyOfRange(
- TEST_FREQ_LIST,
- TEST_FREQ_LIST.length - ageInMillis, TEST_FREQ_LIST.length))),
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(
- network.networkId, ageInMillis, TEST_FREQ_LIST[4]));
- }
-
- /**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)} and
- * ensures that the list size does not exceed the max configured for the device.
- */
- @Test
- public void testFetchChannelSetForNetworkIsLimitedToConfiguredSize() {
- // Need to recreate the WifiConfigManager instance for this test to modify the config
- // value which is read only in the constructor.
- int maxListSize = 3;
- mResources.setInteger(
- R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels,
- maxListSize);
- createWifiConfigManager();
-
- WifiConfiguration network = WifiConfigurationTestUtil.createPskNetwork();
- verifyAddNetworkToWifiConfigManager(network);
-
- // Create 5 scan results with different bssid's & frequencies.
- String test_bssid_base = "af:89:56:34:56:6";
- for (int i = 0; i < TEST_FREQ_LIST.length; i++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network, test_bssid_base + Integer.toString(i), 0, TEST_FREQ_LIST[i]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- verify(mPerNetwork).addFrequency(TEST_FREQ_LIST[i]);
-
- }
- // Ensure that the fetched list size is limited.
- assertEquals(maxListSize,
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(
- network.networkId, 1, TEST_FREQ_LIST[4]).size());
- }
-
- /**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)} and
- * ensures that scan results from linked networks are used in the channel list.
- */
- @Test
- public void testFetchChannelSetForNetworkIncludesLinkedNetworks() {
- WifiConfiguration network1 = WifiConfigurationTestUtil.createPskNetwork();
- WifiConfiguration network2 = WifiConfigurationTestUtil.createPskNetwork();
- verifyAddNetworkToWifiConfigManager(network1);
- verifyAddNetworkToWifiConfigManager(network2);
-
- String test_bssid_base = "af:89:56:34:56:6";
- int TEST_FREQ_LISTIdx = 0;
- // Create 3 scan results with different bssid's & frequencies for network 1.
- for (; TEST_FREQ_LISTIdx < TEST_FREQ_LIST.length / 2; TEST_FREQ_LISTIdx++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network1, test_bssid_base + Integer.toString(TEST_FREQ_LISTIdx), 0,
- TEST_FREQ_LIST[TEST_FREQ_LISTIdx]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
-
- }
- // Create 3 scan results with different bssid's & frequencies for network 2.
- for (; TEST_FREQ_LISTIdx < TEST_FREQ_LIST.length; TEST_FREQ_LISTIdx++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network2, test_bssid_base + Integer.toString(TEST_FREQ_LISTIdx), 0,
- TEST_FREQ_LIST[TEST_FREQ_LISTIdx]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- }
-
- // Link the 2 configurations together using the GwMacAddress.
- assertTrue(mWifiConfigManager.setNetworkDefaultGwMacAddress(
- network1.networkId, TEST_DEFAULT_GW_MAC_ADDRESS));
- assertTrue(mWifiConfigManager.setNetworkDefaultGwMacAddress(
- network2.networkId, TEST_DEFAULT_GW_MAC_ADDRESS));
-
- // The channel list fetched should include scan results from both the linked networks.
- assertEquals(new HashSet<Integer>(Arrays.asList(TEST_FREQ_LIST)),
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(network1.networkId, 1,
- TEST_FREQ_LIST[0]));
- assertEquals(new HashSet<Integer>(Arrays.asList(TEST_FREQ_LIST)),
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(network2.networkId, 1,
- TEST_FREQ_LIST[0]));
- }
-
- /**
- * Verifies the creation of channel list using
- * {@link WifiConfigManager#fetchChannelSetForNetworkForPartialScan(int, long, int)} and
- * ensures that scan results from linked networks are used in the channel list and that the
- * list size does not exceed the max configured for the device.
- */
- @Test
- public void testFetchChannelSetForNetworkIncludesLinkedNetworksIsLimitedToConfiguredSize() {
- // Need to recreate the WifiConfigManager instance for this test to modify the config
- // value which is read only in the constructor.
- int maxListSize = 3;
- mResources.setInteger(
- R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels,
- maxListSize);
-
- createWifiConfigManager();
- WifiConfiguration network1 = WifiConfigurationTestUtil.createPskNetwork();
- WifiConfiguration network2 = WifiConfigurationTestUtil.createPskNetwork();
- verifyAddNetworkToWifiConfigManager(network1);
- verifyAddNetworkToWifiConfigManager(network2);
-
- String test_bssid_base = "af:89:56:34:56:6";
- int TEST_FREQ_LISTIdx = 0;
- // Create 3 scan results with different bssid's & frequencies for network 1.
- for (; TEST_FREQ_LISTIdx < TEST_FREQ_LIST.length / 2; TEST_FREQ_LISTIdx++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network1, test_bssid_base + Integer.toString(TEST_FREQ_LISTIdx), 0,
- TEST_FREQ_LIST[TEST_FREQ_LISTIdx]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
-
- }
- // Create 3 scan results with different bssid's & frequencies for network 2.
- for (; TEST_FREQ_LISTIdx < TEST_FREQ_LIST.length; TEST_FREQ_LISTIdx++) {
- ScanDetail networkScanDetail =
- createScanDetailForNetwork(
- network2, test_bssid_base + Integer.toString(TEST_FREQ_LISTIdx), 0,
- TEST_FREQ_LIST[TEST_FREQ_LISTIdx]);
- assertNotNull(
- mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(
- networkScanDetail));
- }
-
- // Link the 2 configurations together using the GwMacAddress.
- assertTrue(mWifiConfigManager.setNetworkDefaultGwMacAddress(
- network1.networkId, TEST_DEFAULT_GW_MAC_ADDRESS));
- assertTrue(mWifiConfigManager.setNetworkDefaultGwMacAddress(
- network2.networkId, TEST_DEFAULT_GW_MAC_ADDRESS));
-
- // Ensure that the fetched list size is limited.
- assertEquals(maxListSize,
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(
- network1.networkId, 1, TEST_FREQ_LIST[0]).size());
- assertEquals(maxListSize,
- mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(
- network2.networkId, 1, TEST_FREQ_LIST[0]).size());
- }
-
- /**
* Verifies the foreground user switch using {@link WifiConfigManager#handleUserSwitch(int)}
* and ensures that any shared private networks networkId is not changed.
* Test scenario:
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
index ede5c8b7a..d66f6ddb8 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
@@ -231,6 +231,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
private static final int TEST_FREQUENCY_1 = 2412;
private static final int TEST_FREQUENCY_2 = 5180;
private static final int TEST_FREQUENCY_3 = 5240;
+ private static final int TEST_CURRENT_CONNECTED_FREQUENCY = 2427;
private static final int HIGH_MVMT_SCAN_DELAY_MS = 10000;
private static final int HIGH_MVMT_RSSI_DELTA = 10;
private static final String TEST_FQDN = "FQDN";
@@ -397,7 +398,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
mWifiConfigManager, mWifiInfo, mWifiNS, mWifiConnectivityHelper,
mWifiLastResortWatchdog, mOpenNetworkNotifier,
mWifiMetrics, new Handler(mLooper.getLooper()), mClock,
- mLocalLog);
+ mLocalLog, mWifiScoreCard);
}
void setWifiStateConnected() {
@@ -1767,15 +1768,18 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(false);
when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(false);
- final HashSet<Integer> channelList = new HashSet<>();
- channelList.add(1);
- channelList.add(2);
- channelList.add(3);
-
+ final List<Integer> channelList = new ArrayList<>();
+ channelList.add(TEST_FREQUENCY_1);
+ channelList.add(TEST_FREQUENCY_2);
+ channelList.add(TEST_FREQUENCY_3);
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
when(mClientModeImpl.getCurrentWifiConfiguration())
- .thenReturn(new WifiConfiguration());
- when(mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(anyInt(), anyLong(),
- anyInt())).thenReturn(channelList);
+ .thenReturn(configuration);
+ when(mWifiScoreCard.lookupNetwork(configuration.SSID)).thenReturn(mPerNetwork);
+ when(mPerNetwork.getFrequencies()).thenReturn(channelList);
doAnswer(new AnswerWithArguments() {
public void answer(ScanSettings settings, ScanListener listener,
@@ -1821,15 +1825,24 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(true);
when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(false);
- final HashSet<Integer> channelList = new HashSet<>();
- channelList.add(1);
- channelList.add(2);
- channelList.add(3);
+ mResources.setInteger(
+ R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels,
+ 10);
+
+ final List<Integer> channelList = new ArrayList<>();
+ channelList.add(TEST_FREQUENCY_1);
+ channelList.add(TEST_FREQUENCY_2);
+ channelList.add(TEST_FREQUENCY_3);
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
+ when(mWifiScoreCard.lookupNetwork(configuration.SSID)).thenReturn(mPerNetwork);
+ when(mPerNetwork.getFrequencies()).thenReturn(channelList);
when(mClientModeImpl.getCurrentWifiConfiguration())
- .thenReturn(new WifiConfiguration());
- when(mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(anyInt(), anyLong(),
- anyInt())).thenReturn(channelList);
+ .thenReturn(configuration);
+
when(mWifiConnectivityHelper.isFirmwareRoamingSupported()).thenReturn(false);
doAnswer(new AnswerWithArguments() {
@@ -1866,15 +1879,23 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(false);
when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(true);
- final HashSet<Integer> channelList = new HashSet<>();
- channelList.add(1);
- channelList.add(2);
- channelList.add(3);
+ mResources.setInteger(
+ R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels,
+ 10);
+
+ final List<Integer> channelList = new ArrayList<>();
+ channelList.add(TEST_FREQUENCY_1);
+ channelList.add(TEST_FREQUENCY_2);
+ channelList.add(TEST_FREQUENCY_3);
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
+ when(mWifiScoreCard.lookupNetwork(configuration.SSID)).thenReturn(mPerNetwork);
+ when(mPerNetwork.getFrequencies()).thenReturn(channelList);
when(mClientModeImpl.getCurrentWifiConfiguration())
- .thenReturn(new WifiConfiguration());
- when(mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(anyInt(), anyLong(),
- anyInt())).thenReturn(channelList);
+ .thenReturn(configuration);
when(mWifiConnectivityHelper.isFirmwareRoamingSupported()).thenReturn(false);
doAnswer(new AnswerWithArguments() {
@@ -1911,12 +1932,19 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(true);
when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(true);
- final HashSet<Integer> channelList = new HashSet<>();
+ final List<Integer> channelList = new ArrayList<>();
+ channelList.add(TEST_FREQUENCY_1);
+ channelList.add(TEST_FREQUENCY_2);
+ channelList.add(TEST_FREQUENCY_3);
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
+ when(mWifiScoreCard.lookupNetwork(configuration.SSID)).thenReturn(mPerNetwork);
+ when(mPerNetwork.getFrequencies()).thenReturn(channelList);
when(mClientModeImpl.getCurrentWifiConfiguration())
.thenReturn(new WifiConfiguration());
- when(mWifiConfigManager.fetchChannelSetForNetworkForPartialScan(anyInt(), anyLong(),
- anyInt())).thenReturn(channelList);
doAnswer(new AnswerWithArguments() {
public void answer(ScanSettings settings, Executor executor, ScanListener listener,
@@ -2924,7 +2952,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
// Retrieve the Pno network list & verify.
List<WifiScanner.PnoSettings.PnoNetwork> pnoNetworks =
mWifiConnectivityManager.retrievePnoNetworkList();
- verify(mWifiNetworkSuggestionsManager).getAllPnoAvailableSuggestionNetworks();
+ verify(mWifiNetworkSuggestionsManager).getAllScanOptimizationSuggestionNetworks();
assertEquals(3, pnoNetworks.size());
assertEquals(network1.SSID, pnoNetworks.get(0).ssid);
assertEquals(network2.SSID, pnoNetworks.get(1).ssid);
@@ -3032,4 +3060,105 @@ public class WifiConnectivityManagerTest extends WifiBaseTest {
assertEquals(network2.SSID, pnoNetworks.get(1).ssid);
assertEquals(network1.SSID, pnoNetworks.get(2).ssid);
}
+
+ private List<List<Integer>> linkScoreCardFreqsToNetwork(WifiConfiguration... configs) {
+ List<List<Integer>> results = new ArrayList<>();
+ int i = 0;
+ for (WifiConfiguration config : configs) {
+ List<Integer> channelList = new ArrayList<>();
+ channelList.add(TEST_FREQUENCY_1 + i);
+ channelList.add(TEST_FREQUENCY_2 + i);
+ channelList.add(TEST_FREQUENCY_3 + i);
+ WifiScoreCard.PerNetwork perNetwork = mock(WifiScoreCard.PerNetwork.class);
+ when(mWifiScoreCard.lookupNetwork(config.SSID)).thenReturn(perNetwork);
+ when(perNetwork.getFrequencies()).thenReturn(channelList);
+ results.add(channelList);
+ i++;
+ }
+ return results;
+ }
+
+ /**
+ * Verify that the length of frequency set will not exceed the provided max value
+ */
+ @Test
+ public void testFetchChannelSetForPartialScanMaxCount() {
+ WifiConfiguration configuration1 = WifiConfigurationTestUtil.createOpenNetwork();
+ WifiConfiguration configuration2 = WifiConfigurationTestUtil.createOpenNetwork();
+ when(mWifiConfigManager.getSavedNetworks(anyInt()))
+ .thenReturn(Arrays.asList(configuration1, configuration2));
+
+ List<List<Integer>> freqs = linkScoreCardFreqsToNetwork(configuration1, configuration2);
+
+ mLruConnectionTracker.addNetwork(configuration2);
+ mLruConnectionTracker.addNetwork(configuration1);
+
+ assertEquals(new HashSet<>(freqs.get(0)),
+ mWifiConnectivityManager.fetchChannelSetForPartialScan(3));
+ }
+
+ /**
+ * Verifies the creation of channel list using
+ * {@link WifiConnectivityManager#fetchChannelSetForNetworkForPartialScan(int)}.
+ */
+ @Test
+ public void testFetchChannelSetForNetwork() {
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
+ List<List<Integer>> freqs = linkScoreCardFreqsToNetwork(configuration);
+
+ assertEquals(new HashSet<>(freqs.get(0)), mWifiConnectivityManager
+ .fetchChannelSetForNetworkForPartialScan(configuration.networkId));
+ }
+
+ /**
+ * Verifies the creation of channel list using
+ * {@link WifiConnectivityManager#fetchChannelSetForNetworkForPartialScan(int)} and
+ * ensures that the frequenecy of the currently connected network is in the returned
+ * channel set.
+ */
+ @Test
+ public void testFetchChannelSetForNetworkIncludeCurrentNetwork() {
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
+ linkScoreCardFreqsToNetwork(configuration);
+
+ mWifiInfo.setFrequency(TEST_CURRENT_CONNECTED_FREQUENCY);
+
+ // Currently connected network frequency 2427 is not in the TEST_FREQ_LIST
+ Set<Integer> freqs = mWifiConnectivityManager.fetchChannelSetForNetworkForPartialScan(
+ configuration.networkId);
+
+ assertTrue(freqs.contains(2427));
+ }
+
+ /**
+ * Verifies the creation of channel list using
+ * {@link WifiConnectivityManager#fetchChannelSetForNetworkForPartialScan(int)} and
+ * ensures that the list size does not exceed the max configured for the device.
+ */
+ @Test
+ public void testFetchChannelSetForNetworkIsLimitedToConfiguredSize() {
+ // Need to recreate the WifiConfigManager instance for this test to modify the config
+ // value which is read only in the constructor.
+ int maxListSize = 2;
+ mResources.setInteger(
+ R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels,
+ maxListSize);
+
+ WifiConfiguration configuration = WifiConfigurationTestUtil.createOpenNetwork();
+ configuration.networkId = TEST_CONNECTED_NETWORK_ID;
+ when(mWifiConfigManager.getConfiguredNetwork(TEST_CONNECTED_NETWORK_ID))
+ .thenReturn(configuration);
+ List<List<Integer>> freqs = linkScoreCardFreqsToNetwork(configuration);
+ // Ensure that the fetched list size is limited.
+ Set<Integer> results = mWifiConnectivityManager.fetchChannelSetForNetworkForPartialScan(
+ configuration.networkId);
+ assertEquals(maxListSize, results.size());
+ assertFalse(results.contains(freqs.get(0).get(2)));
+ }
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
index bb090cae5..f53b4c41e 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
@@ -3582,7 +3582,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
}
/**
- * Verify getAllPnoAvailableSuggestionNetworks will only return user approved,
+ * Verify getAllScanOptimizationSuggestionNetworks will only return user approved,
* non-passpoint network.
*/
@Test
@@ -3605,10 +3605,11 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS,
mWifiNetworkSuggestionsManager
.add(networkSuggestionList, TEST_UID_1, TEST_PACKAGE_1, TEST_FEATURE));
- assertTrue(mWifiNetworkSuggestionsManager.getAllPnoAvailableSuggestionNetworks().isEmpty());
+ assertTrue(mWifiNetworkSuggestionsManager
+ .getAllScanOptimizationSuggestionNetworks().isEmpty());
mWifiNetworkSuggestionsManager.setHasUserApprovedForApp(true, TEST_PACKAGE_1);
List<WifiConfiguration> pnoNetwork =
- mWifiNetworkSuggestionsManager.getAllPnoAvailableSuggestionNetworks();
+ mWifiNetworkSuggestionsManager.getAllScanOptimizationSuggestionNetworks();
assertEquals(1, pnoNetwork.size());
assertEquals(network1.SSID, pnoNetwork.get(0).SSID);
}