Merge "supplicant(vts): Remove dependency on libwifi_hal" into oc-dr1-dev

This commit is contained in:
TreeHugger Robot 2017-07-14 20:38:43 +00:00 committed by Android (Google) Code Review
commit be3cb04f37
2 changed files with 17 additions and 12 deletions

View file

@ -27,17 +27,18 @@ LOCAL_SRC_FILES := \
supplicant_sta_network_hidl_test.cpp supplicant_sta_network_hidl_test.cpp
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \
android.hardware.wifi.supplicant@1.0 \ android.hardware.wifi.supplicant@1.0 \
android.hardware.wifi@1.0 \
libbase \ libbase \
libcutils \ libcutils \
libhidlbase \ libhidlbase \
libhidltransport \ libhidltransport \
liblog \ liblog \
libutils \ libutils \
libwifi-hal \
libwifi-system \ libwifi-system \
libwifi-system-iface libwifi-system-iface
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libgmock \ libgmock \
VtsHalHidlTargetTestBase VtsHalHidlTargetTestBase \
VtsHalWifiV1_0TargetTestUtil
include $(BUILD_NATIVE_TEST) include $(BUILD_NATIVE_TEST)

View file

@ -21,11 +21,11 @@
#include <android/hidl/manager/1.0/IServiceNotification.h> #include <android/hidl/manager/1.0/IServiceNotification.h>
#include <hidl/HidlTransportSupport.h> #include <hidl/HidlTransportSupport.h>
#include <wifi_hal/driver_tool.h>
#include <wifi_system/interface_tool.h> #include <wifi_system/interface_tool.h>
#include <wifi_system/supplicant_manager.h> #include <wifi_system/supplicant_manager.h>
#include "supplicant_hidl_test_utils.h" #include "supplicant_hidl_test_utils.h"
#include "wifi_hidl_test_utils.h"
using ::android::sp; using ::android::sp;
using ::android::hardware::configureRpcThreadpool; using ::android::hardware::configureRpcThreadpool;
@ -34,6 +34,8 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec; using ::android::hardware::hidl_vec;
using ::android::hardware::Return; using ::android::hardware::Return;
using ::android::hardware::Void; 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::ISupplicant;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface; using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork; using ::android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork;
@ -44,22 +46,25 @@ using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hidl::manager::V1_0::IServiceNotification; using ::android::hidl::manager::V1_0::IServiceNotification;
using ::android::wifi_hal::DriverTool;
using ::android::wifi_system::InterfaceTool; using ::android::wifi_system::InterfaceTool;
using ::android::wifi_system::SupplicantManager; using ::android::wifi_system::SupplicantManager;
namespace { namespace {
const char kSupplicantServiceName[] = "default"; 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() { void initilializeDriverAndFirmware() {
DriverTool driver_tool; sp<IWifiChip> wifi_chip = getWifiChip();
InterfaceTool iface_tool; ChipModeId mode_id;
EXPECT_TRUE(driver_tool.LoadDriver()); EXPECT_TRUE(configureChipToSupportIfaceType(
EXPECT_TRUE(driver_tool.ChangeFirmwareMode(DriverTool::kFirmwareModeSta)); wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id));
EXPECT_TRUE(iface_tool.SetWifiUpState(true));
} }
// 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. // Helper function to find any iface of the desired type exposed.
bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type, bool findIfaceOfType(sp<ISupplicant> supplicant, IfaceType desired_type,
ISupplicant::IfaceInfo* out_info) { ISupplicant::IfaceInfo* out_info) {
@ -149,11 +154,10 @@ void startWifiFramework() {
} }
void stopSupplicant() { void stopSupplicant() {
DriverTool driver_tool;
SupplicantManager supplicant_manager; SupplicantManager supplicant_manager;
ASSERT_TRUE(supplicant_manager.StopSupplicant()); ASSERT_TRUE(supplicant_manager.StopSupplicant());
ASSERT_TRUE(driver_tool.UnloadDriver()); deInitilializeDriverAndFirmware();
ASSERT_FALSE(supplicant_manager.IsSupplicantRunning()); ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
} }