Remove 6GHz capability query through HAL

It was decided to perform the check on the device support of 6GHz
through overlay configs instead of through HAL.
This commit removes the Hidl API changes that were used for that
check.

Bug: 145936758
Bug: 139354972
Test: Manual
Test: VTS test
Test: Unit test: hardware/interfaces/wifi/1.4/default/tests/runtests.sh
Change-Id: I81fdf603a668a71e3e875211367111fffee20e54
This commit is contained in:
Ahmed ElArabawy 2019-12-09 15:24:16 -08:00
parent ad84668d29
commit b23485ddc5
9 changed files with 28 additions and 156 deletions

View file

@ -15,7 +15,6 @@ hidl_interface {
"IWifiNanIface.hal", "IWifiNanIface.hal",
"IWifiRttController.hal", "IWifiRttController.hal",
"IWifiRttControllerEventCallback.hal", "IWifiRttControllerEventCallback.hal",
"IWifiStaIface.hal",
], ],
interfaces: [ interfaces: [
"android.hardware.wifi@1.0", "android.hardware.wifi@1.0",

View file

@ -1,48 +0,0 @@
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.wifi@1.4;
import @1.0::WifiStatus;
import @1.0::MacAddress;
import @1.0::IWifiStaIface;
import @1.3::IWifiStaIface;
/**
* Interface used to represent a single STA iface.
*
* IWifiChip.createStaIface() may return a @1.4::IWifiStaIface when supported.
*/
interface IWifiStaIface extends @1.3::IWifiStaIface {
enum StaIfaceCapabilityMask : @1.0::IWifiStaIface.StaIfaceCapabilityMask {
STA_6G = 1 << 15,
};
/**
* Get the capabilities supported by this STA iface.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return capabilities Bitset of |StaIfaceCapabilityMask| values.
*/
getCapabilities_1_4()
generates (WifiStatus status, bitfield<StaIfaceCapabilityMask> capabilities);
};

View file

@ -120,8 +120,6 @@ convertLegacyFeatureToHidlStaIfaceCapability(uint64_t feature) {
return HidlStaIfaceCaps::ND_OFFLOAD; return HidlStaIfaceCaps::ND_OFFLOAD;
case WIFI_FEATURE_MKEEP_ALIVE: case WIFI_FEATURE_MKEEP_ALIVE:
return HidlStaIfaceCaps::KEEP_ALIVE; return HidlStaIfaceCaps::KEEP_ALIVE;
case WIFI_FEATURE_INFRA_6G:
return HidlStaIfaceCaps::STA_6G;
}; };
CHECK(false) << "Unknown legacy feature: " << feature; CHECK(false) << "Unknown legacy feature: " << feature;
return {}; return {};
@ -394,8 +392,7 @@ bool convertLegacyFeaturesToHidlStaCapabilities(
WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND,
WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO,
WIFI_FEATURE_TDLS, WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_TDLS, WIFI_FEATURE_TDLS_OFFCHANNEL,
WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) {
WIFI_FEATURE_INFRA_6G}) {
if (feature & legacy_feature_set) { if (feature & legacy_feature_set) {
*hidl_caps |= convertLegacyFeatureToHidlStaIfaceCapability(feature); *hidl_caps |= convertLegacyFeatureToHidlStaIfaceCapability(feature);
} }

View file

@ -25,7 +25,6 @@
#include <android/hardware/wifi/1.3/IWifiChip.h> #include <android/hardware/wifi/1.3/IWifiChip.h>
#include <android/hardware/wifi/1.3/types.h> #include <android/hardware/wifi/1.3/types.h>
#include <android/hardware/wifi/1.4/IWifiChipEventCallback.h> #include <android/hardware/wifi/1.4/IWifiChipEventCallback.h>
#include <android/hardware/wifi/1.4/IWifiStaIface.h>
#include <android/hardware/wifi/1.4/types.h> #include <android/hardware/wifi/1.4/types.h>
#include "wifi_legacy_hal.h" #include "wifi_legacy_hal.h"

View file

@ -938,7 +938,8 @@ WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) {
return createWifiStatus(WifiStatusCode::SUCCESS); return createWifiStatus(WifiStatusCode::SUCCESS);
} }
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() { std::pair<WifiStatus, sp<V1_3::IWifiStaIface>>
WifiChip::createStaIfaceInternal() {
if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) { if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
} }
@ -962,7 +963,7 @@ WifiChip::getStaIfaceNamesInternal() {
return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)}; return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)};
} }
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::getStaIfaceInternal( std::pair<WifiStatus, sp<V1_3::IWifiStaIface>> WifiChip::getStaIfaceInternal(
const std::string& ifname) { const std::string& ifname) {
const auto iface = findUsingName(sta_ifaces_, ifname); const auto iface = findUsingName(sta_ifaces_, ifname);
if (!iface.get()) { if (!iface.get()) {

View file

@ -197,9 +197,9 @@ class WifiChip : public V1_4::IWifiChip {
std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal( std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal(
const std::string& ifname); const std::string& ifname);
WifiStatus removeP2pIfaceInternal(const std::string& ifname); WifiStatus removeP2pIfaceInternal(const std::string& ifname);
std::pair<WifiStatus, sp<IWifiStaIface>> createStaIfaceInternal(); std::pair<WifiStatus, sp<V1_3::IWifiStaIface>> createStaIfaceInternal();
std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal(); std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal();
std::pair<WifiStatus, sp<IWifiStaIface>> getStaIfaceInternal( std::pair<WifiStatus, sp<V1_3::IWifiStaIface>> getStaIfaceInternal(
const std::string& ifname); const std::string& ifname);
WifiStatus removeStaIfaceInternal(const std::string& ifname); WifiStatus removeStaIfaceInternal(const std::string& ifname);
std::pair<WifiStatus, sp<V1_0::IWifiRttController>> std::pair<WifiStatus, sp<V1_0::IWifiRttController>>

View file

@ -266,13 +266,6 @@ Return<void> WifiStaIface::getFactoryMacAddress(
hidl_status_cb); hidl_status_cb);
} }
Return<void> WifiStaIface::getCapabilities_1_4(
getCapabilities_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiStaIface::getCapabilitiesInternal_1_4,
hidl_status_cb);
}
std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() { std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() {
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
} }
@ -290,7 +283,26 @@ WifiStatus WifiStaIface::registerEventCallbackInternal(
} }
std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal() { std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal() {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; legacy_hal::wifi_error legacy_status;
uint64_t legacy_feature_set;
std::tie(legacy_status, legacy_feature_set) =
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
return {createWifiStatusFromLegacyError(legacy_status), 0};
}
uint32_t legacy_logger_feature_set;
std::tie(legacy_status, legacy_logger_feature_set) =
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
// some devices don't support querying logger feature set
legacy_logger_feature_set = 0;
}
uint32_t hidl_caps;
if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(
legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
} }
std::pair<WifiStatus, StaApfPacketFilterCapabilities> std::pair<WifiStatus, StaApfPacketFilterCapabilities>
@ -628,29 +640,6 @@ WifiStaIface::getFactoryMacAddressInternal() {
return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; return {createWifiStatus(WifiStatusCode::SUCCESS), mac};
} }
std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal_1_4() {
legacy_hal::wifi_error legacy_status;
uint64_t legacy_feature_set;
std::tie(legacy_status, legacy_feature_set) =
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
return {createWifiStatusFromLegacyError(legacy_status), 0};
}
uint32_t legacy_logger_feature_set;
std::tie(legacy_status, legacy_logger_feature_set) =
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
// some devices don't support querying logger feature set
legacy_logger_feature_set = 0;
}
uint32_t hidl_caps;
if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(
legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
}
} // namespace implementation } // namespace implementation
} // namespace V1_4 } // namespace V1_4
} // namespace wifi } // namespace wifi

