summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSohani Rao2017-08-21 18:56:46 -0500
committerSohani Rao2017-09-01 14:10:23 -0500
commit3aeba6c3b4f09c29b75ec8c18b46507ecd69293c (patch)
treed32519984f9038fdecc19b7d1cb1bb66e8224bb2
parent94abf86afd8ff688b2bc871b0e97820b0f6ace31 (diff)
downloadsystem-connectivity-wificond-3aeba6c3b4f09c29b75ec8c18b46507ecd69293c.tar.gz
system-connectivity-wificond-3aeba6c3b4f09c29b75ec8c18b46507ecd69293c.tar.xz
system-connectivity-wificond-3aeba6c3b4f09c29b75ec8c18b46507ecd69293c.zip
Wificond: Remove mannual memory management in OffloadScanManager
Bug: 64853991 Test: Unit tests and on-device testing for finding APs in Offloaded PNO scans Change-Id: I88fcbaed00627a7d282b6214f93419a761764da6
-rw-r--r--scanning/offload/offload_scan_manager.cpp8
-rw-r--r--scanning/offload/offload_scan_manager.h2
2 files changed, 4 insertions, 6 deletions
diff --git a/scanning/offload/offload_scan_manager.cpp b/scanning/offload/offload_scan_manager.cpp
index 2592aee..9bcbb0f 100644
--- a/scanning/offload/offload_scan_manager.cpp
+++ b/scanning/offload/offload_scan_manager.cpp
@@ -76,7 +76,6 @@ OffloadScanManager::OffloadScanManager(
76 wifi_offload_callback_(nullptr), 76 wifi_offload_callback_(nullptr),
77 death_recipient_(nullptr), 77 death_recipient_(nullptr),
78 offload_status_(OffloadScanManager::kError), 78 offload_status_(OffloadScanManager::kError),
79 cached_scan_results_(new std::vector<NativeScanResult>()),
80 service_available_(false), 79 service_available_(false),
81 offload_service_utils_(utils), 80 offload_service_utils_(utils),
82 offload_callback_handlers_(new OffloadCallbackHandlersImpl(this)), 81 offload_callback_handlers_(new OffloadCallbackHandlersImpl(this)),
@@ -239,7 +238,7 @@ OffloadScanManager::StatusCode OffloadScanManager::getOffloadStatus() const {
239 238
240bool OffloadScanManager::getScanResults( 239bool OffloadScanManager::getScanResults(
241 std::vector<NativeScanResult>* out_scan_results) { 240 std::vector<NativeScanResult>* out_scan_results) {
242 for (auto scan_result : *cached_scan_results_) { 241 for (const auto& scan_result : cached_scan_results_) {
243 out_scan_results->push_back(scan_result); 242 out_scan_results->push_back(scan_result);
244 } 243 }
245 return true; 244 return true;
@@ -261,14 +260,13 @@ OffloadScanManager::~OffloadScanManager() {
261 if (wifi_offload_hal_ != nullptr) { 260 if (wifi_offload_hal_ != nullptr) {
262 wifi_offload_hal_->unlinkToDeath(death_recipient_); 261 wifi_offload_hal_->unlinkToDeath(death_recipient_);
263 } 262 }
264 delete cached_scan_results_;
265} 263}
266 264
267void OffloadScanManager::ReportScanResults( 265void OffloadScanManager::ReportScanResults(
268 const vector<ScanResult>& scanResult) { 266 const vector<ScanResult>& scanResult) {
269 cached_scan_results_->clear(); 267 cached_scan_results_.clear();
270 if (!OffloadScanUtils::convertToNativeScanResults(scanResult, 268 if (!OffloadScanUtils::convertToNativeScanResults(scanResult,
271 cached_scan_results_)) { 269 &cached_scan_results_)) {
272 LOG(WARNING) << "Unable to convert scan results to native format"; 270 LOG(WARNING) << "Unable to convert scan results to native format";
273 return; 271 return;
274 } 272 }
diff --git a/scanning/offload/offload_scan_manager.h b/scanning/offload/offload_scan_manager.h
index 6be3ec0..2c4fa96 100644
--- a/scanning/offload/offload_scan_manager.h
+++ b/scanning/offload/offload_scan_manager.h
@@ -147,7 +147,7 @@ class OffloadScanManager {
147 android::sp<OffloadCallback> wifi_offload_callback_; 147 android::sp<OffloadCallback> wifi_offload_callback_;
148 android::sp<OffloadDeathRecipient> death_recipient_; 148 android::sp<OffloadDeathRecipient> death_recipient_;
149 StatusCode offload_status_; 149 StatusCode offload_status_;
150 std::vector<::com::android::server::wifi::wificond::NativeScanResult>* 150 std::vector<::com::android::server::wifi::wificond::NativeScanResult>
151 cached_scan_results_; 151 cached_scan_results_;
152 bool service_available_; 152 bool service_available_;
153 153