vts: hostapd: Remove optional service registration

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 <oleh.cherpak@globallogic.com>
Change-Id: Id65d09d39d93e540a24e58fda233fd2faf8c3258
Merged-In: Id65d09d39d93e540a24e58fda233fd2faf8c3258
This commit is contained in:
Oleh Cherpak 2020-02-04 15:15:35 +02:00 committed by Roshan Pius
parent ec37ce4947
commit 09f373d6c1
3 changed files with 20 additions and 6 deletions

View file

@ -89,8 +89,12 @@ bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip,
} }
} // namespace } // namespace
sp<IWifi> getWifi(const std::string& instance_name) {
return IWifi::getService(instance_name);
}
sp<IWifiChip> getWifiChip(const std::string& 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()) { if (!wifi.get()) {
return nullptr; return nullptr;
} }

View file

@ -31,6 +31,8 @@
// Note: We only have a single instance of each of these objects currently. // 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 // These helper functions should be modified to return vectors if we support
// multiple instances. // 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( android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip(
const std::string& instance_name); const std::string& instance_name);
android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface( android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface(

View file

@ -47,16 +47,24 @@ namespace {
// Helper function to initialize the driver and firmware to AP mode // Helper function to initialize the driver and firmware to AP mode
// using the vendor HAL HIDL interface. // using the vendor HAL HIDL interface.
void initilializeDriverAndFirmware(const std::string& wifi_instance_name) { void initilializeDriverAndFirmware(const std::string& wifi_instance_name) {
sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name); if (getWifi(wifi_instance_name) != nullptr) {
ChipModeId mode_id; sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
EXPECT_TRUE(configureChipToSupportIfaceType( ChipModeId mode_id;
wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &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 // Helper function to deinitialize the driver and firmware
// using the vendor HAL HIDL interface. // using the vendor HAL HIDL interface.
void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) { 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 } // namespace