Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c320fbaf authored by Gabriel Biren's avatar Gabriel Biren Committed by Android (Google) Code Review
Browse files

Merge changes I917be24b,Ia10d3805 into main

* changes:
  Skip AP and P2P tests in wifi_chip_aidl_test if those iface types cannot be created.
  Add AIDL VTS helper method to check whether the specified iface type is supported.
parents 1f5c270b e8e161e2
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -203,6 +203,20 @@ bool configureChipToSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wif
    return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id);
    return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id);
}
}


bool doesChipSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
                                    IfaceConcurrencyType type) {
    if (!wifi_chip.get()) {
        return false;
    }
    std::vector<IWifiChip::ChipMode> chip_modes;
    auto status = wifi_chip->getAvailableModes(&chip_modes);
    if (!status.isOk()) {
        return false;
    }
    int mode_id;
    return findAnyModeSupportingConcurrencyType(type, chip_modes, &mode_id);
}

void stopWifiService(const char* instance_name) {
void stopWifiService(const char* instance_name) {
    std::shared_ptr<IWifi> wifi = getWifi(instance_name);
    std::shared_ptr<IWifi> wifi = getWifi(instance_name);
    if (wifi != nullptr) {
    if (wifi != nullptr) {
+3 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,9 @@ std::shared_ptr<IWifiApIface> getBridgedWifiApIface(std::shared_ptr<IWifiChip> w
// Configure the chip in a mode to support the creation of the provided iface type.
// Configure the chip in a mode to support the creation of the provided iface type.
bool configureChipToSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
bool configureChipToSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
                                           IfaceConcurrencyType type, int* configured_mode_id);
                                           IfaceConcurrencyType type, int* configured_mode_id);
// Check whether the chip supports the creation of the provided iface type.
bool doesChipSupportConcurrencyType(const std::shared_ptr<IWifiChip>& wifi_chip,
                                    IfaceConcurrencyType type);
// Used to trigger IWifi.stop() at the end of every test.
// Used to trigger IWifi.stop() at the end of every test.
void stopWifiService(const char* instance_name);
void stopWifiService(const char* instance_name);
int32_t getChipFeatureSet(const std::shared_ptr<IWifiChip>& wifi_chip);
int32_t getChipFeatureSet(const std::shared_ptr<IWifiChip>& wifi_chip);
+28 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,10 @@ class WifiChipAidlTest : public testing::TestWithParam<std::string> {
        return mode_id;
        return mode_id;
    }
    }


    bool isConcurrencyTypeSupported(IfaceConcurrencyType type) {
        return doesChipSupportConcurrencyType(wifi_chip_, type);
    }

    std::shared_ptr<IWifiStaIface> configureChipForStaAndGetIface() {
    std::shared_ptr<IWifiStaIface> configureChipForStaAndGetIface() {
        std::shared_ptr<IWifiStaIface> iface;
        std::shared_ptr<IWifiStaIface> iface;
        configureChipForConcurrencyType(IfaceConcurrencyType::STA);
        configureChipForConcurrencyType(IfaceConcurrencyType::STA);
@@ -532,6 +536,9 @@ TEST_P(WifiChipAidlTest, CreateStaIface) {
 * CreateApIface
 * CreateApIface
 */
 */
TEST_P(WifiChipAidlTest, CreateApIface) {
TEST_P(WifiChipAidlTest, CreateApIface) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
        GTEST_SKIP() << "AP is not supported";
    }
    configureChipForApAndGetIface();
    configureChipForApAndGetIface();
}
}


@@ -549,6 +556,9 @@ TEST_P(WifiChipAidlTest, CreateNanIface) {
 * CreateP2pIface
 * CreateP2pIface
 */
 */
TEST_P(WifiChipAidlTest, CreateP2pIface) {
TEST_P(WifiChipAidlTest, CreateP2pIface) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
        GTEST_SKIP() << "P2P is not supported";
    }
    configureChipForP2pAndGetIface();
    configureChipForP2pAndGetIface();
}
}


@@ -583,6 +593,9 @@ TEST_P(WifiChipAidlTest, GetStaIfaceNames) {
 * GetP2pIfaceNames
 * GetP2pIfaceNames
 */
 */
TEST_P(WifiChipAidlTest, GetP2pIfaceNames) {
TEST_P(WifiChipAidlTest, GetP2pIfaceNames) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
        GTEST_SKIP() << "P2P is not supported";
    }
    configureChipForConcurrencyType(IfaceConcurrencyType::P2P);
    configureChipForConcurrencyType(IfaceConcurrencyType::P2P);


    std::vector<std::string> iface_names;
    std::vector<std::string> iface_names;
@@ -607,6 +620,9 @@ TEST_P(WifiChipAidlTest, GetP2pIfaceNames) {
 * GetApIfaceNames
 * GetApIfaceNames
 */
 */
TEST_P(WifiChipAidlTest, GetApIfaceNames) {
TEST_P(WifiChipAidlTest, GetApIfaceNames) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
        GTEST_SKIP() << "AP is not supported";
    }
    configureChipForConcurrencyType(IfaceConcurrencyType::AP);
    configureChipForConcurrencyType(IfaceConcurrencyType::AP);


    std::vector<std::string> iface_names;
    std::vector<std::string> iface_names;
@@ -679,6 +695,9 @@ TEST_P(WifiChipAidlTest, GetStaIface) {
 * GetP2pIface
 * GetP2pIface
 */
 */
TEST_P(WifiChipAidlTest, GetP2pIface) {
TEST_P(WifiChipAidlTest, GetP2pIface) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
        GTEST_SKIP() << "P2P is not supported";
    }
    std::shared_ptr<IWifiP2pIface> iface = configureChipForP2pAndGetIface();
    std::shared_ptr<IWifiP2pIface> iface = configureChipForP2pAndGetIface();
    std::string iface_name = getP2pIfaceName(iface);
    std::string iface_name = getP2pIfaceName(iface);


@@ -697,6 +716,9 @@ TEST_P(WifiChipAidlTest, GetP2pIface) {
 * GetApIface
 * GetApIface
 */
 */
TEST_P(WifiChipAidlTest, GetApIface) {
TEST_P(WifiChipAidlTest, GetApIface) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
        GTEST_SKIP() << "AP is not supported";
    }
    std::shared_ptr<IWifiApIface> iface = configureChipForApAndGetIface();
    std::shared_ptr<IWifiApIface> iface = configureChipForApAndGetIface();
    std::string iface_name = getApIfaceName(iface);
    std::string iface_name = getApIfaceName(iface);


@@ -755,6 +777,9 @@ TEST_P(WifiChipAidlTest, RemoveStaIface) {
 * RemoveP2pIface
 * RemoveP2pIface
 */
 */
TEST_P(WifiChipAidlTest, RemoveP2pIface) {
TEST_P(WifiChipAidlTest, RemoveP2pIface) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::P2P)) {
        GTEST_SKIP() << "P2P is not supported";
    }
    std::shared_ptr<IWifiP2pIface> iface = configureChipForP2pAndGetIface();
    std::shared_ptr<IWifiP2pIface> iface = configureChipForP2pAndGetIface();
    std::string iface_name = getP2pIfaceName(iface);
    std::string iface_name = getP2pIfaceName(iface);


@@ -771,6 +796,9 @@ TEST_P(WifiChipAidlTest, RemoveP2pIface) {
 * RemoveApIface
 * RemoveApIface
 */
 */
TEST_P(WifiChipAidlTest, RemoveApIface) {
TEST_P(WifiChipAidlTest, RemoveApIface) {
    if (!isConcurrencyTypeSupported(IfaceConcurrencyType::AP)) {
        GTEST_SKIP() << "AP is not supported";
    }
    std::shared_ptr<IWifiApIface> iface = configureChipForApAndGetIface();
    std::shared_ptr<IWifiApIface> iface = configureChipForApAndGetIface();
    std::string iface_name = getApIfaceName(iface);
    std::string iface_name = getApIfaceName(iface);