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

Commit eada45e9 authored by Jordan Liu's avatar Jordan Liu Committed by Automerger Merge Worker
Browse files

Merge "Add VTS for setSimCardPower_1_6" am: fb4367c3

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

Change-Id: I5f3301e3bb0ddaf214e4f6f1a05ab8358edfdef8
parents e92e5a06 fb4367c3
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -217,6 +217,13 @@ interface IRadio extends @1.5::IRadio {
     * Each subsequent request to this method is processed only after the
     * Each subsequent request to this method is processed only after the
     * completion of the previous one.
     * completion of the previous one.
     *
     *
     * When the SIM is in POWER_DOWN, the modem should send an empty vector of
     * AppStatus in CardStatus.applications. If a SIM in the POWER_DOWN state
     * is removed and a new SIM is inserted, the new SIM should be in POWER_UP
     * mode by default. If the device is turned off or restarted while the SIM
     * is in POWER_DOWN, then the SIM should turn on normally in POWER_UP mode
     * when the device turns back on.
     *
     * Response callback is IRadioResponse.setSimCardPowerResponse_1_6().
     * Response callback is IRadioResponse.setSimCardPowerResponse_1_6().
     * Note that this differs from setSimCardPower_1_1 in that the response
     * Note that this differs from setSimCardPower_1_1 in that the response
     * callback should only be sent once the device has finished executing
     * callback should only be sent once the device has finished executing
+0 −1
Original line number Original line Diff line number Diff line
@@ -207,7 +207,6 @@ interface IRadioResponse extends @1.5::IRadioResponse {
     * Valid errors returned:
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:REQUEST_NOT_SUPPORTED
     *   RadioError:INVALID_ARGUMENTS
     *   RadioError:INVALID_ARGUMENTS
     *   RadioError:SIM_ERR (indicates a timeout or other issue making the SIM unresponsive)
     *   RadioError:SIM_ERR (indicates a timeout or other issue making the SIM unresponsive)
     *
     *
+47 −3
Original line number Original line Diff line number Diff line
@@ -320,7 +320,6 @@ TEST_P(RadioHidlTest_v1_6, setDataThrottling) {


    res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::THROTTLE_ANCHOR_CARRIER, 60);
    res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::THROTTLE_ANCHOR_CARRIER, 60);
    ASSERT_OK(res);
    ASSERT_OK(res);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
@@ -350,7 +349,6 @@ TEST_P(RadioHidlTest_v1_6, setDataThrottling) {


    res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::NO_DATA_THROTTLING, 60);
    res = radio_v1_6->setDataThrottling(serial, DataThrottlingAction::NO_DATA_THROTTLING, 60);
    ASSERT_OK(res);
    ASSERT_OK(res);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
    EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
@@ -361,3 +359,49 @@ TEST_P(RadioHidlTest_v1_6, setDataThrottling) {
                              ::android::hardware::radio::V1_6::RadioError::NONE,
                              ::android::hardware::radio::V1_6::RadioError::NONE,
                              ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS}));
                              ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS}));
}
}

/*
 * Test IRadio.setSimCardPower_1_6() for the response returned.
 */
TEST_P(RadioHidlTest_v1_6, setSimCardPower_1_6) {
    /* Test setSimCardPower power down */
    serial = GetRandomSerialNumber();
    radio_v1_6->setSimCardPower_1_6(serial, CardPowerState::POWER_DOWN);
    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);
    ASSERT_TRUE(
            CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
                             {::android::hardware::radio::V1_6::RadioError::NONE,
                              ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
                              ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE}));

    // setSimCardPower_1_6 does not return  until the request is handled, and should not trigger
    // CardState::ABSENT when turning off power
    if (radioRsp_v1_6->rspInfo.error == ::android::hardware::radio::V1_6::RadioError::NONE) {
        /* Wait some time for setting sim power down and then verify it */
        updateSimCardStatus();
        EXPECT_EQ(CardState::PRESENT, cardStatus.base.base.base.cardState);
        // applications should be an empty vector of AppStatus
        EXPECT_EQ(0, cardStatus.applications.size());
    }

    /* Test setSimCardPower power up */
    serial = GetRandomSerialNumber();
    radio_v1_6->setSimCardPower_1_6(serial, CardPowerState::POWER_UP);
    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);
    ASSERT_TRUE(
            CheckAnyOfErrors(radioRsp_v1_6->rspInfo.error,
                             {::android::hardware::radio::V1_6::RadioError::NONE,
                              ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS,
                              ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE}));

    // setSimCardPower_1_6 does not return  until the request is handled. Just verify that we still
    // have CardState::PRESENT after turning the power back on
    if (radioRsp_v1_6->rspInfo.error == ::android::hardware::radio::V1_6::RadioError::NONE) {
        updateSimCardStatus();
        EXPECT_EQ(CardState::PRESENT, cardStatus.base.base.base.cardState);
    }
}