mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:09:42 +00:00
Add feature flag to disable wifi AP on the watch.
Bug: 74074075 Change-Id: I6bd823e63f5cc5292571be4d74ca65bca72709e0
This commit is contained in:
@@ -27,6 +27,9 @@ endif
|
||||
ifdef WIFI_HIDL_FEATURE_DUAL_INTERFACE
|
||||
LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DUAL_INTERFACE
|
||||
endif
|
||||
ifdef WIFI_HIDL_FEATURE_DISABLE_AP
|
||||
LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP
|
||||
endif
|
||||
LOCAL_SRC_FILES := \
|
||||
hidl_struct_util.cpp \
|
||||
hidl_sync_util.cpp \
|
||||
|
||||
@@ -34,6 +34,7 @@ class MockWifiFeatureFlags : public WifiFeatureFlags {
|
||||
|
||||
MOCK_METHOD0(isAwareSupported, bool());
|
||||
MOCK_METHOD0(isDualInterfaceSupported, bool());
|
||||
MOCK_METHOD0(isApDisabled, bool());
|
||||
};
|
||||
|
||||
} // namespace feature_flags
|
||||
|
||||
@@ -48,6 +48,8 @@ class WifiChipTest : public Test {
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
EXPECT_CALL(*feature_flags_, isApDisabled())
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
}
|
||||
|
||||
void setupV1_AwareIfaceCombination() {
|
||||
@@ -55,6 +57,17 @@ class WifiChipTest : public Test {
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
EXPECT_CALL(*feature_flags_, isApDisabled())
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
}
|
||||
|
||||
void setupV1_AwareDisabledApIfaceCombination() {
|
||||
EXPECT_CALL(*feature_flags_, isAwareSupported())
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
EXPECT_CALL(*feature_flags_, isApDisabled())
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
}
|
||||
|
||||
void setupV2_AwareIfaceCombination() {
|
||||
@@ -62,6 +75,17 @@ class WifiChipTest : public Test {
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
EXPECT_CALL(*feature_flags_, isApDisabled())
|
||||
.WillRepeatedly(testing::Return(false));
|
||||
}
|
||||
|
||||
void setupV2_AwareDisabledApIfaceCombination() {
|
||||
EXPECT_CALL(*feature_flags_, isAwareSupported())
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
EXPECT_CALL(*feature_flags_, isDualInterfaceSupported())
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
EXPECT_CALL(*feature_flags_, isApDisabled())
|
||||
.WillRepeatedly(testing::Return(true));
|
||||
}
|
||||
|
||||
void assertNumberOfModes(uint32_t num_modes) {
|
||||
@@ -515,6 +539,39 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest,
|
||||
ASSERT_FALSE(ap_iface_name.empty());
|
||||
ASSERT_NE(sta_iface_name, ap_iface_name);
|
||||
}
|
||||
|
||||
////////// V1 Iface Combinations when AP creation is disabled //////////
|
||||
class WifiChipV1_AwareDisabledApIfaceCombinationTest : public WifiChipTest {
|
||||
public:
|
||||
void SetUp() override {
|
||||
setupV1_AwareDisabledApIfaceCombination();
|
||||
WifiChipTest::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(WifiChipV1_AwareDisabledApIfaceCombinationTest,
|
||||
StaMode_CreateSta_ShouldSucceed) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_FALSE(createIface(IfaceType::STA).empty());
|
||||
ASSERT_TRUE(createIface(IfaceType::AP).empty());
|
||||
}
|
||||
|
||||
////////// V2 Iface Combinations when AP creation is disabled //////////
|
||||
class WifiChipV2_AwareDisabledApIfaceCombinationTest: public WifiChipTest {
|
||||
public:
|
||||
void SetUp() override {
|
||||
setupV2_AwareDisabledApIfaceCombination();
|
||||
WifiChipTest::SetUp();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(WifiChipV2_AwareDisabledApIfaceCombinationTest,
|
||||
CreateSta_ShouldSucceed) {
|
||||
findModeAndConfigureForIfaceType(IfaceType::STA);
|
||||
ASSERT_FALSE(createIface(IfaceType::STA).empty());
|
||||
ASSERT_TRUE(createIface(IfaceType::AP).empty());
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
} // namespace wifi
|
||||
|
||||
@@ -1211,10 +1211,17 @@ void WifiChip::populateModes() {
|
||||
{chip_iface_combination_limit_1, chip_iface_combination_limit_2}};
|
||||
const IWifiChip::ChipIfaceCombination chip_iface_combination_2 = {
|
||||
{chip_iface_combination_limit_1, chip_iface_combination_limit_3}};
|
||||
const IWifiChip::ChipMode chip_mode = {
|
||||
if (feature_flags_.lock()->isApDisabled()) {
|
||||
const IWifiChip::ChipMode chip_mode = {
|
||||
kV2ChipModeId,
|
||||
{chip_iface_combination_2}};
|
||||
modes_ = {chip_mode};
|
||||
} else {
|
||||
const IWifiChip::ChipMode chip_mode = {
|
||||
kV2ChipModeId,
|
||||
{chip_iface_combination_1, chip_iface_combination_2}};
|
||||
modes_ = {chip_mode};
|
||||
modes_ = {chip_mode};
|
||||
}
|
||||
} else {
|
||||
// V1 Iface combinations for Mode Id = 0. (STA Mode)
|
||||
const IWifiChip::ChipIfaceCombinationLimit
|
||||
@@ -1238,7 +1245,11 @@ void WifiChip::populateModes() {
|
||||
{ap_chip_iface_combination_limit}};
|
||||
const IWifiChip::ChipMode ap_chip_mode = {kV1ApChipModeId,
|
||||
{ap_chip_iface_combination}};
|
||||
modes_ = {sta_chip_mode, ap_chip_mode};
|
||||
if (feature_flags_.lock()->isApDisabled()) {
|
||||
modes_ = {sta_chip_mode};
|
||||
} else {
|
||||
modes_ = {sta_chip_mode, ap_chip_mode};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,12 @@ static const bool wifiHidlFeatureDualInterface = true;
|
||||
#else
|
||||
static const bool wifiHidlFeatureDualInterface = false;
|
||||
#endif // WIFI_HIDL_FEATURE_DUAL_INTERFACE
|
||||
#ifdef WIFI_HIDL_FEATURE_DISABLE_AP
|
||||
static const bool wifiHidlFeatureDisableAp = true;
|
||||
#else
|
||||
static const bool wifiHidlFeatureDisableAp = false;
|
||||
#endif // WIFI_HIDL_FEATURE_DISABLE_AP
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace android {
|
||||
@@ -41,6 +47,9 @@ bool WifiFeatureFlags::isAwareSupported() { return wifiHidlFeatureAware; }
|
||||
bool WifiFeatureFlags::isDualInterfaceSupported() {
|
||||
return wifiHidlFeatureDualInterface;
|
||||
}
|
||||
bool WifiFeatureFlags::isApDisabled() {
|
||||
return wifiHidlFeatureDisableAp;
|
||||
}
|
||||
|
||||
} // namespace feature_flags
|
||||
} // namespace implementation
|
||||
|
||||
@@ -31,6 +31,7 @@ class WifiFeatureFlags {
|
||||
|
||||
virtual bool isAwareSupported();
|
||||
virtual bool isDualInterfaceSupported();
|
||||
virtual bool isApDisabled();
|
||||
};
|
||||
|
||||
} // namespace feature_flags
|
||||
|
||||
Reference in New Issue
Block a user