wifi(implementation): Remove support for STA + STA in chip combination
Not planning to support STA + STA in Pixel 2018, so remove support for
it from the chip combination.
Also, fixed an error in existing unit tests (Need to mock
WifiLegacyHal.registerRadioModeChangeCallbackHandler)
Bug: 74079118
Test: Tested STA connection & AP bringup on taimen.
Test: ./hardware/interfaces/wifi/1.2/default/tests/runtests.sh
Change-Id: I996e63ecdda4d6a5a07a40d5f7ed1072ada37597
diff --git a/wifi/1.2/default/tests/mock_wifi_legacy_hal.h b/wifi/1.2/default/tests/mock_wifi_legacy_hal.h
index 8e1696e..43370b4 100644
--- a/wifi/1.2/default/tests/mock_wifi_legacy_hal.h
+++ b/wifi/1.2/default/tests/mock_wifi_legacy_hal.h
@@ -36,6 +36,9 @@
MOCK_METHOD2(stop, wifi_error(std::unique_lock<std::recursive_mutex>*,
const std::function<void()>&));
MOCK_METHOD2(setDfsFlag, wifi_error(const std::string&, bool));
+ MOCK_METHOD2(registerRadioModeChangeCallbackHandler,
+ wifi_error(const std::string&,
+ const on_radio_mode_change_callback&));
MOCK_METHOD2(nanRegisterCallbackHandlers,
wifi_error(const std::string&, const NanCallbackHandlers&));
MOCK_METHOD2(nanDisableRequest,
diff --git a/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp
index 1b082d0..27c8d60 100644
--- a/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp
+++ b/wifi/1.2/default/tests/wifi_chip_unit_tests.cpp
@@ -395,10 +395,10 @@
ASSERT_FALSE(createIface(IfaceType::AP).empty());
}
-TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaSta_ShouldSucceed) {
+TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaSta_ShouldFail) {
findModeAndConfigureForIfaceType(IfaceType::AP);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
- ASSERT_FALSE(createIface(IfaceType::STA).empty());
+ ASSERT_TRUE(createIface(IfaceType::STA).empty());
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_ShouldSucceed) {
@@ -407,35 +407,18 @@
ASSERT_FALSE(createIface(IfaceType::STA).empty());
}
-TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaStaAp_ShouldFail) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
- ASSERT_FALSE(createIface(IfaceType::STA).empty());
- ASSERT_FALSE(createIface(IfaceType::STA).empty());
- ASSERT_TRUE(createIface(IfaceType::AP).empty());
-}
-
TEST_F(WifiChipV2_AwareIfaceCombinationTest,
- CreateStaAp_AfterStaRemove_ShouldSucceed) {
+ CreateSta_AfterStaApRemove_ShouldSucceed) {
findModeAndConfigureForIfaceType(IfaceType::STA);
- ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto sta_iface_name = createIface(IfaceType::STA);
ASSERT_FALSE(sta_iface_name.empty());
- ASSERT_TRUE(createIface(IfaceType::AP).empty());
-
- // After removing STA iface, AP iface creation should succeed.
- removeIface(IfaceType::STA, sta_iface_name);
- ASSERT_FALSE(createIface(IfaceType::AP).empty());
-}
-
-TEST_F(WifiChipV2_AwareIfaceCombinationTest,
- CreateStaSta_AfterApRemove_ShouldSucceed) {
- findModeAndConfigureForIfaceType(IfaceType::STA);
- ASSERT_FALSE(createIface(IfaceType::STA).empty());
const auto ap_iface_name = createIface(IfaceType::AP);
ASSERT_FALSE(ap_iface_name.empty());
+
ASSERT_TRUE(createIface(IfaceType::STA).empty());
- // After removing AP iface, STA iface creation should succeed.
+ // After removing AP & STA iface, STA iface creation should succeed.
+ removeIface(IfaceType::STA, sta_iface_name);
removeIface(IfaceType::AP, ap_iface_name);
ASSERT_FALSE(createIface(IfaceType::STA).empty());
}
@@ -524,16 +507,6 @@
}
TEST_F(WifiChipV2_AwareIfaceCombinationTest,
- CreateStaSta_EnsureDifferentIfaceNames) {
- findModeAndConfigureForIfaceType(IfaceType::AP);
- const auto sta1_iface_name = createIface(IfaceType::STA);
- const auto sta2_iface_name = createIface(IfaceType::STA);
- ASSERT_FALSE(sta1_iface_name.empty());
- ASSERT_FALSE(sta2_iface_name.empty());
- ASSERT_NE(sta1_iface_name, sta2_iface_name);
-}
-
-TEST_F(WifiChipV2_AwareIfaceCombinationTest,
CreateStaAp_EnsureDifferentIfaceNames) {
findModeAndConfigureForIfaceType(IfaceType::AP);
const auto sta_iface_name = createIface(IfaceType::STA);
diff --git a/wifi/1.2/default/wifi_chip.cpp b/wifi/1.2/default/wifi_chip.cpp
index 201b8e4..dcd0a3c 100644
--- a/wifi/1.2/default/wifi_chip.cpp
+++ b/wifi/1.2/default/wifi_chip.cpp
@@ -1171,7 +1171,7 @@
// (conditional on isDualInterfaceSupported()):
// Interface Combination 1: Will support 1 STA and 1 P2P or NAN(optional)
// concurrent iface operations.
- // Interface Combination 2: Will support 1 STA and 1 STA or AP concurrent
+ // Interface Combination 2: Will support 1 STA and 1 AP concurrent
// iface operations.
// If Aware is enabled (conditional on isAwareSupported()), the iface
// combination will be modified to support either P2P or NAN in place of
@@ -1181,8 +1181,7 @@
const IWifiChip::ChipIfaceCombinationLimit
chip_iface_combination_limit_1 = {{IfaceType::STA}, 1};
const IWifiChip::ChipIfaceCombinationLimit
- chip_iface_combination_limit_2 = {{IfaceType::STA, IfaceType::AP},
- 1};
+ chip_iface_combination_limit_2 = {{IfaceType::AP}, 1};
IWifiChip::ChipIfaceCombinationLimit chip_iface_combination_limit_3;
if (feature_flags_.lock()->isAwareSupported()) {
chip_iface_combination_limit_3 = {{IfaceType::P2P, IfaceType::NAN},
diff --git a/wifi/1.2/default/wifi_legacy_hal.h b/wifi/1.2/default/wifi_legacy_hal.h
index bd68bcd..dedbbf8 100644
--- a/wifi/1.2/default/wifi_legacy_hal.h
+++ b/wifi/1.2/default/wifi_legacy_hal.h
@@ -274,7 +274,7 @@
wifi_error deregisterErrorAlertCallbackHandler(
const std::string& iface_name);
// Radio mode functions.
- wifi_error registerRadioModeChangeCallbackHandler(
+ virtual wifi_error registerRadioModeChangeCallbackHandler(
const std::string& iface_name,
const on_radio_mode_change_callback& on_user_change_callback);
// RTT functions.