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

Signed-off-by: Oleh Cherpak <oleh.cherpak@globallogic.com>
Change-Id: Id65d09d39d93e540a24e58fda233fd2faf8c3258
diff --git a/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp b/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp
index 0303b20..bd371c5 100644
--- a/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp
+++ b/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp
@@ -15,8 +15,6 @@
  */
 
 #include <android-base/logging.h>
-#include <android/hardware/wifi/1.0/IWifi.h>
-
 #include "hostapd_hidl_test_utils.h"
 
 class WifiHostapdHidlEnvironment_1_0 : public WifiHostapdHidlEnvironment {
@@ -29,7 +27,6 @@
     }
 
     virtual void registerTestServices() override {
-        registerTestService<::android::hardware::wifi::V1_0::IWifi>();
         registerTestService<android::hardware::wifi::hostapd::V1_0::IHostapd>();
     }
 
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
index cdbf1ab..58990cf 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
@@ -50,15 +50,25 @@
 // Helper function to initialize the driver and firmware to AP mode
 // using the vendor HAL HIDL interface.
 void initilializeDriverAndFirmware() {
-    sp<IWifiChip> wifi_chip = getWifiChip();
-    ChipModeId mode_id;
-    EXPECT_TRUE(configureChipToSupportIfaceType(
-        wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &mode_id));
+    if (getWifi() != nullptr) {
+        sp<IWifiChip> wifi_chip = getWifiChip();
+        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() { stopWifi(); }
+void deInitilializeDriverAndFirmware() {
+    if (getWifi() != nullptr) {
+        stopWifi();
+    } else {
+        LOG(WARNING) << __func__ << ": Vendor HAL not supported";
+    }
+}
 }  // namespace
 
 // Utility class to wait for wpa_hostapd's HIDL service registration.
diff --git a/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
index 6916db2..1fd9846 100644
--- a/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
+++ b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
@@ -15,7 +15,6 @@
  */
 
 #include <android-base/logging.h>
-#include <android/hardware/wifi/1.0/IWifi.h>
 
 #include "hostapd_hidl_test_utils.h"
 #include "hostapd_hidl_test_utils_1_1.h"
@@ -30,7 +29,6 @@
     }
 
     virtual void registerTestServices() override {
-        registerTestService<::android::hardware::wifi::V1_0::IWifi>();
         registerTestService<android::hardware::wifi::hostapd::V1_0::IHostapd>();
         registerTestService<android::hardware::wifi::hostapd::V1_1::IHostapd>();
     }