Merge "wifi(vts): Set the iface up as a part of setup"

This commit is contained in:
Treehugger Robot 2019-11-14 23:16:55 +00:00 committed by Gerrit Code Review
commit bf23b7b60c
5 changed files with 28 additions and 1 deletions

View file

@ -28,7 +28,10 @@ cc_library_static {
shared_libs: [
"libnativehelper",
],
static_libs: ["android.hardware.wifi@1.0"],
static_libs: [
"android.hardware.wifi@1.0",
"libwifi-system-iface"
],
}
cc_test {
@ -48,6 +51,7 @@ cc_test {
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
"libwifi-system-iface"
],
test_suites: ["general-tests"],
}
@ -62,6 +66,7 @@ cc_test {
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi@1.0",
"libwifi-system-iface"
],
test_suites: ["general-tests"],
}

View file

@ -18,12 +18,15 @@
#include <VtsHalHidlTargetTestBase.h>
#include <wifi_system/interface_tool.h>
#include "wifi_hidl_call_util.h"
#include "wifi_hidl_test_utils.h"
using ::android::hardware::wifi::V1_0::IWifi;
using ::android::hardware::wifi::V1_0::IWifiApIface;
using ::android::hardware::wifi::V1_0::IWifiChip;
using ::android::hardware::wifi::V1_0::IWifiIface;
using ::android::hardware::wifi::V1_0::IWifiNanIface;
using ::android::hardware::wifi::V1_0::IWifiP2pIface;
using ::android::hardware::wifi::V1_0::IWifiRttController;
@ -36,6 +39,7 @@ using ::android::hardware::wifi::V1_0::WifiStatusCode;
using ::android::sp;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::wifi_system::InterfaceTool;
extern WifiHidlEnvironment* gEnv;
@ -131,6 +135,16 @@ sp<IWifiChip> getWifiChip(const std::string& instance_name) {
return status_and_chip.second;
}
void setIfaceUp(const sp<IWifiIface>& iface) {
// Set the iface up before retrurning the object.
const auto& status_and_name = HIDL_INVOKE(iface, getName);
if (status_and_name.first.code == WifiStatusCode::SUCCESS) {
const auto& iface_name = status_and_name.second;
InterfaceTool iface_tool;
iface_tool.SetUpState(iface_name.c_str(), true);
}
}
sp<IWifiApIface> getWifiApIface(const std::string& instance_name) {
sp<IWifiChip> wifi_chip = getWifiChip(instance_name);
if (!wifi_chip.get()) {
@ -143,6 +157,7 @@ sp<IWifiApIface> getWifiApIface(const std::string& instance_name) {
if (status_and_iface.first.code != WifiStatusCode::SUCCESS) {
return nullptr;
}
setIfaceUp(status_and_iface.second);
return status_and_iface.second;
}
@ -158,6 +173,7 @@ sp<IWifiNanIface> getWifiNanIface(const std::string& instance_name) {
if (status_and_iface.first.code != WifiStatusCode::SUCCESS) {
return nullptr;
}
setIfaceUp(status_and_iface.second);
return status_and_iface.second;
}
@ -173,6 +189,7 @@ sp<IWifiP2pIface> getWifiP2pIface(const std::string& instance_name) {
if (status_and_iface.first.code != WifiStatusCode::SUCCESS) {
return nullptr;
}
setIfaceUp(status_and_iface.second);
return status_and_iface.second;
}
@ -188,6 +205,7 @@ sp<IWifiStaIface> getWifiStaIface(const std::string& instance_name) {
if (status_and_iface.first.code != WifiStatusCode::SUCCESS) {
return nullptr;
}
setIfaceUp(status_and_iface.second);
return status_and_iface.second;
}

View file

@ -26,6 +26,7 @@ cc_test {
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
"libwifi-system-iface"
],
test_suites: ["general-tests"],
}

View file

@ -28,6 +28,7 @@ cc_test {
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
"libwifi-system-iface"
],
test_suites: ["general-tests"],
}
@ -44,6 +45,7 @@ cc_test {
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
"libwifi-system-iface"
],
test_suites: ["general-tests"],
}

View file

@ -28,5 +28,6 @@ cc_test {
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
"libwifi-system-iface"
],
}