From 50274f7696779e00fd16b5e6fbbc02e36fc64352 Mon Sep 17 00:00:00 2001 From: Ye Jiao Date: Tue, 17 Jan 2023 14:53:22 +0800 Subject: [PATCH] Move setScanMode to legacy HAL Cherry-pick from https://partner-android-review.git.corp.google.com/c/platform/hardware/interfaces/+/2369946 Implementation of setScanMode is platform-specific. It's more reasonable to move it the legacy HAL like other platform-specific APIs. Bug: 265866990 Test: manual Test Test: VTS Change-Id: I2f8ff73b764ed1b9835b8e3157f673d7d558ae02 --- wifi/aidl/default/wifi_legacy_hal.cpp | 4 ++++ wifi/aidl/default/wifi_legacy_hal.h | 2 ++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + wifi/aidl/default/wifi_sta_iface.cpp | 5 ++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 0711568a4e..43a71cc074 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1766,6 +1766,10 @@ wifi_error WifiLegacyHal::twtClearStats(const std::string& iface_name, uint8_t c return global_func_table_.wifi_twt_clear_stats(getIfaceHandle(iface_name), configId); } +wifi_error WifiLegacyHal::setScanMode(const std::string& iface_name, bool enable) { + return global_func_table_.wifi_set_scan_mode(iface_name.c_str(), enable); +} + wifi_error WifiLegacyHal::setDtimConfig(const std::string& iface_name, uint32_t multiplier) { return global_func_table_.wifi_set_dtim_config(getIfaceHandle(iface_name), multiplier); } diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 1e6ef73eec..a066ea6083 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -741,6 +741,8 @@ class WifiLegacyHal { wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); + wifi_error setScanMode(const std::string& iface_name, bool enable); + wifi_error setDtimConfig(const std::string& iface_name, uint32_t multiplier); // Retrieve the list of usable channels in the requested bands diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index c18b086c17..fa87772ef3 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -175,6 +175,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_enable_sta_channel_for_peer_network); populateStubFor(&hal_fn->wifi_nan_suspend_request); populateStubFor(&hal_fn->wifi_nan_resume_request); + populateStubFor(&hal_fn->wifi_set_scan_mode); return true; } diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 08ed9d2b5c..96dc809839 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -561,9 +561,8 @@ std::pair, ndk::ScopedAStatus> WifiStaIface::getFactoryMa } ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) { - // OEM's need to implement this on their devices if needed. - LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setScanMode(ifname_, enable); + return createWifiStatusFromLegacyError(legacy_status); } ndk::ScopedAStatus WifiStaIface::setDtimMultiplierInternal(const int multiplier) {