summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Wills <mwills@google.com>2016-09-12 21:18:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-09-12 21:18:01 +0000
commitc6499c03ffeddecb4cda5df79c69e0d0a7677f9a (patch)
treef4ddcf9ba649c4bfd2c1b2be8681e5b7c471299b
parent8440999dcfbe198a0e4031714bfdc27c78aeedaa (diff)
parent4e1f32efceee1db37bfb1e2624b434dbfb055686 (diff)
Add a flag to indicate if a ScanData is for a scan for all channels
am: 4e1f32efce Change-Id: I2bf308cfd12827d268913954da139e7ed0bac288
-rw-r--r--service/java/com/android/server/wifi/scanner/ChannelHelper.java4
-rw-r--r--service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java6
-rw-r--r--service/java/com/android/server/wifi/scanner/NoBandChannelHelper.java5
-rw-r--r--service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ScanResults.java23
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java25
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java30
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/NoBandChannelHelperTest.java12
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java28
11 files changed, 123 insertions, 32 deletions
diff --git a/service/java/com/android/server/wifi/scanner/ChannelHelper.java b/service/java/com/android/server/wifi/scanner/ChannelHelper.java
index d4168123d..acb0ac820 100644
--- a/service/java/com/android/server/wifi/scanner/ChannelHelper.java
+++ b/service/java/com/android/server/wifi/scanner/ChannelHelper.java
@@ -100,6 +100,10 @@ public abstract class ChannelHelper {
*/
public abstract boolean isEmpty();
/**
+ * @return true if the collection contains all available channels
+ */
+ public abstract boolean isAllChannels();
+ /**
* Remove all channels from the collection
*/
public abstract void clear();
diff --git a/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java b/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java
index b180da71d..acddc26c6 100644
--- a/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java
+++ b/service/java/com/android/server/wifi/scanner/KnownBandsChannelHelper.java
@@ -198,6 +198,12 @@ public class KnownBandsChannelHelper extends ChannelHelper {
}
@Override
+ public boolean isAllChannels() {
+ return getAvailableScanChannels(WifiScanner.WIFI_BAND_BOTH_WITH_DFS).length ==
+ mChannels.size();
+ }
+
+ @Override
public void clear() {
mAllBands = 0;
mExactBands = 0;
diff --git a/service/java/com/android/server/wifi/scanner/NoBandChannelHelper.java b/service/java/com/android/server/wifi/scanner/NoBandChannelHelper.java
index 7b1602008..4f8373b30 100644
--- a/service/java/com/android/server/wifi/scanner/NoBandChannelHelper.java
+++ b/service/java/com/android/server/wifi/scanner/NoBandChannelHelper.java
@@ -112,6 +112,11 @@ public class NoBandChannelHelper extends ChannelHelper {
}
@Override
+ public boolean isAllChannels() {
+ return mAllChannels;
+ }
+
+ @Override
public void clear() {
mAllChannels = false;
mChannels.clear();
diff --git a/service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java b/service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java
index 4554d20e7..f0cac0fb6 100644
--- a/service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java
+++ b/service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java
@@ -637,7 +637,8 @@ public class SupplicantWifiScannerImpl extends WifiScannerImpl implements Handle
}
}
Collections.sort(singleScanResults, SCAN_RESULT_SORT_COMPARATOR);
- mLatestSingleScanResult = new WifiScanner.ScanData(mLastScanSettings.scanId, 0,
+ mLatestSingleScanResult = new WifiScanner.ScanData(mLastScanSettings.scanId, 0, 0,
+ mLastScanSettings.singleScanFreqs.isAllChannels(),
singleScanResults.toArray(new ScanResult[singleScanResults.size()]));
mLastScanSettings.singleScanEventHandler
.onScanStatus(WifiNative.WIFI_SCAN_RESULTS_AVAILABLE);
diff --git a/tests/wifitests/src/com/android/server/wifi/ScanResults.java b/tests/wifitests/src/com/android/server/wifi/ScanResults.java
index 160902081..fc532701f 100644
--- a/tests/wifitests/src/com/android/server/wifi/ScanResults.java
+++ b/tests/wifitests/src/com/android/server/wifi/ScanResults.java
@@ -138,21 +138,29 @@ public class ScanResults {
* @see #generateNativeResults for more details on how results are generated
*/
public static ScanResults create(int id, int... freqs) {
- return new ScanResults(id, -1, generateNativeResults(id, freqs));
+ return create(id, generateNativeResults(id, freqs));
+ }
+ public static ScanResults create(int id, boolean allChannelsScanned, int... freqs) {
+ return create(id, allChannelsScanned, generateNativeResults(id, freqs));
}
/**
* Create a ScanResults with no IE information.
*/
public static ScanResults createWithNoIE(int id, int... freqs) {
- return new ScanResults(id, -1, generateNativeResults(false, id, freqs));
+ return create(id, generateNativeResults(false, id, freqs));
}
/**
* Create a ScanResults with the given ScanDetails
*/
public static ScanResults create(int id, ScanDetail... nativeResults) {
- return new ScanResults(id, -1, nativeResults);
+ return new ScanResults(id, false, -1, nativeResults);
+ }
+
+ public static ScanResults create(int id, boolean allChannelsScanned,
+ ScanDetail... nativeResults) {
+ return new ScanResults(id, allChannelsScanned, -1, nativeResults);
}
/**
@@ -162,10 +170,11 @@ public class ScanResults {
*/
public static ScanResults createOverflowing(int id, int maxResults,
ScanDetail... nativeResults) {
- return new ScanResults(id, maxResults, nativeResults);
+ return new ScanResults(id, false, maxResults, nativeResults);
}
- private ScanResults(int id, int maxResults, ScanDetail... nativeResults) {
+ private ScanResults(int id, boolean allChannelsScanned, int maxResults,
+ ScanDetail... nativeResults) {
mScanResults = new ScanResult[nativeResults.length];
for (int i = 0; i < nativeResults.length; ++i) {
mScanDetails.add(nativeResults[i]);
@@ -173,13 +182,13 @@ public class ScanResults {
}
ScanResult[] sortedScanResults = Arrays.copyOf(mScanResults, mScanResults.length);
Arrays.sort(sortedScanResults, SCAN_RESULT_RSSI_COMPARATOR);
- mRawScanData = new ScanData(id, 0, sortedScanResults);
+ mRawScanData = new ScanData(id, 0, 0, allChannelsScanned, sortedScanResults);
if (maxResults == -1) {
mScanData = mRawScanData;
} else {
ScanResult[] reducedScanResults = Arrays.copyOf(sortedScanResults,
Math.min(sortedScanResults.length, maxResults));
- mScanData = new ScanData(id, 0, reducedScanResults);
+ mScanData = new ScanData(id, 0, 0, allChannelsScanned, reducedScanResults);
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java b/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java
index 8228118d8..7a1bdd20b 100644
--- a/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java
+++ b/tests/wifitests/src/com/android/server/wifi/ScanTestUtil.java
@@ -217,7 +217,7 @@ public class ScanTestUtil {
for (int i = 0; i < freqs.length; ++i) {
results[i] = createScanResult(freqs[i]);
}
- return new ScanData(0, 0, bucketsScanned, results);
+ return new ScanData(0, 0, bucketsScanned, false, results);
}
public static ScanData[] createScanDatas(int[][] freqs, int[] bucketsScanned) {
@@ -272,6 +272,8 @@ public class ScanTestUtil {
assertNotNull(prefix + "actual ScanData was null", actual);
assertEquals(prefix + "id", expected.getId(), actual.getId());
assertEquals(prefix + "flags", expected.getFlags(), actual.getFlags());
+ assertEquals(prefix + "all channels", expected.isAllChannelsScanned(),
+ actual.isAllChannelsScanned());
assertScanResultsEquals(prefix, expected.getResults(), actual.getResults());
}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java
index 1355961c1..767cddfea 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/BaseWifiScannerImplTest.java
@@ -89,6 +89,12 @@ public abstract class BaseWifiScannerImplTest {
when(mClock.elapsedRealtime()).thenReturn(SystemClock.elapsedRealtime());
}
+ protected boolean isAllChannelsScanned(int band) {
+ ChannelCollection collection = mScanner.getChannelHelper().createChannelCollection();
+ collection.addBand(band);
+ return collection.isAllChannels();
+ }
+
protected Set<Integer> expectedBandScanFreqs(int band) {
ChannelCollection collection = mScanner.getChannelHelper().createChannelCollection();
collection.addBand(band);
@@ -115,7 +121,8 @@ public abstract class BaseWifiScannerImplTest {
doSuccessfulSingleScanTest(settings, expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ),
new HashSet<Integer>(),
- ScanResults.create(0, 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450), false);
+ ScanResults.create(0, isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ),
+ 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450), false);
}
@Test
@@ -144,7 +151,8 @@ public abstract class BaseWifiScannerImplTest {
doSuccessfulSingleScanTest(settings, expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ),
new HashSet<Integer>(),
- ScanResults.create(0, 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450), true);
+ ScanResults.create(0, isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ),
+ 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450), true);
}
/**
@@ -346,7 +354,7 @@ public abstract class BaseWifiScannerImplTest {
.withBasePeriod(10000)
.withMaxApPerScan(10)
.addBucketWithBand(10000, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN,
- WifiScanner.WIFI_BAND_5_GHZ)
+ WifiScanner.WIFI_BAND_BOTH_WITH_DFS)
.build();
WifiNative.ScanEventHandler eventHandler = mock(WifiNative.ScanEventHandler.class);
@@ -361,15 +369,17 @@ public abstract class BaseWifiScannerImplTest {
expectSuccessfulSingleScan(order, eventHandler,
expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ),
new HashSet<Integer>(),
- ScanResults.create(0, 2400, 2450, 2450), false);
+ ScanResults.create(0, isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ),
+ 2400, 2450, 2450), false);
// start second scan
assertTrue(mScanner.startSingleScan(settings2, eventHandler));
expectSuccessfulSingleScan(order, eventHandler,
- expectedBandScanFreqs(WifiScanner.WIFI_BAND_5_GHZ),
+ expectedBandScanFreqs(WifiScanner.WIFI_BAND_BOTH_WITH_DFS),
new HashSet<Integer>(),
- ScanResults.create(0, 5150, 5175), false);
+ ScanResults.create(0, true,
+ 5150, 5175), false);
verifyNoMoreInteractions(eventHandler);
}
@@ -412,7 +422,8 @@ public abstract class BaseWifiScannerImplTest {
}
ArrayList<ScanResult> scanDataResults = new ArrayList<>(fullResults);
Collections.sort(scanDataResults, ScanResults.SCAN_RESULT_RSSI_COMPARATOR);
- ScanData scanData = new ScanData(0, 0,
+ ScanData scanData = new ScanData(0, 0, 0,
+ isAllChannelsScanned(WifiScanner.WIFI_BAND_24_GHZ),
scanDataResults.toArray(new ScanResult[scanDataResults.size()]));
Set<Integer> expectedScan = expectedBandScanFreqs(WifiScanner.WIFI_BAND_24_GHZ);
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java
index ed466835d..3e482a9fe 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/KnownBandsChannelHelperTest.java
@@ -290,6 +290,7 @@ public class KnownBandsChannelHelperTest {
assertTrue(mChannelCollection.isEmpty());
assertFalse(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -310,6 +311,7 @@ public class KnownBandsChannelHelperTest {
assertTrue(mChannelCollection.isEmpty());
assertFalse(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -329,6 +331,7 @@ public class KnownBandsChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -348,6 +351,7 @@ public class KnownBandsChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -368,6 +372,7 @@ public class KnownBandsChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -388,6 +393,7 @@ public class KnownBandsChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -408,6 +414,7 @@ public class KnownBandsChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertTrue(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -428,6 +435,7 @@ public class KnownBandsChannelHelperTest {
assertTrue(mChannelCollection.containsChannel(2400));
assertTrue(mChannelCollection.containsChannel(5150));
assertTrue(mChannelCollection.containsChannel(5600));
+ assertTrue(mChannelCollection.isAllChannels());
}
/**
@@ -442,6 +450,7 @@ public class KnownBandsChannelHelperTest {
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, 2);
assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -456,6 +465,27 @@ public class KnownBandsChannelHelperTest {
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, 2);
assertThat(bucketSettings, bandIs(WifiScanner.WIFI_BAND_BOTH));
+ assertFalse(mChannelCollection.isAllChannels());
+ }
+
+
+ /**
+ * Add enough channels across all bands that the max channels is exceeded
+ */
+ @Test
+ public void addChannel_addAllAvailableChannels() {
+ mChannelCollection.addChannel(2400);
+ mChannelCollection.addChannel(2450);
+ mChannelCollection.addChannel(5150);
+ mChannelCollection.addChannel(5175);
+ mChannelCollection.addChannel(5600);
+ mChannelCollection.addChannel(5650);
+ mChannelCollection.addChannel(5660);
+
+ WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
+ mChannelCollection.fillBucketSettings(bucketSettings, Integer.MAX_VALUE);
+ assertThat(bucketSettings, channelsAre(2400, 2450, 5150, 5175, 5600, 5650, 5660));
+ assertTrue(mChannelCollection.isAllChannels());
}
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/NoBandChannelHelperTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/NoBandChannelHelperTest.java
index cbf6fe5d1..2863b9f90 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/NoBandChannelHelperTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/NoBandChannelHelperTest.java
@@ -199,7 +199,7 @@ public class NoBandChannelHelperTest {
* {@link com.android.server.wifi.scanner.NoBandChannelHelper.NoBandChannelCollection}.
*/
@SmallTest
- public static class KnownBandsChannelCollectionTest {
+ public static class NoBandsChannelCollectionTest {
ChannelHelper.ChannelCollection mChannelCollection;
/**
@@ -225,6 +225,7 @@ public class NoBandChannelHelperTest {
assertTrue(mChannelCollection.isEmpty());
assertFalse(mChannelCollection.containsChannel(2400));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -244,6 +245,7 @@ public class NoBandChannelHelperTest {
assertTrue(mChannelCollection.isEmpty());
assertFalse(mChannelCollection.containsChannel(2400));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -262,6 +264,7 @@ public class NoBandChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertTrue(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.isAllChannels());
}
/**
@@ -281,6 +284,7 @@ public class NoBandChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -301,6 +305,7 @@ public class NoBandChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertFalse(mChannelCollection.containsChannel(5150));
+ assertFalse(mChannelCollection.isAllChannels());
}
/**
@@ -320,6 +325,7 @@ public class NoBandChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertTrue(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.isAllChannels());
}
/**
@@ -339,6 +345,7 @@ public class NoBandChannelHelperTest {
assertFalse(mChannelCollection.isEmpty());
assertTrue(mChannelCollection.containsChannel(2400));
assertTrue(mChannelCollection.containsChannel(5150));
+ assertTrue(mChannelCollection.isAllChannels());
}
/**
@@ -359,6 +366,7 @@ public class NoBandChannelHelperTest {
assertTrue(mChannelCollection.containsChannel(2400));
assertTrue(mChannelCollection.containsChannel(5150));
assertTrue(mChannelCollection.containsChannel(5600));
+ assertTrue(mChannelCollection.isAllChannels());
}
/**
@@ -373,6 +381,7 @@ public class NoBandChannelHelperTest {
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, 2);
assertThat(bucketSettings, bandIs(ALL_BANDS));
+ assertFalse(mChannelCollection.isAllChannels()); // can't determine from just channels
}
/**
@@ -387,6 +396,7 @@ public class NoBandChannelHelperTest {
WifiNative.BucketSettings bucketSettings = new WifiNative.BucketSettings();
mChannelCollection.fillBucketSettings(bucketSettings, 2);
assertThat(bucketSettings, bandIs(ALL_BANDS));
+ assertFalse(mChannelCollection.isAllChannels()); // can't determine from just channels
}
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
index 67a8924fa..560710f79 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
@@ -91,7 +91,7 @@ public class SupplicantPnoScannerTest {
WifiNative.PnoEventHandler pnoEventHandler = mock(WifiNative.PnoEventHandler.class);
WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(false);
- ScanResults scanResults = createDummyScanResults();
+ ScanResults scanResults = createDummyScanResults(false);
InOrder order = inOrder(pnoEventHandler, mWifiNative);
// Start PNO scan
@@ -112,7 +112,7 @@ public class SupplicantPnoScannerTest {
WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(false);
WifiNative.ScanEventHandler eventHandler = mock(WifiNative.ScanEventHandler.class);
WifiNative.ScanSettings settings = createDummyScanSettings();
- ScanResults scanResults = createDummyScanResults();
+ ScanResults scanResults = createDummyScanResults(true);
InOrder order = inOrder(eventHandler, mWifiNative);
// Start PNO scan
@@ -182,7 +182,7 @@ public class SupplicantPnoScannerTest {
WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(false);
WifiNative.ScanEventHandler eventHandler = mock(WifiNative.ScanEventHandler.class);
WifiNative.ScanSettings settings = createDummyScanSettings();
- ScanResults scanResults = createDummyScanResults();
+ ScanResults scanResults = createDummyScanResults(true);
InOrder order = inOrder(eventHandler, mWifiNative);
// Start PNO scan
@@ -247,7 +247,7 @@ public class SupplicantPnoScannerTest {
SupplicantWifiScannerImpl.HwPnoDebouncer.PNO_DEBOUNCER_ALARM_TAG));
mLooper.dispatchAll();
InOrder order = inOrder(pnoEventHandler, mWifiNative);
- ScanResults scanResults = createDummyScanResults();
+ ScanResults scanResults = createDummyScanResults(false);
expectSuccessfulHwDisconnectedPnoScan(order, pnoSettings, pnoEventHandler, scanResults);
verifyNoMoreInteractions(pnoEventHandler);
}
@@ -334,7 +334,7 @@ public class SupplicantPnoScannerTest {
WifiNative.PnoSettings pnoSettings = createDummyPnoSettings(isConnectedPno);
WifiNative.ScanEventHandler scanEventHandler = mock(WifiNative.ScanEventHandler.class);
WifiNative.ScanSettings scanSettings = createDummyScanSettings();
- ScanResults scanResults = createDummyScanResults();
+ ScanResults scanResults = createDummyScanResults(false);
InOrder order = inOrder(scanEventHandler, mWifiNative);
@@ -385,8 +385,9 @@ public class SupplicantPnoScannerTest {
return settings;
}
- private ScanResults createDummyScanResults() {
- return ScanResults.create(0, 2400, 2450, 2450, 2400, 2450, 2450, 2400, 2450, 2450);
+ private ScanResults createDummyScanResults(boolean allChannelsScanned) {
+ return ScanResults.create(0, allChannelsScanned, 2400, 2450, 2450, 2400, 2450, 2450, 2400,
+ 2450, 2450);
}
private void startSuccessfulPnoScan(WifiNative.ScanSettings scanSettings,
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
index 03a11dceb..b18e4cc61 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -371,7 +371,7 @@ public class WifiScanningServiceTest {
assertTrue("dump did not contain log with type=" + type + ", id=" + id +
": " + serviceDump + "\n",
logLineRegex.matcher(serviceDump).find());
- }
+ }
private void assertDumpContainsCallbackLog(String callback, int id, String extra) {
String serviceDump = dumpService();
@@ -382,7 +382,7 @@ public class WifiScanningServiceTest {
assertTrue("dump did not contain callback log with callback=" + callback + ", id=" + id +
", extra=" + extra + ": " + serviceDump + "\n",
logLineRegex.matcher(serviceDump).find());
- }
+ }
@Test
public void construct() throws Exception {
@@ -507,10 +507,10 @@ public class WifiScanningServiceTest {
*/
@Test
public void sendSingleScanBandRequest() throws Exception {
- WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
- 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
+ WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH_WITH_DFS,
+ 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
- ScanResults.create(0, 2400, 5150, 5175));
+ ScanResults.create(0, true, 2400, 5150, 5175));
}
/**
@@ -518,13 +518,25 @@ public class WifiScanningServiceTest {
*/
@Test
public void sendSingleScanChannelsRequest() throws Exception {
- WifiScanner.ScanSettings requestSettings = createRequest(WifiScanner.WIFI_BAND_BOTH, 0,
- 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
+ WifiScanner.ScanSettings requestSettings = createRequest(channelsToSpec(2400, 5150, 5175),
+ 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
ScanResults.create(0, 2400, 5150, 5175));
}
/**
+ * Do a single scan for a list of all channels and verify that it is successful.
+ */
+ @Test
+ public void sendSingleScanAllChannelsRequest() throws Exception {
+ WifiScanner.ScanSettings requestSettings = createRequest(
+ channelsToSpec(2400, 2450, 5150, 5175, 5600, 5650, 5660),
+ 0, 0, 20, WifiScanner.REPORT_EVENT_AFTER_EACH_SCAN);
+ doSuccessfulSingleScan(requestSettings, computeSingleScanNativeSettings(requestSettings),
+ ScanResults.create(0, true, 2400, 5150, 5175));
+ }
+
+ /**
* Do a single scan with no results and verify that it is successful.
*/
@Test