Skip to content

Commit

Permalink
vts: hostapd: Remove optional service registration
Browse files Browse the repository at this point in the history
Wifi VendorHAL is optional for Soft AP mode to function.
Tests should be runnable even on devices without VendorHAL.

Test: run vts -m VtsHalWifiHostapdV1_1Target
Bug: 148907288
Bug: 158343986

Signed-off-by: Oleh Cherpak <[email protected]>
Change-Id: Id65d09d39d93e540a24e58fda233fd2faf8c3258
Merged-In: Id65d09d39d93e540a24e58fda233fd2faf8c3258
  • Loading branch information
olehcherpak authored and rpius committed Jul 11, 2020
1 parent ec37ce4 commit 09f373d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 5 additions & 1 deletion wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip,
}
} // namespace

sp<IWifi> getWifi(const std::string& instance_name) {
return IWifi::getService(instance_name);
}

sp<IWifiChip> getWifiChip(const std::string& instance_name) {
sp<IWifi> wifi = IWifi::getService(instance_name);
sp<IWifi> wifi = getWifi(instance_name);
if (!wifi.get()) {
return nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions wifi/1.0/vts/functional/wifi_hidl_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
// Note: We only have a single instance of each of these objects currently.
// These helper functions should be modified to return vectors if we support
// multiple instances.
android::sp<android::hardware::wifi::V1_0::IWifi> getWifi(
const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip(
const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface(
Expand Down
18 changes: 13 additions & 5 deletions wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,24 @@ namespace {
// Helper function to initialize the driver and firmware to AP mode
// using the vendor HAL HIDL interface.
void initilializeDriverAndFirmware(const std::string& wifi_instance_name) {
sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
ChipModeId mode_id;
EXPECT_TRUE(configureChipToSupportIfaceType(
wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &mode_id));
if (getWifi(wifi_instance_name) != nullptr) {
sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
ChipModeId mode_id;
EXPECT_TRUE(configureChipToSupportIfaceType(
wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &mode_id));
} else {
LOG(WARNING) << __func__ << ": Vendor HAL not supported";
}
}

// Helper function to deinitialize the driver and firmware
// using the vendor HAL HIDL interface.
void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) {
stopWifi(wifi_instance_name);
if (getWifi(wifi_instance_name) != nullptr) {
stopWifi(wifi_instance_name);
} else {
LOG(WARNING) << __func__ << ": Vendor HAL not supported";
}
}
} // namespace

Expand Down

0 comments on commit 09f373d

Please sign in to comment.