From d08fcc7ee2f71489ddda4b8fbc7f06f8979271a2 Mon Sep 17 00:00:00 2001 From: Ningyuan Wang Date: Fri, 5 May 2017 13:38:43 -0700 Subject: [PATCH] Change abortScan() binder API to void Framework don't reley and can't rely on the success/failure of abortScan(). In order to avoid confusion, this API should be void instead returning bool. Bug: 37743832 Test: compile, unit tests, manual test, integration test Change-Id: I32075984b5e5f5be4822e9669076004a2f4a73c2 --- aidl/android/net/wifi/IWifiScannerImpl.aidl | 4 +--- scanning/scanner_impl.cpp | 9 +++++---- scanning/scanner_impl.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/aidl/android/net/wifi/IWifiScannerImpl.aidl b/aidl/android/net/wifi/IWifiScannerImpl.aidl index 145310d..da0ca2d 100644 --- a/aidl/android/net/wifi/IWifiScannerImpl.aidl +++ b/aidl/android/net/wifi/IWifiScannerImpl.aidl @@ -66,9 +66,7 @@ interface IWifiScannerImpl { boolean stopPnoScan(); // Abort ongoing scan. - // Returns true on success. - // Returns false on failure or there is no ongoing scan. - boolean abortScan(); + void abortScan(); // TODO(nywang) add more interfaces. } diff --git a/scanning/scanner_impl.cpp b/scanning/scanner_impl.cpp index 9edd876..2c1b1d0 100644 --- a/scanning/scanner_impl.cpp +++ b/scanning/scanner_impl.cpp @@ -282,16 +282,17 @@ Status ScannerImpl::stopPnoScan(bool* out_success) { return Status::ok(); } -Status ScannerImpl::abortScan(bool* out_success) { - *out_success = false; +Status ScannerImpl::abortScan() { if (!CheckIsValid()) { return Status::ok(); } if (!scan_started_) { LOG(WARNING) << "Scan is not started. Ignore abort request"; - } else if (scan_utils_->AbortScan(interface_index_)) { - *out_success = true; + return Status::ok(); + } + if (!scan_utils_->AbortScan(interface_index_)) { + LOG(WARNING) << "Abort scan failed"; } return Status::ok(); } diff --git a/scanning/scanner_impl.h b/scanning/scanner_impl.h index 2ca5251..61a7b96 100644 --- a/scanning/scanner_impl.h +++ b/scanning/scanner_impl.h @@ -62,7 +62,7 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl { const ::com::android::server::wifi::wificond::PnoSettings& pno_settings, bool* out_success) override; ::android::binder::Status stopPnoScan(bool* out_success) override; - ::android::binder::Status abortScan(bool* out_success) override; + ::android::binder::Status abortScan() override; ::android::binder::Status subscribeScanEvents( const ::android::sp<::android::net::wifi::IScanEvent>& handler) override; -- 2.11.0