diff options
author | Chris Ye <lzye@google.com> | 2022-01-26 21:46:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-01-26 21:46:51 +0000 |
commit | af7d54543f4ed75aa6e4462d654ea41ad85837dd (patch) | |
tree | 69d52684696e4cb33cbdbcbbc380f3530cb143a6 | |
parent | d25ef71f90173a08881d2c55c7713e4ad64e6f22 (diff) | |
parent | 02c7bb3df958471cf100727899aa1ec1ceb9ae15 (diff) |
Merge "Get bridged AP interface name from Wifi HAL."
-rw-r--r-- | wifi/hostapd/aidl/vts/functional/Android.bp | 14 | ||||
-rw-r--r-- | wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp | 36 |
2 files changed, 48 insertions, 2 deletions
diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp index e58cf5ede3..e61d3975bb 100644 --- a/wifi/hostapd/aidl/vts/functional/Android.bp +++ b/wifi/hostapd/aidl/vts/functional/Android.bp @@ -17,9 +17,23 @@ cc_test { shared_libs: [ "libbinder", "libbinder_ndk", + "libvndksupport", ], static_libs: [ "android.hardware.wifi.hostapd-V1-ndk", + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiV1_5TargetTestUtil", + "VtsHalWifiHostapdV1_0TargetTestUtil", + "android.hardware.wifi.hostapd@1.0", + "android.hardware.wifi.hostapd@1.1", + "android.hardware.wifi.hostapd@1.2", + "android.hardware.wifi.hostapd@1.3", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", ], test_suites: [ "general-tests", diff --git a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp index cd7ff82156..c1f2bb7280 100644 --- a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp +++ b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp @@ -13,6 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include <android/hardware/wifi/1.0/IWifi.h> +#include <android/hardware/wifi/hostapd/1.3/IHostapd.h> + #include <VtsCoreUtil.h> #include <aidl/Gtest.h> #include <aidl/Vintf.h> @@ -21,6 +24,11 @@ #include <android/binder_manager.h> #include <binder/IServiceManager.h> #include <binder/ProcessState.h> +#include <hidl/ServiceManagement.h> +#include <hostapd_hidl_call_util.h> +#include <hostapd_hidl_test_utils.h> +#include <wifi_hidl_test_utils.h> +#include <wifi_hidl_test_utils_1_5.h> using aidl::android::hardware::wifi::hostapd::BandMask; using aidl::android::hardware::wifi::hostapd::BnHostapdCallback; @@ -69,19 +77,42 @@ class HostapdAidl : public testing::TestWithParam<std::string> { isBridgedSupport = testing::checkSubstringInCommandOutput( "/system/bin/cmd wifi get-softap-supported-features", "wifi_softap_bridged_ap_supported"); + const std::vector<std::string> instances = android::hardware::getAllHalInstanceNames( + ::android::hardware::wifi::V1_0::IWifi::descriptor); + EXPECT_NE(0, instances.size()); + wifiInstanceName = instances[0]; } virtual void TearDown() override { + if (getWifi(wifiInstanceName) != nullptr) { + stopWifi(wifiInstanceName); + } hostapd->terminate(); // Wait 3 seconds to allow terminate to complete sleep(3); } std::shared_ptr<IHostapd> hostapd; + std::string wifiInstanceName; bool isAcsSupport; bool isWpa3SaeSupport; bool isBridgedSupport; + std::string setupApIfaceAndGetName(bool isBridged) { + android::sp<::android::hardware::wifi::V1_0::IWifiApIface> wifi_ap_iface; + if (isBridged) { + wifi_ap_iface = getBridgedWifiApIface_1_5(wifiInstanceName); + } else { + wifi_ap_iface = getWifiApIface_1_5(wifiInstanceName); + } + EXPECT_NE(nullptr, wifi_ap_iface.get()); + + const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName); + EXPECT_EQ(android::hardware::wifi::V1_0::WifiStatusCode::SUCCESS, + status_and_name.first.code); + return status_and_name.second; + } + IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) { IfaceParams iface_params; ChannelParams channelParams; @@ -426,8 +457,9 @@ TEST_P(HostapdAidl, DisconnectClientWhenIfacAvailable) { */ TEST_P(HostapdAidl, AddAccessPointWithDualBandConfig) { if (!isBridgedSupport) GTEST_SKIP() << "Missing Bridged AP support"; - auto status = hostapd->addAccessPoint( - getIfaceParamsWithBridgedModeACS(kIfaceName), getOpenNwParams()); + std::string ifname = setupApIfaceAndGetName(true); + auto status = + hostapd->addAccessPoint(getIfaceParamsWithBridgedModeACS(ifname), getOpenNwParams()); EXPECT_TRUE(status.isOk()); } |