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

Commit 5645ff64 authored by Yomna Nasser's avatar Yomna Nasser
Browse files

Adds VTS test for getAllowedNetworkTypesBitmap

Adds VTS test for the new HAL API getAllowedNetworkTypesBitmap

Bug: b/190398554
Test: atest VtsHalRadioV1_6TargetTest
Change-Id: Ida0aff8e239cad324627db83903f4a1adcc479d1
Merged-In: Ida0aff8e239cad324627db83903f4a1adcc479d1
parent 15410861
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -51,6 +51,49 @@ TEST_P(RadioHidlTest_v1_6, setAllowedNetworkTypesBitmap) {
    }
}

/*
 * Test IRadio.getAllowedNetworkTypesBitmap for the response returned.
 */
TEST_P(RadioHidlTest_v1_6, getAllowedNetworkTypesBitmap) {
    serial = GetRandomSerialNumber();
    ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_4::RadioAccessFamily>
            allowedNetworkTypesBitmap{};
    allowedNetworkTypesBitmap |= ::android::hardware::radio::V1_4::RadioAccessFamily::LTE;

    radio_v1_6->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);

    if (radioRsp_v1_6->rspInfo.error == ::android::hardware::radio::V1_6::RadioError::NONE) {
        sleep(3);  // wait for modem
        serial = GetRandomSerialNumber();
        radio_v1_6->getAllowedNetworkTypesBitmap(serial);

        EXPECT_EQ(std::cv_status::no_timeout, wait());
        EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
        EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);

        if (getRadioHalCapabilities()) {
            ASSERT_TRUE(CheckAnyOfErrors(
                    radioRsp_v1_6->rspInfo.error,
                    {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}));
        } else {
            ASSERT_TRUE(CheckAnyOfErrors(
                    radioRsp_v1_6->rspInfo.error,
                    {::android::hardware::radio::V1_6::RadioError::NONE,
                     ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
                     ::android::hardware::radio::V1_6::RadioError::OPERATION_NOT_ALLOWED,
                     ::android::hardware::radio::V1_6::RadioError::MODE_NOT_SUPPORTED,
                     ::android::hardware::radio::V1_6::RadioError::INTERNAL_ERR,
                     ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
                     ::android::hardware::radio::V1_6::RadioError::MODEM_ERR,
                     ::android::hardware::radio::V1_6::RadioError::NO_RESOURCES}));
        }
    }
}

/*
 * Test IRadio.setupDataCall_1_6() for the response returned.
 */
+5 −2
Original line number Diff line number Diff line
@@ -1172,10 +1172,13 @@ Return<void> RadioResponse_v1_6::setAllowedNetworkTypesBitmapResponse(
}

Return<void> RadioResponse_v1_6::getAllowedNetworkTypesBitmapResponse(
        const ::android::hardware::radio::V1_6::RadioResponseInfo& /*info*/,
        const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
        const ::android::hardware::hidl_bitfield<
                ::android::hardware::radio::V1_4::RadioAccessFamily>
        /*networkTypeBitmap*/) {
                networkTypeBitmap) {
    rspInfo = info;
    networkTypeBitmapResponse = networkTypeBitmap;
    parent_v1_6.notify(info.serial);
    return Void();
}