supplicant(vts): Remove dependency on libwifi_hal

libwifi_hal is a vendor component, so these are not allowed to be used
in the VTS tests. Use the vendor HAL for the required initializations
instead since that is the flow used by framework anyway (setup the wifi
chip using vendor hal and then use wpa_supplicant for connections).

Bug: 63704014
Bug: 33241851
Test: make vts -j30 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 &&
vts-tradefed run commandAndExit vts --skip-all-system-status-check
--primary-abi-only --skip-preconditions --module
VtsHalWifiSupplicantV1_0Target -l INFO

Change-Id: I396d8311253e2b2493f9bb901731937019d30164
diff --git a/wifi/supplicant/1.0/vts/functional/Android.mk b/wifi/supplicant/1.0/vts/functional/Android.mk
index d87d7ef..c6e3950 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.mk
+++ b/wifi/supplicant/1.0/vts/functional/Android.mk
@@ -27,17 +27,18 @@
     supplicant_sta_network_hidl_test.cpp
 LOCAL_SHARED_LIBRARIES := \
     android.hardware.wifi.supplicant@1.0 \
+    android.hardware.wifi@1.0 \
     libbase \
     libcutils \
     libhidlbase \
     libhidltransport \
     liblog \
     libutils \
-    libwifi-hal \
     libwifi-system \
     libwifi-system-iface
 LOCAL_STATIC_LIBRARIES := \
     libgmock \
-    VtsHalHidlTargetTestBase
+    VtsHalHidlTargetTestBase \
+    VtsHalWifiV1_0TargetTestUtil
 include $(BUILD_NATIVE_TEST)
 
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index df4bfa9..0afab2f 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -21,11 +21,11 @@
 #include <android/hidl/manager/1.0/IServiceNotification.h>
 #include <hidl/HidlTransportSupport.h>
 
-#include <wifi_hal/driver_tool.h>
 #include <wifi_system/interface_tool.h>
 #include <wifi_system/supplicant_manager.h>
 
 #include "supplicant_hidl_test_utils.h"
+#include "wifi_hidl_test_utils.h"
 
 using ::android::sp;
 using ::android::hardware::configureRpcThreadpool;
@@ -34,6 +34,8 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
+using ::android::hardware::wifi::V1_0::ChipModeId;
+using ::android::hardware::wifi::V1_0::IWifiChip;
 using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface;
 using ::android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork;
@@ -44,22 +46,25 @@
 using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
 using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
 using ::android::hidl::manager::V1_0::IServiceNotification;
-using ::android::wifi_hal::DriverTool;
 using ::android::wifi_system::InterfaceTool;
 using ::android::wifi_system::SupplicantManager;
 
 namespace {
 const char kSupplicantServiceName[] = "default";
 
-// Helper function to initialize the driver and firmware to STA mode.
+// Helper function to initialize the driver and firmware to STA mode
+// using the vendor HAL HIDL interface.
 void initilializeDriverAndFirmware() {
-    DriverTool driver_tool;
-    InterfaceTool iface_tool;
-    EXPECT_TRUE(driver_tool.LoadDriver());
-    EXPECT_TRUE(driver_tool.ChangeFirmwareMode(DriverTool::kFirmwareModeSta));
-    EXPECT_TRUE(iface_tool.SetWifiUpState(true));
+    sp<IWifiChip> wifi_chip = getWifiChip();
+    ChipModeId mode_id;
+    EXPECT_TRUE(configureChipToSupportIfaceType(
+        wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id));
 }
 
+// Helper function to deinitialize the driver and firmware
+// using the vendor HAL HIDL interface.
+void deInitilializeDriverAndFirmware() { stopWifi(); }
+
 // Helper function to find any iface of the desired type exposed.
 bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type,
                      ISupplicant::IfaceInfo* out_info) {
@@ -149,11 +154,10 @@
 }
 
 void stopSupplicant() {
-    DriverTool driver_tool;
     SupplicantManager supplicant_manager;
 
     ASSERT_TRUE(supplicant_manager.StopSupplicant());
-    ASSERT_TRUE(driver_tool.UnloadDriver());
+    deInitilializeDriverAndFirmware();
     ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
 }