summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNingyuan Wang2017-08-01 23:04:10 -0500
committerandroid-build-merger2017-08-01 23:04:10 -0500
commit4e0dae3ad00a59cf70c3b385c74e8a74d9f11487 (patch)
tree3eff1f8dc89d997244abd7ab0e19fd66727612f6
parent7fcbe884c8b6f3957ef8bbb38335f7cbd408f070 (diff)
parent42a0681f1701c7b7a921d75a9a5667406022810e (diff)
downloadsystem-connectivity-wificond-4e0dae3ad00a59cf70c3b385c74e8a74d9f11487.tar.gz
system-connectivity-wificond-4e0dae3ad00a59cf70c3b385c74e8a74d9f11487.tar.xz
system-connectivity-wificond-4e0dae3ad00a59cf70c3b385c74e8a74d9f11487.zip
Support scan plan attribute for scheduled scan am: dfbe7e4e12
am: 42a0681f17 Change-Id: I934bfe02ae968870083e9c7e72988c2d4147f7ae
-rw-r--r--scanning/pno_settings.cpp3
-rw-r--r--scanning/pno_settings.h3
-rw-r--r--scanning/scan_utils.cpp32
-rw-r--r--scanning/scan_utils.h13
-rw-r--r--scanning/scanner_impl.cpp31
-rw-r--r--scanning/scanner_impl.h5
-rw-r--r--tests/mock_scan_utils.h2
-rw-r--r--tests/scan_utils_unittest.cpp51
-rw-r--r--tests/scanner_unittest.cpp81
9 files changed, 211 insertions, 10 deletions
diff --git a/scanning/pno_settings.cpp b/scanning/pno_settings.cpp
index c8b5ff6..be051dd 100644
--- a/scanning/pno_settings.cpp
+++ b/scanning/pno_settings.cpp
@@ -28,6 +28,9 @@ namespace server {
28namespace wifi { 28namespace wifi {
29namespace wificond { 29namespace wificond {
30 30
31const uint32_t PnoSettings::kFastScanIterations = 3;
32const uint32_t PnoSettings::kSlowScanIntervalMultiplier = 3;
33
31status_t PnoSettings::writeToParcel(::android::Parcel* parcel) const { 34status_t PnoSettings::writeToParcel(::android::Parcel* parcel) const {
32 RETURN_IF_FAILED(parcel->writeInt32(interval_ms_)); 35 RETURN_IF_FAILED(parcel->writeInt32(interval_ms_));
33 RETURN_IF_FAILED(parcel->writeInt32(min_2g_rssi_)); 36 RETURN_IF_FAILED(parcel->writeInt32(min_2g_rssi_));
diff --git a/scanning/pno_settings.h b/scanning/pno_settings.h
index e236ec8..a606b0f 100644
--- a/scanning/pno_settings.h
+++ b/scanning/pno_settings.h
@@ -32,6 +32,9 @@ namespace wificond {
32 32
33class PnoSettings : public ::android::Parcelable { 33class PnoSettings : public ::android::Parcelable {
34 public: 34 public:
35 static const uint32_t kFastScanIterations;
36 static const uint32_t kSlowScanIntervalMultiplier;
37
35 PnoSettings() 38 PnoSettings()
36 : interval_ms_(0), 39 : interval_ms_(0),
37 min_2g_rssi_(0), 40 min_2g_rssi_(0),
diff --git a/scanning/scan_utils.cpp b/scanning/scan_utils.cpp
index 5f0a6e3..dfd051c 100644
--- a/scanning/scan_utils.cpp
+++ b/scanning/scan_utils.cpp
@@ -36,6 +36,7 @@ namespace wificond {
36namespace { 36namespace {
37 37
38constexpr uint8_t kElemIdSsid = 0; 38constexpr uint8_t kElemIdSsid = 0;
39constexpr unsigned int kMsecPerSec = 1000;
39 40
40} // namespace 41} // namespace
41 42
@@ -348,7 +349,7 @@ bool ScanUtils::AbortScan(uint32_t interface_index) {
348 349
349bool ScanUtils::StartScheduledScan( 350bool ScanUtils::StartScheduledScan(
350 uint32_t interface_index, 351 uint32_t interface_index,
351 uint32_t interval_ms, 352 const SchedScanIntervalSetting& interval_setting,
352 int32_t rssi_threshold, 353 int32_t rssi_threshold,
353 bool request_random_mac, 354 bool request_random_mac,
354 const std::vector<std::vector<uint8_t>>& scan_ssids, 355 const std::vector<std::vector<uint8_t>>& scan_ssids,
@@ -385,6 +386,7 @@ bool ScanUtils::StartScheduledScan(
385 NL80211Attr<int32_t>(NL80211_SCHED_SCAN_MATCH_ATTR_RSSI, rssi_threshold)); 386 NL80211Attr<int32_t>(NL80211_SCHED_SCAN_MATCH_ATTR_RSSI, rssi_threshold));
386 scan_match_attr.AddAttribute(match_group); 387 scan_match_attr.AddAttribute(match_group);
387 } 388 }
389 start_sched_scan.AddAttribute(scan_match_attr);
388 390
389 // Append all attributes to the NL80211_CMD_START_SCHED_SCAN packet. 391 // Append all attributes to the NL80211_CMD_START_SCHED_SCAN packet.
390 start_sched_scan.AddAttribute( 392 start_sched_scan.AddAttribute(
@@ -395,9 +397,31 @@ bool ScanUtils::StartScheduledScan(
395 if (!freqs.empty()) { 397 if (!freqs.empty()) {
396 start_sched_scan.AddAttribute(freqs_attr); 398 start_sched_scan.AddAttribute(freqs_attr);
397 } 399 }
398 start_sched_scan.AddAttribute( 400
399 NL80211Attr<uint32_t>(NL80211_ATTR_SCHED_SCAN_INTERVAL, interval_ms)); 401 if (!interval_setting.plans.empty()) {
400 start_sched_scan.AddAttribute(scan_match_attr); 402 NL80211NestedAttr scan_plans(NL80211_ATTR_SCHED_SCAN_PLANS);
403 for (unsigned int i = 0; i < interval_setting.plans.size(); i++) {
404 NL80211NestedAttr scan_plan(i + 1);
405 scan_plan.AddAttribute(
406 NL80211Attr<uint32_t>(NL80211_SCHED_SCAN_PLAN_INTERVAL,
407 interval_setting.plans[i].interval_ms / kMsecPerSec));
408 scan_plan.AddAttribute(
409 NL80211Attr<uint32_t>(NL80211_SCHED_SCAN_PLAN_ITERATIONS,
410 interval_setting.plans[i].n_iterations));
411 scan_plans.AddAttribute(scan_plan);
412 }
413 NL80211NestedAttr last_scan_plan(interval_setting.plans.size() + 1);
414 last_scan_plan.AddAttribute(
415 NL80211Attr<uint32_t>(NL80211_SCHED_SCAN_PLAN_INTERVAL,
416 interval_setting.final_interval_ms / kMsecPerSec));
417 scan_plans.AddAttribute(last_scan_plan);
418 start_sched_scan.AddAttribute(scan_plans);
419 } else {
420 start_sched_scan.AddAttribute(
421 NL80211Attr<uint32_t>(NL80211_ATTR_SCHED_SCAN_INTERVAL,
422 interval_setting.final_interval_ms));
423 }
424
401 if (request_random_mac) { 425 if (request_random_mac) {
402 start_sched_scan.AddAttribute( 426 start_sched_scan.AddAttribute(
403 NL80211Attr<uint32_t>(NL80211_ATTR_SCAN_FLAGS, 427 NL80211Attr<uint32_t>(NL80211_ATTR_SCAN_FLAGS,
diff --git a/scanning/scan_utils.h b/scanning/scan_utils.h
index dbc2556..87df13a 100644
--- a/scanning/scan_utils.h
+++ b/scanning/scan_utils.h
@@ -44,6 +44,17 @@ namespace wificond {
44class NL80211NestedAttr; 44class NL80211NestedAttr;
45class NL80211Packet; 45class NL80211Packet;
46 46
47struct SchedScanIntervalSetting {
48 struct ScanPlan {
49 uint32_t interval_ms;
50 uint32_t n_iterations;
51 };
52 std::vector<ScanPlan> plans;
53 // After |plans| has been exhausted, scan at every
54 // |final_interval_ms|.
55 uint32_t final_interval_ms{0};
56};
57
47// Provides scanning helper functions. 58// Provides scanning helper functions.
48class ScanUtils { 59class ScanUtils {
49 public: 60 public:
@@ -98,7 +109,7 @@ class ScanUtils {
98 // Returns true on success. 109 // Returns true on success.
99 virtual bool StartScheduledScan( 110 virtual bool StartScheduledScan(
100 uint32_t interface_index, 111 uint32_t interface_index,
101 uint32_t interval_ms, 112 const SchedScanIntervalSetting& interval_setting,
102 int32_t rssi_threshold, 113 int32_t rssi_threshold,
103 bool request_random_mac, 114 bool request_random_mac,
104 const std::vector<std::vector<uint8_t>>& scan_ssids, 115 const std::vector<std::vector<uint8_t>>& scan_ssids,
diff --git a/scanning/scanner_impl.cpp b/scanning/scanner_impl.cpp
index a1ea261..9bf13b3 100644
--- a/scanning/scanner_impl.cpp
+++ b/scanning/scanner_impl.cpp
@@ -35,6 +35,7 @@ using com::android::server::wifi::wificond::NativeScanResult;
35using com::android::server::wifi::wificond::PnoSettings; 35using com::android::server::wifi::wificond::PnoSettings;
36using com::android::server::wifi::wificond::SingleScanSettings; 36using com::android::server::wifi::wificond::SingleScanSettings;
37 37
38using std::pair;
38using std::string; 39using std::string;
39using std::vector; 40using std::vector;
40using std::weak_ptr; 41using std::weak_ptr;
@@ -305,7 +306,7 @@ bool ScannerImpl::StartPnoScanDefault(const PnoSettings& pno_settings) {
305 306
306 int error_code = 0; 307 int error_code = 0;
307 if (!scan_utils_->StartScheduledScan(interface_index_, 308 if (!scan_utils_->StartScheduledScan(interface_index_,
308 pno_settings.interval_ms_, 309 GenerateIntervalSetting(pno_settings),
309 // TODO: honor both rssi thresholds. 310 // TODO: honor both rssi thresholds.
310 pno_settings.min_5g_rssi_, 311 pno_settings.min_5g_rssi_,
311 request_random_mac, 312 request_random_mac,
@@ -447,6 +448,34 @@ void ScannerImpl::OnSchedScanResultsReady(uint32_t interface_index,
447 } 448 }
448} 449}
449 450
451SchedScanIntervalSetting ScannerImpl::GenerateIntervalSetting(
452 const ::com::android::server::wifi::wificond::PnoSettings&
453 pno_settings) const {
454 bool support_num_scan_plans = scan_capabilities_.max_num_scan_plans >= 2;
455 bool support_scan_plan_interval =
456 scan_capabilities_.max_scan_plan_interval * 1000 >=
457 pno_settings.interval_ms_ * PnoSettings::kSlowScanIntervalMultiplier;
458 bool support_scan_plan_iterations =
459 scan_capabilities_.max_scan_plan_iterations >=
460 PnoSettings::kFastScanIterations;
461
462 uint32_t fast_scan_interval =
463 static_cast<uint32_t>(pno_settings.interval_ms_);
464 if (support_num_scan_plans && support_scan_plan_interval &&
465 support_scan_plan_iterations) {
466 return SchedScanIntervalSetting{
467 {{fast_scan_interval, PnoSettings::kFastScanIterations}},
468 fast_scan_interval * PnoSettings::kSlowScanIntervalMultiplier};
469 } else {
470 // Device doesn't support the provided scan plans.
471 // Specify single interval instead.
472 // In this case, the driver/firmware is expected to implement back off
473 // logic internally using |pno_settings.interval_ms_| as "fast scan"
474 // interval.
475 return SchedScanIntervalSetting{{}, fast_scan_interval};
476 }
477}
478
450void ScannerImpl::LogSsidList(vector<vector<uint8_t>>& ssid_list, 479void ScannerImpl::LogSsidList(vector<vector<uint8_t>>& ssid_list,
451 string prefix) { 480 string prefix) {
452 if (ssid_list.empty()) { 481 if (ssid_list.empty()) {
diff --git a/scanning/scanner_impl.h b/scanning/scanner_impl.h
index fe66f17..2bb9262 100644
--- a/scanning/scanner_impl.h
+++ b/scanning/scanner_impl.h
@@ -25,13 +25,13 @@
25#include "android/net/wifi/BnWifiScannerImpl.h" 25#include "android/net/wifi/BnWifiScannerImpl.h"
26#include "wificond/net/netlink_utils.h" 26#include "wificond/net/netlink_utils.h"
27#include "wificond/scanning/offload/offload_scan_manager.h" 27#include "wificond/scanning/offload/offload_scan_manager.h"
28#include "wificond/scanning/scan_utils.h"
28 29
29namespace android { 30namespace android {
30namespace wificond { 31namespace wificond {
31 32
32class ClientInterfaceImpl; 33class ClientInterfaceImpl;
33class OffloadServiceUtils; 34class OffloadServiceUtils;
34class ScanUtils;
35 35
36class ScannerImpl : public android::net::wifi::BnWifiScannerImpl { 36class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
37 public: 37 public:
@@ -99,6 +99,9 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
99 std::vector<std::vector<uint8_t>>* match_ssids, 99 std::vector<std::vector<uint8_t>>* match_ssids,
100 std::vector<uint32_t>* freqs, 100 std::vector<uint32_t>* freqs,
101 std::vector<uint8_t>* match_security); 101 std::vector<uint8_t>* match_security);
102 SchedScanIntervalSetting GenerateIntervalSetting(
103 const ::com::android::server::wifi::wificond::PnoSettings& pno_settings) const;
104
102 // Boolean variables describing current scanner status. 105 // Boolean variables describing current scanner status.
103 bool valid_; 106 bool valid_;
104 bool scan_started_; 107 bool scan_started_;
diff --git a/tests/mock_scan_utils.h b/tests/mock_scan_utils.h
index f3e1777..3e5cc7f 100644
--- a/tests/mock_scan_utils.h
+++ b/tests/mock_scan_utils.h
@@ -50,7 +50,7 @@ class MockScanUtils : public ScanUtils {
50 50
51 MOCK_METHOD8(StartScheduledScan, bool( 51 MOCK_METHOD8(StartScheduledScan, bool(
52 uint32_t interface_index, 52 uint32_t interface_index,
53 uint32_t interval_ms, 53 const SchedScanIntervalSetting& interval_setting,
54 int32_t rssi_threshold, 54 int32_t rssi_threshold,
55 bool request_random_mac, 55 bool request_random_mac,
56 const std::vector<std::vector<uint8_t>>& scan_ssids, 56 const std::vector<std::vector<uint8_t>>& scan_ssids,
diff --git a/tests/scan_utils_unittest.cpp b/tests/scan_utils_unittest.cpp
index 9e36ab2..28ea283 100644
--- a/tests/scan_utils_unittest.cpp
+++ b/tests/scan_utils_unittest.cpp
@@ -32,8 +32,10 @@ using std::placeholders::_1;
32using std::placeholders::_2; 32using std::placeholders::_2;
33using std::unique_ptr; 33using std::unique_ptr;
34using std::vector; 34using std::vector;
35using testing::AllOf;
35using testing::Invoke; 36using testing::Invoke;
36using testing::NiceMock; 37using testing::NiceMock;
38using testing::Not;
37using testing::Return; 39using testing::Return;
38using testing::_; 40using testing::_;
39 41
@@ -106,6 +108,11 @@ MATCHER_P(DoesNL80211PacketMatchCommand, command,
106 return arg.GetCommand() == command; 108 return arg.GetCommand() == command;
107} 109}
108 110
111MATCHER_P(DoesNL80211PacketHaveAttribute, attr,
112 "Check if the netlink packet has atttribute |attr|") {
113 return arg.HasAttribute(attr);
114}
115
109TEST_F(ScanUtilsTest, CanGetScanResult) { 116TEST_F(ScanUtilsTest, CanGetScanResult) {
110 vector<NativeScanResult> scan_results; 117 vector<NativeScanResult> scan_results;
111 EXPECT_CALL( 118 EXPECT_CALL(
@@ -162,7 +169,7 @@ TEST_F(ScanUtilsTest, CanSendSchedScanRequest) {
162 int errno_ignored; 169 int errno_ignored;
163 EXPECT_TRUE(scan_utils_.StartScheduledScan( 170 EXPECT_TRUE(scan_utils_.StartScheduledScan(
164 kFakeInterfaceIndex, 171 kFakeInterfaceIndex,
165 kFakeScheduledScanIntervalMs, 172 SchedScanIntervalSetting(),
166 kFakeRssiThreshold, kFakeUseRandomMAC, {}, {}, {}, &errno_ignored)); 173 kFakeRssiThreshold, kFakeUseRandomMAC, {}, {}, {}, &errno_ignored));
167 // TODO(b/34231420): Add validation of requested scan ssids, threshold, 174 // TODO(b/34231420): Add validation of requested scan ssids, threshold,
168 // and frequencies. 175 // and frequencies.
@@ -179,11 +186,51 @@ TEST_F(ScanUtilsTest, CanHandleSchedScanRequestFailure) {
179 int error_code; 186 int error_code;
180 EXPECT_FALSE(scan_utils_.StartScheduledScan( 187 EXPECT_FALSE(scan_utils_.StartScheduledScan(
181 kFakeInterfaceIndex, 188 kFakeInterfaceIndex,
182 kFakeScheduledScanIntervalMs, 189 SchedScanIntervalSetting(),
183 kFakeRssiThreshold, kFakeUseRandomMAC, {}, {}, {}, &error_code)); 190 kFakeRssiThreshold, kFakeUseRandomMAC, {}, {}, {}, &error_code));
184 EXPECT_EQ(kFakeErrorCode, error_code); 191 EXPECT_EQ(kFakeErrorCode, error_code);
185} 192}
186 193
194TEST_F(ScanUtilsTest, CanSpecifyScanPlansForSchedScanRequest) {
195 EXPECT_CALL(
196 netlink_manager_,
197 SendMessageAndGetResponses(
198 AllOf(
199 DoesNL80211PacketMatchCommand(NL80211_CMD_START_SCHED_SCAN),
200 DoesNL80211PacketHaveAttribute(NL80211_ATTR_SCHED_SCAN_PLANS),
201 Not(DoesNL80211PacketHaveAttribute(
202 NL80211_ATTR_SCHED_SCAN_INTERVAL))),
203 _));
204 int errno_ignored;
205 SchedScanIntervalSetting interval_setting{
206 {{kFakeScheduledScanIntervalMs, 10 /* repeated times */}},
207 kFakeScheduledScanIntervalMs * 3 /* interval for infinite scans */};
208
209 scan_utils_.StartScheduledScan(
210 kFakeInterfaceIndex,
211 interval_setting,
212 kFakeRssiThreshold, kFakeUseRandomMAC, {}, {}, {}, &errno_ignored);
213}
214
215TEST_F(ScanUtilsTest, CanSpecifySingleIntervalForSchedScanRequest) {
216 EXPECT_CALL(
217 netlink_manager_,
218 SendMessageAndGetResponses(
219 AllOf(
220 DoesNL80211PacketMatchCommand(NL80211_CMD_START_SCHED_SCAN),
221 DoesNL80211PacketHaveAttribute(NL80211_ATTR_SCHED_SCAN_INTERVAL),
222 Not(DoesNL80211PacketHaveAttribute(
223 NL80211_ATTR_SCHED_SCAN_PLANS))),
224 _));
225 int errno_ignored;
226 SchedScanIntervalSetting interval_setting{{}, kFakeScheduledScanIntervalMs};
227
228 scan_utils_.StartScheduledScan(
229 kFakeInterfaceIndex,
230 interval_setting,
231 kFakeRssiThreshold, kFakeUseRandomMAC, {}, {}, {}, &errno_ignored);
232}
233
187TEST_F(ScanUtilsTest, CanPrioritizeLastSeenSinceBootNetlinkAttribute) { 234TEST_F(ScanUtilsTest, CanPrioritizeLastSeenSinceBootNetlinkAttribute) {
188 constexpr uint64_t kLastSeenTimestampNanoSeconds = 123456; 235 constexpr uint64_t kLastSeenTimestampNanoSeconds = 123456;
189 constexpr uint64_t kBssTsfTimestampMicroSeconds = 654321; 236 constexpr uint64_t kBssTsfTimestampMicroSeconds = 654321;
diff --git a/tests/scanner_unittest.cpp b/tests/scanner_unittest.cpp
index 85f6330..bbaeffd 100644
--- a/tests/scanner_unittest.cpp
+++ b/tests/scanner_unittest.cpp
@@ -51,6 +51,7 @@ namespace {
51 51
52constexpr uint32_t kFakeInterfaceIndex = 12; 52constexpr uint32_t kFakeInterfaceIndex = 12;
53constexpr uint32_t kFakeWiphyIndex = 5; 53constexpr uint32_t kFakeWiphyIndex = 5;
54constexpr uint32_t kFakeScanIntervalMs = 10000;
54 55
55// This is a helper function to mock the behavior of ScanUtils::Scan() 56// This is a helper function to mock the behavior of ScanUtils::Scan()
56// when we expect a error code. 57// when we expect a error code.
@@ -69,6 +70,20 @@ bool ReturnErrorCodeForScanRequest(
69 return false; 70 return false;
70} 71}
71 72
73bool CaptureSchedScanIntervalSetting(
74 uint32_t /* interface_index */,
75 const SchedScanIntervalSetting& interval_setting,
76 int32_t /* rssi_threshold */,
77 bool /* request_random_mac */,
78 const std::vector<std::vector<uint8_t>>& /* scan_ssids */,
79 const std::vector<std::vector<uint8_t>>& /* match_ssids */,
80 const std::vector<uint32_t>& /* freqs */,
81 int* /* error_code */,
82 SchedScanIntervalSetting* out_interval_setting) {
83 *out_interval_setting = interval_setting;
84 return true;
85}
86
72} // namespace 87} // namespace
73 88
74class ScannerTest : public ::testing::Test { 89class ScannerTest : public ::testing::Test {
@@ -168,5 +183,71 @@ TEST_F(ScannerTest, TestStopPnoScanViaNetlink) {
168 EXPECT_TRUE(success); 183 EXPECT_TRUE(success);
169} 184}
170 185
186TEST_F(ScannerTest, TestGenerateScanPlansIfDeviceSupports) {
187 ScanCapabilities scan_capabilities_scan_plan_supported(
188 0 /* max_num_scan_ssids */,
189 0 /* max_num_sched_scan_ssids */,
190 0 /* max_match_sets */,
191 // Parameters above are not related to this test.
192 2 /* 1 plan for finite repeated scan and 1 plan for ininfite scan loop */,
193 kFakeScanIntervalMs * PnoSettings::kSlowScanIntervalMultiplier / 1000,
194 PnoSettings::kFastScanIterations);
195 ScannerImpl scanner(
196 kFakeWiphyIndex, kFakeInterfaceIndex,
197 scan_capabilities_scan_plan_supported, wiphy_features_,
198 &client_interface_impl_,
199 &netlink_utils_, &scan_utils_, offload_service_utils_);
200
201 PnoSettings pno_settings;
202 pno_settings.interval_ms_ = kFakeScanIntervalMs;
203
204 SchedScanIntervalSetting interval_setting;
205 EXPECT_CALL(
206 scan_utils_,
207 StartScheduledScan(_, _, _, _, _, _, _, _)).
208 WillOnce(Invoke(bind(
209 CaptureSchedScanIntervalSetting,
210 _1, _2, _3, _4, _5, _6, _7, _8, &interval_setting)));
211
212 bool success_ignored = 0;
213 EXPECT_TRUE(scanner.startPnoScan(pno_settings, &success_ignored).isOk());
214 /* 1 plan for finite repeated scan */
215 EXPECT_EQ(1U, interval_setting.plans.size());
216 EXPECT_EQ(kFakeScanIntervalMs * PnoSettings::kSlowScanIntervalMultiplier,
217 interval_setting.final_interval_ms);
218}
219
220TEST_F(ScannerTest, TestGenerateSingleIntervalIfDeviceDoesNotSupportScanPlan) {
221 ScanCapabilities scan_capabilities_no_scan_plan_support(
222 0 /* max_num_scan_ssids */,
223 0 /* max_num_sched_scan_ssids */,
224 0 /* max_match_sets */,
225 // Parameters above are not related to this test.
226 0 /* max_num_scan_plans */,
227 0 /* max_scan_plan_interval */,
228 0 /* max_scan_plan_iterations */);
229 ScannerImpl scanner(
230 kFakeWiphyIndex, kFakeInterfaceIndex,
231 scan_capabilities_no_scan_plan_support, wiphy_features_,
232 &client_interface_impl_,
233 &netlink_utils_, &scan_utils_, offload_service_utils_);
234 PnoSettings pno_settings;
235 pno_settings.interval_ms_ = kFakeScanIntervalMs;
236
237 SchedScanIntervalSetting interval_setting;
238 EXPECT_CALL(
239 scan_utils_,
240 StartScheduledScan(_, _, _, _, _, _, _, _)).
241 WillOnce(Invoke(bind(
242 CaptureSchedScanIntervalSetting,
243 _1, _2, _3, _4, _5, _6, _7, _8, &interval_setting)));
244
245 bool success_ignored = 0;
246 EXPECT_TRUE(scanner.startPnoScan(pno_settings, &success_ignored).isOk());
247
248 EXPECT_EQ(0U, interval_setting.plans.size());
249 EXPECT_EQ(kFakeScanIntervalMs, interval_setting.final_interval_ms);
250}
251
171} // namespace wificond 252} // namespace wificond
172} // namespace android 253} // namespace android