summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorlesl <lesl@google.com>2019-04-17 18:45:56 +0800
committerlesl <lesl@google.com>2019-04-18 10:18:22 +0800
commitce4a7cce2c0439b4c231cc06287aecb7f4ed7e1f (patch)
treee836c37b47a08dd4ab160bdb034ae65c871943c0 /wifi
parentb1a144041e19765e6e1b1321a87a92dda21cff9c (diff)
downloadandroid_hardware_interfaces-ce4a7cce2c0439b4c231cc06287aecb7f4ed7e1f.tar.gz
android_hardware_interfaces-ce4a7cce2c0439b4c231cc06287aecb7f4ed7e1f.tar.bz2
android_hardware_interfaces-ce4a7cce2c0439b4c231cc06287aecb7f4ed7e1f.zip
hostapd: fix hostapd vts fail
If wpa_supplicant is running during hostapd vts and there are some configuration in wpa_supplicant. It will happen both of hostapd and wpa_supplicant are working with wlan0 interface. Stop wpa_supplicant before running hostapd vts. Reproduce step: 1. Connect to Wifi before execute hostapd vts. 2. Run hostapd vts. Bug: 130207248 Test: vts with below commands vts-tradefed run commandAndExit vts-hal --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalWifiHostapdV1_0Target -l INFO vts-tradefed run commandAndExit vts-hal --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalWifiHostapdV1_1Target -l INFO Change-Id: Id91463c2eab3c8c348a91bd978d7ea4aa8d42e85
Diffstat (limited to 'wifi')
-rw-r--r--wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp1
-rw-r--r--wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp20
-rw-r--r--wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h1
-rw-r--r--wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp1
4 files changed, 19 insertions, 4 deletions
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
index fa780f9a5..6dc9eb4be 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
@@ -41,6 +41,7 @@ constexpr int kIfaceInvalidChannel = 567;
class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
+ stopSupplicantIfNeeded();
startHostapdAndWaitForHidlService();
hostapd_ = getHostapd();
ASSERT_NE(hostapd_.get(), nullptr);
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 22dbb528c..1c499e746 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
@@ -23,24 +23,26 @@
#include <wifi_system/hostapd_manager.h>
#include <wifi_system/interface_tool.h>
+#include <wifi_system/supplicant_manager.h>
#include "hostapd_hidl_test_utils.h"
#include "wifi_hidl_test_utils.h"
using ::android::sp;
using ::android::hardware::configureRpcThreadpool;
-using ::android::hardware::joinRpcThreadpool;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
+using ::android::hardware::joinRpcThreadpool;
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::hostapd::V1_0::IHostapd;
using ::android::hardware::wifi::hostapd::V1_0::HostapdStatus;
using ::android::hardware::wifi::hostapd::V1_0::HostapdStatusCode;
+using ::android::hardware::wifi::hostapd::V1_0::IHostapd;
+using ::android::hardware::wifi::V1_0::ChipModeId;
+using ::android::hardware::wifi::V1_0::IWifiChip;
using ::android::hidl::manager::V1_0::IServiceNotification;
using ::android::wifi_system::HostapdManager;
+using ::android::wifi_system::SupplicantManager;
extern WifiHostapdHidlEnvironment* gEnv;
@@ -108,6 +110,16 @@ class ServiceNotificationListener : public IServiceNotification {
std::condition_variable condition_;
};
+void stopSupplicantIfNeeded() {
+ SupplicantManager supplicant_manager;
+ if (supplicant_manager.IsSupplicantRunning()) {
+ LOG(INFO) << "Supplicant is running, stop supplicant first.";
+ ASSERT_TRUE(supplicant_manager.StopSupplicant());
+ deInitilializeDriverAndFirmware();
+ ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
+ }
+}
+
void stopHostapd() {
HostapdManager hostapd_manager;
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
index 8e2f1a34d..9b3df4206 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
@@ -25,6 +25,7 @@
// Used to stop the android wifi framework before every test.
void stopWifiFramework();
void startWifiFramework();
+void stopSupplicantIfNeeded();
void stopHostapd();
// Used to configure the chip, driver and start wpa_hostapd before every
// test.
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
index 439a62403..26a58b2c6 100644
--- a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
@@ -45,6 +45,7 @@ constexpr int kIfaceInvalidChannel = 567;
class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
+ stopSupplicantIfNeeded();
startHostapdAndWaitForHidlService();
hostapd_ = getHostapd_1_1();
ASSERT_NE(hostapd_.get(), nullptr);