View file

@ -19,7 +19,7 @@
#include <android-base/macros.h> #include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h> #include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
#include <android/hardware/wifi/1.4/IWifiStaIface.h> #include <android/hardware/wifi/1.3/IWifiStaIface.h>
#include "hidl_callback_util.h" #include "hidl_callback_util.h"
#include "wifi_iface_util.h" #include "wifi_iface_util.h"
@ -35,7 +35,7 @@ using namespace android::hardware::wifi::V1_0;
/** /**
* HIDL interface object used to control a STA Iface instance. * HIDL interface object used to control a STA Iface instance.
*/ */
class WifiStaIface : public V1_4::IWifiStaIface { class WifiStaIface : public V1_3::IWifiStaIface {
public: public:
WifiStaIface(const std::string& ifname, WifiStaIface(const std::string& ifname,
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
@ -112,8 +112,6 @@ class WifiStaIface : public V1_4::IWifiStaIface {
setMacAddress_cb hidl_status_cb) override; setMacAddress_cb hidl_status_cb) override;
Return<void> getFactoryMacAddress( Return<void> getFactoryMacAddress(
getFactoryMacAddress_cb hidl_status_cb) override; getFactoryMacAddress_cb hidl_status_cb) override;
Return<void> getCapabilities_1_4(
getCapabilities_1_4_cb hidl_status_cb) override;
private: private:
// Corresponding worker functions for the HIDL methods. // Corresponding worker functions for the HIDL methods.
@ -162,7 +160,6 @@ class WifiStaIface : public V1_4::IWifiStaIface {
WifiStatus setMacAddressInternal(const std::array<uint8_t, 6>& mac); WifiStatus setMacAddressInternal(const std::array<uint8_t, 6>& mac);
std::pair<WifiStatus, std::array<uint8_t, 6>> std::pair<WifiStatus, std::array<uint8_t, 6>>
getFactoryMacAddressInternal(); getFactoryMacAddressInternal();
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal_1_4();
std::string ifname_; std::string ifname_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;

View file

@ -1,62 +0,0 @@
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Staache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <android-base/logging.h>
#include <android/hardware/wifi/1.4/IWifiStaIface.h>
#include <VtsHalHidlTargetTestBase.h>
#include "wifi_hidl_call_util.h"
#include "wifi_hidl_test_utils.h"
using ::android::sp;
using ::android::hardware::hidl_array;
using ::android::hardware::wifi::V1_0::WifiStatus;
using ::android::hardware::wifi::V1_0::WifiStatusCode;
using ::android::hardware::wifi::V1_4::IWifiStaIface;
/**
* Fixture to use for all STA Iface HIDL interface tests.
*/
class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
wifi_sta_iface_ = IWifiStaIface::castFrom(getWifiStaIface());
ASSERT_NE(nullptr, wifi_sta_iface_.get());
}
virtual void TearDown() override { stopWifi(); }
protected:
sp<IWifiStaIface> wifi_sta_iface_;
};
/*
* GetCapabilities_1_4
*/
TEST_F(WifiStaIfaceHidlTest, GetCapabilities_1_4) {
configureChipForIfaceType(IfaceType::STA, true);
const auto& status_and_caps =
HIDL_INVOKE(wifi_sta_iface_, getCapabilities_1_4);
if (status_and_caps.first.code != WifiStatusCode::SUCCESS) {
EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
status_and_caps.first.code);
return;
}
EXPECT_NE(0u, status_and_caps.second);
}