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

Commit 42b19bea authored by Gabriel Biren's avatar Gabriel Biren Committed by Automerger Merge Worker
Browse files

Merge "Use the default SAP interface name in VtsHalWifiHostapdV1_2TargetTest."...

Merge "Use the default SAP interface name in VtsHalWifiHostapdV1_2TargetTest." into udc-dev am: 72235e8d

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/22605821



Change-Id: I54cccb51bedb8952fc1be19726e3069ac975687e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 801a3ad1 72235e8d
Loading
Loading
Loading
Loading
+26 −18
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ class HostapdHidlTest
                                          hostapd_instance_name_);
        hostapd_ = IHostapd::getService(hostapd_instance_name_);
        ASSERT_NE(hostapd_.get(), nullptr);
        setupApIfaceIfNeeded();
        isAcsSupport_ = testing::checkSubstringInCommandOutput(
            "/system/bin/cmd wifi get-softap-supported-features",
            "wifi_softap_acs_supported");
@@ -86,14 +87,21 @@ class HostapdHidlTest
    bool isWpa3SaeSupport_ = false;
    bool isAcsSupport_ = false;

    std::string setupApIfaceIfNeededAndGetName() {
    void setupApIfaceIfNeeded() {
        sp<IWifiApIface> wifi_ap_iface;
        wifi_ap_iface = getWifiApIface_1_4(wifi_instance_name_);
        EXPECT_NE(nullptr, wifi_ap_iface.get());

        const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName);
        EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_name.first.code);
        return status_and_name.second;
    }

    std::string getPrimaryWlanIfaceName() {
        std::array<char, PROPERTY_VALUE_MAX> buffer;
        auto res = property_get("ro.vendor.wifi.sap.interface", buffer.data(), nullptr);
        if (res > 0) return buffer.data();
        property_get("wifi.interface", buffer.data(), "wlan0");
        return buffer.data();
    }

    IHostapd::IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) {
@@ -243,7 +251,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcs(ifname), getPskNwParams());
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -257,7 +265,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcsAndFreqRange(ifname),
                              getPskNwParams());
@@ -272,7 +280,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcsAndInvalidFreqRange(ifname),
                              getPskNwParams());
@@ -287,7 +295,7 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcs(ifname), getOpenNwParams());
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -300,7 +308,7 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getPskNwParams());
@@ -314,7 +322,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getOpenNwParams());
@@ -329,7 +337,7 @@ TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithoutAcs(ifname),
                              getSaeTransitionNwParams());
@@ -344,7 +352,7 @@ TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getSaeNwParams());
@@ -359,7 +367,7 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status_1_2 =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname),
                    getPskNwParams());
@@ -377,7 +385,7 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status_1_2 =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getPskNwParams());
@@ -395,7 +403,7 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithInvalidChannel(ifname), getPskNwParams());
@@ -409,7 +417,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams());
@@ -424,7 +432,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithoutAcs(ifname),
                              getInvalidSaeTransitionNwParams());
@@ -439,7 +447,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams());
@@ -451,7 +459,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
 * when hotspot interface doesn't init..
 */
TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) {
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname,
                              kTestZeroMacAddr, kTestDisconnectReasonCode);
    EXPECT_EQ(HostapdStatusCode::FAILURE_IFACE_UNKNOWN, status.code);
@@ -464,7 +472,7 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) {
TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
    if (is_1_3(hostapd_))
        GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
    std::string ifname = setupApIfaceIfNeededAndGetName();
    std::string ifname = getPrimaryWlanIfaceName();
    auto status_1_2 =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithoutAcs(ifname), getOpenNwParams());