Merge "Add all prior VTS tests" am: 98131819ae

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

Change-Id: I0365fc9c6f4ae89fa5c5eb0fcbcd7ae446c06e38
This commit is contained in:
Sarah Chin 2022-01-31 21:33:58 +00:00 committed by Automerger Merge Worker
commit 9efd796045
16 changed files with 4557 additions and 169 deletions

View file

@ -19,12 +19,15 @@
RadioConfigResponse::RadioConfigResponse(RadioServiceTest& parent) : parent_config(parent) {}
ndk::ScopedAStatus RadioConfigResponse::getSimSlotsStatusResponse(
const RadioResponseInfo& /* info */, const std::vector<SimSlotStatus>& /* slotStatus */) {
const RadioResponseInfo& info, const std::vector<SimSlotStatus>& /* slotStatus */) {
rspInfo = info;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(
const RadioResponseInfo& /* info */) {
ndk::ScopedAStatus RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -37,22 +40,28 @@ ndk::ScopedAStatus RadioConfigResponse::getPhoneCapabilityResponse(
}
ndk::ScopedAStatus RadioConfigResponse::setPreferredDataModemResponse(
const RadioResponseInfo& /* info */) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getNumOfLiveModemsResponse(
const RadioResponseInfo& /* info */, const int8_t /* numOfLiveModems */) {
const RadioResponseInfo& info, const int8_t /* numOfLiveModems */) {
rspInfo = info;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(
const RadioResponseInfo& /* info */) {
ndk::ScopedAStatus RadioConfigResponse::setNumOfLiveModemsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioConfigResponse::getHalDeviceCapabilitiesResponse(
const RadioResponseInfo& info, bool modemReducedFeatures) {
rspInfo = info;
modemReducedFeatureSet1 = modemReducedFeatures;
parent_config.notify(info.serial);
return ndk::ScopedAStatus::ok();

View file

@ -54,3 +54,102 @@ TEST_P(RadioConfigTest, getHalDeviceCapabilities) {
ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
}
/*
* Test IRadioConfig.getSimSlotsStatus() for the response returned.
*/
TEST_P(RadioConfigTest, getSimSlotsStatus) {
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial);
ASSERT_OK(res);
ALOGI("getSimSlotsStatus, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
}
/*
* Test IRadioConfig.getPhoneCapability() for the response returned.
*/
TEST_P(RadioConfigTest, getPhoneCapability) {
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_config->getPhoneCapability(serial);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
ALOGI("getPhoneCapability, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_config->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
if (radioRsp_config->rspInfo.error == RadioError ::NONE) {
// maxActiveData should be greater than or equal to maxActiveInternetData.
EXPECT_GE(radioRsp_config->phoneCap.maxActiveData,
radioRsp_config->phoneCap.maxActiveInternetData);
// maxActiveData and maxActiveInternetData should be 0 or positive numbers.
EXPECT_GE(radioRsp_config->phoneCap.maxActiveInternetData, 0);
}
}
/*
* Test IRadioConfig.setPreferredDataModem() for the response returned.
*/
TEST_P(RadioConfigTest, setPreferredDataModem) {
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_config->getPhoneCapability(serial);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
ALOGI("getPhoneCapability, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_config->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
if (radioRsp_config->rspInfo.error != RadioError ::NONE) {
return;
}
if (radioRsp_config->phoneCap.logicalModemIds.size() == 0) {
return;
}
// We get phoneCapability. Send setPreferredDataModem command
serial = GetRandomSerialNumber();
uint8_t modemId = radioRsp_config->phoneCap.logicalModemIds[0];
res = radio_config->setPreferredDataModem(serial, modemId);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
ALOGI("setPreferredDataModem, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_config->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
}
/*
* Test IRadioConfig.setPreferredDataModem() with invalid arguments.
*/
TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) {
serial = GetRandomSerialNumber();
uint8_t modemId = -1;
ndk::ScopedAStatus res = radio_config->setPreferredDataModem(serial, modemId);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
ALOGI("setPreferredDataModem, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE,
RadioError::INTERNAL_ERR}));
}

View file

@ -36,8 +36,9 @@ ndk::ScopedAStatus RadioDataResponse::cancelHandoverResponse(const RadioResponse
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioDataResponse::deactivateDataCallResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioDataResponse::deactivateDataCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -61,11 +62,15 @@ ndk::ScopedAStatus RadioDataResponse::releasePduSessionIdResponse(const RadioRes
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioDataResponse::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioDataResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioDataResponse::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioDataResponse::setDataProfileResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -75,8 +80,9 @@ ndk::ScopedAStatus RadioDataResponse::setDataThrottlingResponse(const RadioRespo
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioDataResponse::setInitialAttachApnResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioDataResponse::setInitialAttachApnResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -94,11 +100,15 @@ ndk::ScopedAStatus RadioDataResponse::startHandoverResponse(const RadioResponseI
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioDataResponse::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioDataResponse::startKeepaliveResponse(const RadioResponseInfo& info,
const KeepaliveStatus& /*status*/) {
rspInfo = info;
parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioDataResponse::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioDataResponse::stopKeepaliveResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_data.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -309,3 +309,280 @@ TEST_P(RadioDataTest, setDataThrottling) {
sleep(1);
}
/*
* Test IRadioData.setInitialAttachApn() for the response returned.
*/
TEST_P(RadioDataTest, setInitialAttachApn) {
serial = GetRandomSerialNumber();
// Create a dataProfileInfo
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
dataProfileInfo.apn = std::string("internet");
dataProfileInfo.protocol = PdpProtocolType::IPV4V6;
dataProfileInfo.roamingProtocol = PdpProtocolType::IPV4V6;
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = std::string("username");
dataProfileInfo.password = std::string("password");
dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtuV4 = 0;
dataProfileInfo.mtuV6 = 0;
dataProfileInfo.preferred = true;
dataProfileInfo.persistent = false;
radio_data->setInitialAttachApn(serial, dataProfileInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
{RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
}
}
/*
* Test IRadioData.setDataProfile() for the response returned.
*/
TEST_P(RadioDataTest, setDataProfile) {
serial = GetRandomSerialNumber();
// Create a dataProfileInfo
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileInfo::ID_DEFAULT;
dataProfileInfo.apn = std::string("internet");
dataProfileInfo.protocol = PdpProtocolType::IPV4V6;
dataProfileInfo.roamingProtocol = PdpProtocolType::IPV4V6;
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = std::string("username");
dataProfileInfo.password = std::string("password");
dataProfileInfo.type = DataProfileInfo::TYPE_THREE_GPP;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtuV4 = 0;
dataProfileInfo.mtuV6 = 0;
dataProfileInfo.preferred = true;
dataProfileInfo.persistent = true;
// Create a dataProfileInfoList
std::vector<DataProfileInfo> dataProfileInfoList = {dataProfileInfo};
radio_data->setDataProfile(serial, dataProfileInfoList);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
{RadioError::SIM_ABSENT, RadioError::RADIO_NOT_AVAILABLE}));
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE}));
}
}
/*
* Test IRadioData.deactivateDataCall() for the response returned.
*/
TEST_P(RadioDataTest, deactivateDataCall) {
serial = GetRandomSerialNumber();
int cid = 1;
DataRequestReason reason = DataRequestReason::NORMAL;
ndk::ScopedAStatus res = radio_data->deactivateDataCall(serial, cid, reason);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
RadioError::INVALID_CALL_ID, RadioError::INVALID_STATE,
RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED,
RadioError::CANCELLED, RadioError::SIM_ABSENT}));
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_CALL_ID,
RadioError::INVALID_STATE, RadioError::INVALID_ARGUMENTS,
RadioError::REQUEST_NOT_SUPPORTED, RadioError::CANCELLED}));
}
}
/*
* Test IRadioData.startKeepalive() for the response returned.
*/
TEST_P(RadioDataTest, startKeepalive) {
std::vector<KeepaliveRequest> requests = {
{
// Invalid IPv4 source address
KeepaliveRequest::TYPE_NATT_IPV4,
{192, 168, 0 /*, 100*/},
1234,
{8, 8, 4, 4},
4500,
20000,
0xBAD,
},
{
// Invalid IPv4 destination address
KeepaliveRequest::TYPE_NATT_IPV4,
{192, 168, 0, 100},
1234,
{8, 8, 4, 4, 1, 2, 3, 4},
4500,
20000,
0xBAD,
},
{
// Invalid Keepalive Type
-1,
{192, 168, 0, 100},
1234,
{8, 8, 4, 4},
4500,
20000,
0xBAD,
},
{
// Invalid IPv6 source address
KeepaliveRequest::TYPE_NATT_IPV6,
{0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
0xED, 0xBE, 0xEF, 0xBD},
1234,
{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x88, 0x44},
4500,
20000,
0xBAD,
},
{
// Invalid IPv6 destination address
KeepaliveRequest::TYPE_NATT_IPV6,
{0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
0xED, 0xBE, 0xEF},
1234,
{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x88,
/*0x44*/},
4500,
20000,
0xBAD,
},
{
// Invalid Context ID (cid), this should survive the initial
// range checking and fail in the modem data layer
KeepaliveRequest::TYPE_NATT_IPV4,
{192, 168, 0, 100},
1234,
{8, 8, 4, 4},
4500,
20000,
0xBAD,
},
{
// Invalid Context ID (cid), this should survive the initial
// range checking and fail in the modem data layer
KeepaliveRequest::TYPE_NATT_IPV6,
{0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE,
0xED, 0xBE, 0xEF},
1234,
{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x88, 0x44},
4500,
20000,
0xBAD,
}};
for (auto req = requests.begin(); req != requests.end(); req++) {
serial = GetRandomSerialNumber();
radio_data->startKeepalive(serial, *req);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_ARGUMENTS,
RadioError::REQUEST_NOT_SUPPORTED}));
}
}
/*
* Test IRadioData.stopKeepalive() for the response returned.
*/
TEST_P(RadioDataTest, stopKeepalive) {
serial = GetRandomSerialNumber();
radio_data->stopKeepalive(serial, 0xBAD);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
}
/*
* Test IRadioData.getDataCallList() for the response returned.
*/
TEST_P(RadioDataTest, getDataCallList) {
LOG(DEBUG) << "getDataCallList";
serial = GetRandomSerialNumber();
radio_data->getDataCallList(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_data->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT}));
}
LOG(DEBUG) << "getDataCallList finished";
}
/*
* Test IRadioData.setDataAllowed() for the response returned.
*/
TEST_P(RadioDataTest, setDataAllowed) {
LOG(DEBUG) << "setDataAllowed";
serial = GetRandomSerialNumber();
bool allow = true;
radio_data->setDataAllowed(serial, allow);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_data->rspInfo.type);
EXPECT_EQ(serial, radioRsp_data->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_data->rspInfo.error);
}
LOG(DEBUG) << "setDataAllowed finished";
}

View file

@ -20,17 +20,23 @@ RadioMessagingResponse::RadioMessagingResponse(RadioServiceTest& parent)
: parent_messaging(parent) {}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeIncomingGsmSmsWithPduResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingCdmaSmsResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::acknowledgeLastIncomingGsmSmsResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -39,39 +45,49 @@ ndk::ScopedAStatus RadioMessagingResponse::acknowledgeRequest(int32_t /*serial*/
}
ndk::ScopedAStatus RadioMessagingResponse::cancelPendingUssdResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnRuimResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnRuimResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnSimResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioMessagingResponse::deleteSmsOnSimResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::getCdmaBroadcastConfigResponse(
const RadioResponseInfo& /*info*/,
const std::vector<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
const RadioResponseInfo& info, const std::vector<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::getGsmBroadcastConfigResponse(
const RadioResponseInfo& /*info*/,
const std::vector<GsmBroadcastSmsConfigInfo>& /*configs*/) {
const RadioResponseInfo& info, const std::vector<GsmBroadcastSmsConfigInfo>& /*configs*/) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::getSmscAddressResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioMessagingResponse::getSmscAddressResponse(const RadioResponseInfo& info,
const std::string& /*smsc*/) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::reportSmsMemoryStatusResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -91,8 +107,10 @@ ndk::ScopedAStatus RadioMessagingResponse::sendCdmaSmsResponse(const RadioRespon
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::sendImsSmsResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioMessagingResponse::sendImsSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& /*sms*/) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -112,41 +130,56 @@ ndk::ScopedAStatus RadioMessagingResponse::sendSmsResponse(const RadioResponseIn
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::sendUssdResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioMessagingResponse::sendUssdResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastActivationResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setCdmaBroadcastConfigResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastActivationResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setGsmBroadcastConfigResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::setSmscAddressResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioMessagingResponse::setSmscAddressResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioMessagingResponse::writeSmsToRuimResponse(const RadioResponseInfo& info,
int32_t /*index*/) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioMessagingResponse::writeSmsToSimResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioMessagingResponse::writeSmsToSimResponse(const RadioResponseInfo& info,
int32_t /*index*/) {
rspInfo = info;
parent_messaging.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -197,3 +197,574 @@ TEST_P(RadioMessagingTest, sendCdmaSmsExpectMore) {
CHECK_GENERAL_ERROR));
}
}
/*
* Test IRadioMessaging.setGsmBroadcastConfig() for the response returned.
*/
TEST_P(RadioMessagingTest, setGsmBroadcastConfig) {
LOG(DEBUG) << "setGsmBroadcastConfig";
serial = GetRandomSerialNumber();
// Create GsmBroadcastSmsConfigInfo #1
GsmBroadcastSmsConfigInfo gbSmsConfig1;
gbSmsConfig1.fromServiceId = 4352;
gbSmsConfig1.toServiceId = 4354;
gbSmsConfig1.fromCodeScheme = 0;
gbSmsConfig1.toCodeScheme = 255;
gbSmsConfig1.selected = true;
// Create GsmBroadcastSmsConfigInfo #2
GsmBroadcastSmsConfigInfo gbSmsConfig2;
gbSmsConfig2.fromServiceId = 4356;
gbSmsConfig2.toServiceId = 4356;
gbSmsConfig2.fromCodeScheme = 0;
gbSmsConfig2.toCodeScheme = 255;
gbSmsConfig2.selected = true;
// Create GsmBroadcastSmsConfigInfo #3
GsmBroadcastSmsConfigInfo gbSmsConfig3;
gbSmsConfig3.fromServiceId = 4370;
gbSmsConfig3.toServiceId = 4379;
gbSmsConfig3.fromCodeScheme = 0;
gbSmsConfig3.toCodeScheme = 255;
gbSmsConfig3.selected = true;
// Create GsmBroadcastSmsConfigInfo #4
GsmBroadcastSmsConfigInfo gbSmsConfig4;
gbSmsConfig4.fromServiceId = 4383;
gbSmsConfig4.toServiceId = 4391;
gbSmsConfig4.fromCodeScheme = 0;
gbSmsConfig4.toCodeScheme = 255;
gbSmsConfig4.selected = true;
// Create GsmBroadcastSmsConfigInfo #5
GsmBroadcastSmsConfigInfo gbSmsConfig5;
gbSmsConfig5.fromServiceId = 4392;
gbSmsConfig5.toServiceId = 4392;
gbSmsConfig5.fromCodeScheme = 0;
gbSmsConfig5.toCodeScheme = 255;
gbSmsConfig5.selected = true;
std::vector<GsmBroadcastSmsConfigInfo> gsmBroadcastSmsConfigsInfoList = {
gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
radio_messaging->setGsmBroadcastConfig(serial, gsmBroadcastSmsConfigsInfoList);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setGsmBroadcastConfig finished";
}
/*
* Test IRadioMessaging.getGsmBroadcastConfig() for the response returned.
*/
TEST_P(RadioMessagingTest, getGsmBroadcastConfig) {
LOG(DEBUG) << "getGsmBroadcastConfig";
serial = GetRandomSerialNumber();
radio_messaging->getGsmBroadcastConfig(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getGsmBroadcastConfig finished";
}
/*
* Test IRadioMessaging.setCdmaBroadcastConfig() for the response returned.
*/
TEST_P(RadioMessagingTest, setCdmaBroadcastConfig) {
LOG(DEBUG) << "setCdmaBroadcastConfig";
serial = GetRandomSerialNumber();
CdmaBroadcastSmsConfigInfo cbSmsConfig;
cbSmsConfig.serviceCategory = 4096;
cbSmsConfig.language = 1;
cbSmsConfig.selected = true;
std::vector<CdmaBroadcastSmsConfigInfo> cdmaBroadcastSmsConfigInfoList = {cbSmsConfig};
radio_messaging->setCdmaBroadcastConfig(serial, cdmaBroadcastSmsConfigInfoList);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_MODEM_STATE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setCdmaBroadcastConfig finished";
}
/*
* Test IRadioMessaging.getCdmaBroadcastConfig() for the response returned.
*/
TEST_P(RadioMessagingTest, getCdmaBroadcastConfig) {
LOG(DEBUG) << "getCdmaBroadcastConfig";
serial = GetRandomSerialNumber();
radio_messaging->getCdmaBroadcastConfig(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getCdmaBroadcastConfig finished";
}
/*
* Test IRadioMessaging.setCdmaBroadcastActivation() for the response returned.
*/
TEST_P(RadioMessagingTest, setCdmaBroadcastActivation) {
LOG(DEBUG) << "setCdmaBroadcastActivation";
serial = GetRandomSerialNumber();
bool activate = false;
radio_messaging->setCdmaBroadcastActivation(serial, activate);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setCdmaBroadcastActivation finished";
}
/*
* Test IRadioMessaging.setGsmBroadcastActivation() for the response returned.
*/
TEST_P(RadioMessagingTest, setGsmBroadcastActivation) {
LOG(DEBUG) << "setGsmBroadcastActivation";
serial = GetRandomSerialNumber();
bool activate = false;
radio_messaging->setGsmBroadcastActivation(serial, activate);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_MODEM_STATE,
RadioError::INVALID_STATE, RadioError::OPERATION_NOT_ALLOWED},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setGsmBroadcastActivation finished";
}
/*
* Test IRadioMessaging.acknowledgeLastIncomingGsmSms() for the response returned.
*/
TEST_P(RadioMessagingTest, acknowledgeLastIncomingGsmSms) {
LOG(DEBUG) << "acknowledgeLastIncomingGsmSms";
serial = GetRandomSerialNumber();
bool success = true;
radio_messaging->acknowledgeLastIncomingGsmSms(
serial, success, SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "acknowledgeLastIncomingGsmSms finished";
}
/*
* Test IRadioMessaging.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
*/
TEST_P(RadioMessagingTest, acknowledgeIncomingGsmSmsWithPdu) {
LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu";
serial = GetRandomSerialNumber();
bool success = true;
std::string ackPdu = "";
radio_messaging->acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
// TODO(shuoq): Will add error check when we know the expected error from QC
}
LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu finished";
}
/*
* Test IRadioMessaging.acknowledgeLastIncomingCdmaSms() for the response returned.
*/
TEST_P(RadioMessagingTest, acknowledgeLastIncomingCdmaSms) {
LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms";
serial = GetRandomSerialNumber();
// Create a CdmaSmsAck
CdmaSmsAck cdmaSmsAck;
cdmaSmsAck.errorClass = false;
cdmaSmsAck.smsCauseCode = 1;
radio_messaging->acknowledgeLastIncomingCdmaSms(serial, cdmaSmsAck);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::NO_SMS_TO_ACK},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms finished";
}
/*
* Test IRadioMessaging.sendImsSms() for the response returned.
*/
TEST_P(RadioMessagingTest, sendImsSms) {
LOG(DEBUG) << "sendImsSms";
serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
cdmaSmsAddress.isNumberModeDataNetwork = false;
cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Creata an ImsSmsMessage
ImsSmsMessage msg;
msg.tech = RadioTechnologyFamily::THREE_GPP2;
msg.retry = false;
msg.messageRef = 0;
msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
msg.gsmMessage = (std::vector<GsmSmsMessage>){};
radio_messaging->sendImsSms(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_ARGUMENTS}, CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendImsSms finished";
}
/*
* Test IRadioMessaging.getSmscAddress() for the response returned.
*/
TEST_P(RadioMessagingTest, getSmscAddress) {
LOG(DEBUG) << "getSmscAddress";
serial = GetRandomSerialNumber();
radio_messaging->getSmscAddress(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE,
RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getSmscAddress finished";
}
/*
* Test IRadioMessaging.setSmscAddress() for the response returned.
*/
TEST_P(RadioMessagingTest, setSmscAddress) {
LOG(DEBUG) << "setSmscAddress";
serial = GetRandomSerialNumber();
std::string address = std::string("smscAddress");
radio_messaging->setSmscAddress(serial, address);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_SMS_FORMAT,
RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setSmscAddress finished";
}
/*
* Test IRadioMessaging.writeSmsToSim() for the response returned.
*/
TEST_P(RadioMessagingTest, writeSmsToSim) {
LOG(DEBUG) << "writeSmsToSim";
serial = GetRandomSerialNumber();
SmsWriteArgs smsWriteArgs;
smsWriteArgs.status = SmsWriteArgs::STATUS_REC_UNREAD;
smsWriteArgs.smsc = "";
smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
radio_messaging->writeSmsToSim(serial, smsWriteArgs);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::ENCODING_ERR, RadioError::INVALID_ARGUMENTS,
RadioError::INVALID_SMSC_ADDRESS, RadioError::MODEM_ERR,
RadioError::NETWORK_NOT_READY, RadioError::NO_RESOURCES, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "writeSmsToSim finished";
}
/*
* Test IRadioMessaging.deleteSmsOnSim() for the response returned.
*/
TEST_P(RadioMessagingTest, deleteSmsOnSim) {
LOG(DEBUG) << "deleteSmsOnSim";
serial = GetRandomSerialNumber();
int index = 1;
radio_messaging->deleteSmsOnSim(serial, index);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::ENCODING_ERR, RadioError::INVALID_ARGUMENTS,
RadioError::INVALID_MODEM_STATE, RadioError::NO_SUCH_ENTRY, RadioError::MODEM_ERR,
RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "deleteSmsOnSim finished";
}
/*
* Test IRadioMessaging.writeSmsToRuim() for the response returned.
*/
TEST_P(RadioMessagingTest, writeSmsToRuim) {
LOG(DEBUG) << "writeSmsToRuim";
serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
cdmaSmsAddress.isNumberModeDataNetwork = false;
cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsWriteArgs
CdmaSmsWriteArgs cdmaSmsWriteArgs;
cdmaSmsWriteArgs.status = CdmaSmsWriteArgs::STATUS_REC_UNREAD;
cdmaSmsWriteArgs.message = cdmaSmsMessage;
radio_messaging->writeSmsToRuim(serial, cdmaSmsWriteArgs);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_SMS_FORMAT,
RadioError::INVALID_SMSC_ADDRESS, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "writeSmsToRuim finished";
}
/*
* Test IRadioMessaging.deleteSmsOnRuim() for the response returned.
*/
TEST_P(RadioMessagingTest, deleteSmsOnRuim) {
LOG(DEBUG) << "deleteSmsOnRuim";
serial = GetRandomSerialNumber();
int index = 1;
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsAddress::DIGIT_MODE_FOUR_BIT;
cdmaSmsAddress.isNumberModeDataNetwork = false;
cdmaSmsAddress.numberType = CdmaSmsAddress::NUMBER_TYPE_UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsAddress::NUMBER_PLAN_UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddress::SUBADDRESS_TYPE_NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsWriteArgs
CdmaSmsWriteArgs cdmaSmsWriteArgs;
cdmaSmsWriteArgs.status = CdmaSmsWriteArgs::STATUS_REC_UNREAD;
cdmaSmsWriteArgs.message = cdmaSmsMessage;
radio_messaging->deleteSmsOnRuim(serial, index);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_MODEM_STATE,
RadioError::MODEM_ERR, RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "deleteSmsOnRuim finished";
}
/*
* Test IRadioMessaging.reportSmsMemoryStatus() for the response returned.
*/
TEST_P(RadioMessagingTest, reportSmsMemoryStatus) {
LOG(DEBUG) << "reportSmsMemoryStatus";
serial = GetRandomSerialNumber();
bool available = true;
radio_messaging->reportSmsMemoryStatus(serial, available);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "reportSmsMemoryStatus finished";
}
/*
* Test IRadioMessaging.sendUssd() for the response returned.
*/
TEST_P(RadioMessagingTest, sendUssd) {
LOG(DEBUG) << "sendUssd";
serial = GetRandomSerialNumber();
radio_messaging->sendUssd(serial, std::string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendUssd finished";
}
/*
* Test IRadioMessaging.cancelPendingUssd() for the response returned.
*/
TEST_P(RadioMessagingTest, cancelPendingUssd) {
LOG(DEBUG) << "cancelPendingUssd";
serial = GetRandomSerialNumber();
radio_messaging->cancelPendingUssd(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_messaging->rspInfo.type);
EXPECT_EQ(serial, radioRsp_messaging->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_messaging->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "cancelPendingUssd finished";
}

View file

@ -22,70 +22,99 @@ ndk::ScopedAStatus RadioModemResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioModemResponse::getBasebandVersionResponse(const RadioResponseInfo& info,
const std::string& /*version*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResponseInfo& info,
const std::string& /*imei*/,
const std::string& /*imeisv*/,
const std::string& /*esn*/,
const std::string& /*meid*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse(
const RadioResponseInfo& /*info*/, const std::vector<HardwareConfig>& /*config*/) {
const RadioResponseInfo& info, const std::vector<HardwareConfig>& /*config*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getModemActivityInfoResponse(
const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(
const RadioResponseInfo& /*info*/, const bool /*enabled*/) {
ndk::ScopedAStatus RadioModemResponse::getModemStackStatusResponse(const RadioResponseInfo& info,
const bool enabled) {
rspInfo = info;
isModemEnabled = enabled;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioModemResponse::getRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& /*rc*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioModemResponse::nvReadItemResponse(const RadioResponseInfo& info,
const std::string& /*result*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioModemResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioModemResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioModemResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioModemResponse::requestShutdownResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioModemResponse::sendDeviceStateResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioModemResponse::setRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& /*rc*/) {
rspInfo = info;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -87,3 +87,301 @@ TEST_P(RadioModemTest, setRadioPower_emergencyCall_cancelled) {
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
}
/*
* Test IRadioModem.enableModem() for the response returned.
*/
TEST_P(RadioModemTest, enableModem) {
serial = GetRandomSerialNumber();
if (isSsSsEnabled()) {
ALOGI("enableModem, no need to test in single SIM mode");
return;
}
bool responseToggle = radioRsp_modem->enableModemResponseToggle;
ndk::ScopedAStatus res = radio_modem->enableModem(serial, true);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
ALOGI("getModemStackStatus, rspInfo.error = %s\n",
toString(radioRsp_modem->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
RadioError::MODEM_ERR, RadioError::INVALID_STATE}));
// checking if getModemStackStatus returns true, as modem was enabled above
if (RadioError::NONE == radioRsp_modem->rspInfo.error) {
// wait until modem enabling is finished
while (responseToggle == radioRsp_modem->enableModemResponseToggle) {
sleep(1);
}
ndk::ScopedAStatus resEnabled = radio_modem->getModemStackStatus(serial);
ASSERT_OK(resEnabled);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
ALOGI("getModemStackStatus, rspInfo.error = %s\n",
toString(radioRsp_modem->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE,
RadioError::MODEM_ERR, RadioError::INVALID_STATE}));
// verify that enableModem did set isEnabled correctly
EXPECT_EQ(true, radioRsp_modem->isModemEnabled);
}
}
/*
* Test IRadioModem.getModemStackStatus() for the response returned.
*/
TEST_P(RadioModemTest, getModemStackStatus) {
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_modem->getModemStackStatus(serial);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
ALOGI("getModemStackStatus, rspInfo.error = %s\n",
toString(radioRsp_modem->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
}
/*
* Test IRadioModem.getBasebandVersion() for the response returned.
*/
TEST_P(RadioModemTest, getBasebandVersion) {
LOG(DEBUG) << "getBasebandVersion";
serial = GetRandomSerialNumber();
radio_modem->getBasebandVersion(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
}
LOG(DEBUG) << "getBasebandVersion finished";
}
/*
* Test IRadioModem.getDeviceIdentity() for the response returned.
*/
TEST_P(RadioModemTest, getDeviceIdentity) {
LOG(DEBUG) << "getDeviceIdentity";
serial = GetRandomSerialNumber();
radio_modem->getDeviceIdentity(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::EMPTY_RECORD}));
}
LOG(DEBUG) << "getDeviceIdentity finished";
}
/*
* Test IRadioModem.nvReadItem() for the response returned.
*/
TEST_P(RadioModemTest, nvReadItem) {
LOG(DEBUG) << "nvReadItem";
serial = GetRandomSerialNumber();
radio_modem->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "nvReadItem finished";
}
/*
* Test IRadioModem.nvWriteItem() for the response returned.
*/
TEST_P(RadioModemTest, nvWriteItem) {
LOG(DEBUG) << "nvWriteItem";
serial = GetRandomSerialNumber();
NvWriteItem item;
memset(&item, 0, sizeof(item));
item.value = std::string();
radio_modem->nvWriteItem(serial, item);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "nvWriteItem finished";
}
/*
* Test IRadioModem.nvWriteCdmaPrl() for the response returned.
*/
TEST_P(RadioModemTest, nvWriteCdmaPrl) {
LOG(DEBUG) << "nvWriteCdmaPrl";
serial = GetRandomSerialNumber();
std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
radio_modem->nvWriteCdmaPrl(serial, std::vector<uint8_t>(prl));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "nvWriteCdmaPrl finished";
}
/*
* Test IRadioModem.nvResetConfig() for the response returned.
*/
TEST_P(RadioModemTest, nvResetConfig) {
LOG(DEBUG) << "nvResetConfig";
serial = GetRandomSerialNumber();
radio_modem->nvResetConfig(serial, ResetNvType::FACTORY_RESET);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
LOG(DEBUG) << "nvResetConfig finished";
}
/*
* Test IRadioModem.getHardwareConfig() for the response returned.
*/
TEST_P(RadioModemTest, getHardwareConfig) {
LOG(DEBUG) << "getHardwareConfig";
serial = GetRandomSerialNumber();
radio_modem->getHardwareConfig(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getHardwareConfig finished";
}
/*
* The following test is disabled due to b/64734869
*
* Test IRadioModem.requestShutdown() for the response returned.
*/
TEST_P(RadioModemTest, DISABLED_requestShutdown) {
serial = GetRandomSerialNumber();
radio_modem->requestShutdown(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
}
/*
* Test IRadioModem.getRadioCapability() for the response returned.
*/
TEST_P(RadioModemTest, getRadioCapability) {
LOG(DEBUG) << "getRadioCapability";
serial = GetRandomSerialNumber();
radio_modem->getRadioCapability(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
}
LOG(DEBUG) << "getRadioCapability finished";
}
/*
* Test IRadioModem.setRadioCapability() for the response returned.
*/
TEST_P(RadioModemTest, setRadioCapability) {
LOG(DEBUG) << "setRadioCapability";
serial = GetRandomSerialNumber();
RadioCapability rc;
memset(&rc, 0, sizeof(rc));
rc.logicalModemUuid = std::string();
radio_modem->setRadioCapability(serial, rc);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setRadioCapability finished";
}
/*
* Test IRadioModem.getModemActivityInfo() for the response returned.
*/
TEST_P(RadioModemTest, getModemActivityInfo) {
LOG(DEBUG) << "getModemActivityInfo";
serial = GetRandomSerialNumber();
radio_modem->getModemActivityInfo(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
LOG(DEBUG) << "getModemActivityInfo finished";
}
/*
* Test IRadioModem.sendDeviceState() for the response returned.
*/
TEST_P(RadioModemTest, sendDeviceState) {
LOG(DEBUG) << "sendDeviceState";
serial = GetRandomSerialNumber();
radio_modem->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type);
EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial);
std::cout << static_cast<int>(radioRsp_modem->rspInfo.error) << std::endl;
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
LOG(DEBUG) << "sendDeviceState finished";
}

View file

@ -31,7 +31,10 @@ ndk::ScopedAStatus RadioNetworkResponse::getAllowedNetworkTypesBitmapResponse(
}
ndk::ScopedAStatus RadioNetworkResponse::getAvailableBandModesResponse(
const RadioResponseInfo& /*info*/, const std::vector<RadioBandMode>& /*bandModes*/) {
const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) {
rspInfo = info;
radioBandModes = bandModes;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -44,48 +47,64 @@ ndk::ScopedAStatus RadioNetworkResponse::getAvailableNetworksResponse(
}
ndk::ScopedAStatus RadioNetworkResponse::getBarringInfoResponse(
const RadioResponseInfo& /*info*/, const CellIdentity& /*cellIdentity*/,
const std::vector<BarringInfo>& /*barringInfos*/) {
const RadioResponseInfo& info, const CellIdentity& cellIdentity,
const std::vector<BarringInfo>& barringInfos) {
rspInfo = info;
barringCellIdentity = cellIdentity;
barringInfoList = barringInfos;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getCdmaRoamingPreferenceResponse(
const RadioResponseInfo& /*info*/, CdmaRoamingType /*type*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
const RadioResponseInfo& /*info*/, const std::vector<CellInfo>& /*cellInfo*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
const RadioResponseInfo& info, const RegStateResult& /*regResponse*/) {
const RadioResponseInfo& info, CdmaRoamingType /*type*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getCellInfoListResponse(
const RadioResponseInfo& info, const std::vector<CellInfo>& /*cellInfo*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getDataRegistrationStateResponse(
const RadioResponseInfo& info, const RegStateResult& regResponse) {
rspInfo = info;
dataRegResp = regResponse;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getImsRegistrationStateResponse(
const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
RadioTechnologyFamily /*ratFamily*/) {
const RadioResponseInfo& info, bool /*isRegistered*/, RadioTechnologyFamily /*ratFamily*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getNetworkSelectionModeResponse(
const RadioResponseInfo& /*info*/, bool /*manual*/) {
const RadioResponseInfo& info, bool /*manual*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioNetworkResponse::getOperatorResponse(const RadioResponseInfo& info,
const std::string& /*longName*/,
const std::string& /*shortName*/,
const std::string& /*numeric*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getSignalStrengthResponse(
const RadioResponseInfo& /*info*/, const SignalStrength& /*sig_strength*/) {
const RadioResponseInfo& info, const SignalStrength& /*sig_strength*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -105,14 +124,16 @@ ndk::ScopedAStatus RadioNetworkResponse::getUsageSettingResponse(const RadioResp
}
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRadioTechnologyResponse(
const RadioResponseInfo& /*info*/, RadioTechnology /*rat*/) {
const RadioResponseInfo& info, RadioTechnology /*rat*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::getVoiceRegistrationStateResponse(
const RadioResponseInfo& info, const RegStateResult& regResponse) {
rspInfo = info;
voiceRegResp.regState = regResponse.regState;
voiceRegResp = regResponse;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -132,47 +153,63 @@ ndk::ScopedAStatus RadioNetworkResponse::setAllowedNetworkTypesBitmapResponse(
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioNetworkResponse::setBandModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioNetworkResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setCdmaRoamingPreferenceResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setCellInfoListRateResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setIndicationFilterResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setLinkCapacityReportingCriteriaResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioNetworkResponse::setLocationUpdatesResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeAutomaticResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setNetworkSelectionModeManualResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -184,17 +221,23 @@ ndk::ScopedAStatus RadioNetworkResponse::setNrDualConnectivityStateResponse(
}
ndk::ScopedAStatus RadioNetworkResponse::setSignalStrengthReportingCriteriaResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setSuppServiceNotificationsResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::setSystemSelectionChannelsResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -204,17 +247,21 @@ ndk::ScopedAStatus RadioNetworkResponse::setUsageSettingResponse(const RadioResp
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioNetworkResponse::startNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioNetworkResponse::stopNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse(
const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
rspInfo = info;
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

File diff suppressed because it is too large Load diff

View file

@ -41,8 +41,9 @@ class RadioNetworkResponse : public BnRadioNetworkResponse {
bool isNrDualConnectivityEnabled;
int networkTypeBitmapResponse;
RegStateResult voiceRegResp;
RegStateResult dataRegResp;
CellIdentity barringCellIdentity;
std::vector<BarringInfo> barringInfos;
std::vector<BarringInfo> barringInfoList;
UsageSetting usageSetting;
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
@ -218,4 +219,6 @@ class RadioNetworkTest : public ::testing::TestWithParam<std::string>, public Ra
// Helper function to reduce copy+paste
void testSetUsageSetting_InvalidValues(std::vector<RadioError> errors);
void stopNetworkScan();
};

View file

@ -23,44 +23,62 @@ ndk::ScopedAStatus RadioSimResponse::acknowledgeRequest(int32_t /*serial*/) {
}
ndk::ScopedAStatus RadioSimResponse::areUiccApplicationsEnabledResponse(
const RadioResponseInfo& /*info*/, bool /*enabled*/) {
const RadioResponseInfo& info, bool enabled) {
rspInfo = info;
areUiccApplicationsEnabled = enabled;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::changeIccPinForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioSimResponse::enableUiccApplicationsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getAllowedCarriersResponse(
const RadioResponseInfo& /*info*/, const CarrierRestrictions& /*carriers*/,
SimLockMultiSimPolicy /*multiSimPolicy*/) {
const RadioResponseInfo& info, const CarrierRestrictions& carriers,
SimLockMultiSimPolicy multiSimPolicy) {
rspInfo = info;
carrierRestrictionsResp = carriers;
multiSimPolicyResp = multiSimPolicy;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionResponse(
const RadioResponseInfo& /*info*/, const std::string& /*mdn*/, const std::string& /*hSid*/,
const RadioResponseInfo& info, const std::string& /*mdn*/, const std::string& /*hSid*/,
const std::string& /*hNid*/, const std::string& /*min*/, const std::string& /*prl*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getCdmaSubscriptionSourceResponse(
const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(
const RadioResponseInfo& /*info*/, int32_t /*response*/) {
ndk::ScopedAStatus RadioSimResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t /*response*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -72,8 +90,11 @@ ndk::ScopedAStatus RadioSimResponse::getIccCardStatusResponse(const RadioRespons
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& /*info*/,
const std::string& /*imsi*/) {
ndk::ScopedAStatus RadioSimResponse::getImsiForAppResponse(const RadioResponseInfo& info,
const std::string& imsi_str) {
rspInfo = info;
imsi = imsi_str;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -91,58 +112,79 @@ ndk::ScopedAStatus RadioSimResponse::getSimPhonebookRecordsResponse(const RadioR
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& info,
const IccIoResult& /*iccIo*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccOpenLogicalChannelResponse(
const RadioResponseInfo& /*info*/, int32_t /*channelId*/,
const RadioResponseInfo& info, int32_t /*channelId*/,
const std::vector<uint8_t>& /*selectResponse*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccTransmitApduBasicChannelResponse(
const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
const RadioResponseInfo& info, const IccIoResult& /*result*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::iccTransmitApduLogicalChannelResponse(
const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
const RadioResponseInfo& info, const IccIoResult& /*result*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::reportStkServiceIsRunningResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::requestIccSimAuthenticationResponse(
const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) {
const RadioResponseInfo& info, const IccIoResult& /*result*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
const std::string& /*commandResponse*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(
const RadioResponseInfo& /*info*/, const IccIoResult& /*iccIo*/) {
ndk::ScopedAStatus RadioSimResponse::sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
const IccIoResult& /*iccIo*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::sendTerminalResponseToSimResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioSimResponse::setAllowedCarriersResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -154,12 +196,16 @@ ndk::ScopedAStatus RadioSimResponse::setCarrierInfoForImsiEncryptionResponse(
}
ndk::ScopedAStatus RadioSimResponse::setCdmaSubscriptionSourceResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(
const RadioResponseInfo& /*info*/, int32_t /*retry*/) {
ndk::ScopedAStatus RadioSimResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t /*retry*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -169,34 +215,44 @@ ndk::ScopedAStatus RadioSimResponse::setSimCardPowerResponse(const RadioResponse
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioSimResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::supplyIccPinForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioSimResponse::supplyIccPukForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioSimResponse::supplySimDepersonalizationResponse(
const RadioResponseInfo& /*info*/, PersoSubstate /*persoType*/,
int32_t /*remainingRetries*/) {
const RadioResponseInfo& info, PersoSubstate /*persoType*/, int32_t /*remainingRetries*/) {
rspInfo = info;
parent_sim.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <aidl/android/hardware/radio/RadioConst.h>
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
@ -260,3 +261,771 @@ TEST_P(RadioSimTest, updateSimPhonebookRecords) {
}
}
}
/*
* Test IRadioSim.enableUiccApplications() for the response returned.
* For SIM ABSENT case.
*/
TEST_P(RadioSimTest, togglingUiccApplicationsSimAbsent) {
// This test case only test SIM ABSENT case.
if (cardStatus.cardState != CardStatus::STATE_ABSENT) return;
// Disable Uicc applications.
serial = GetRandomSerialNumber();
radio_sim->enableUiccApplications(serial, false);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// As SIM is absent, RadioError::SIM_ABSENT should be thrown.
EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_sim->rspInfo.error);
// Query Uicc application enablement.
serial = GetRandomSerialNumber();
radio_sim->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// As SIM is absent, RadioError::SIM_ABSENT should be thrown.
EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_sim->rspInfo.error);
}
/*
* Test IRadioSim.enableUiccApplications() for the response returned.
* For SIM PRESENT case.
*/
TEST_P(RadioSimTest, togglingUiccApplicationsSimPresent) {
// This test case only test SIM ABSENT case.
if (cardStatus.cardState != CardStatus::STATE_PRESENT) return;
if (cardStatus.applications.size() == 0) return;
// Disable Uicc applications.
serial = GetRandomSerialNumber();
radio_sim->enableUiccApplications(serial, false);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
// Query Uicc application enablement.
serial = GetRandomSerialNumber();
radio_sim->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
ASSERT_FALSE(radioRsp_sim->areUiccApplicationsEnabled);
// Enable Uicc applications.
serial = GetRandomSerialNumber();
radio_sim->enableUiccApplications(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
// Query Uicc application enablement.
serial = GetRandomSerialNumber();
radio_sim->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
ASSERT_TRUE(radioRsp_sim->areUiccApplicationsEnabled);
}
/*
* Test IRadioSim.areUiccApplicationsEnabled() for the response returned.
*/
TEST_P(RadioSimTest, areUiccApplicationsEnabled) {
// Disable Uicc applications.
serial = GetRandomSerialNumber();
radio_sim->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// If SIM is absent, RadioError::SIM_ABSENT should be thrown. Otherwise there shouldn't be any
// error.
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_sim->rspInfo.error);
} else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
}
}
/*
* Test IRadioSim.getAllowedCarriers() for the response returned.
*/
TEST_P(RadioSimTest, getAllowedCarriers) {
serial = GetRandomSerialNumber();
radio_sim->getAllowedCarriers(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
/**
* Test IRadioSim.setAllowedCarriers() for the response returned.
*/
TEST_P(RadioSimTest, setAllowedCarriers) {
// TODO (b/210712359): remove once shim supports 1.4 or alternative is found
GTEST_SKIP();
serial = GetRandomSerialNumber();
CarrierRestrictions carrierRestrictions;
memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
carrierRestrictions.allowedCarriers.resize(1);
carrierRestrictions.excludedCarriers.resize(0);
carrierRestrictions.allowedCarriers[0].mcc = std::string("123");
carrierRestrictions.allowedCarriers[0].mnc = std::string("456");
carrierRestrictions.allowedCarriers[0].matchType = Carrier::MATCH_TYPE_ALL;
carrierRestrictions.allowedCarriers[0].matchData = std::string();
carrierRestrictions.priority = true;
carrierRestrictions.allowedCarriersPrioritized = true;
SimLockMultiSimPolicy multisimPolicy = SimLockMultiSimPolicy::NO_MULTISIM_POLICY;
radio_sim->setAllowedCarriers(serial, carrierRestrictions, multisimPolicy);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
/* Verify the update of the SIM status. This might need some time */
if (cardStatus.cardState != CardStatus::STATE_ABSENT) {
updateSimCardStatus();
auto startTime = std::chrono::system_clock::now();
while (cardStatus.cardState != CardStatus::STATE_RESTRICTED &&
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now() - startTime)
.count() < 30) {
/* Set 2 seconds as interval to check card status */
sleep(2);
updateSimCardStatus();
}
EXPECT_EQ(CardStatus::STATE_RESTRICTED, cardStatus.cardState);
}
/* Verify that configuration was set correctly, retrieving it from the modem */
serial = GetRandomSerialNumber();
radio_sim->getAllowedCarriers(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
EXPECT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarriers.size());
EXPECT_EQ(0, radioRsp_sim->carrierRestrictionsResp.excludedCarriers.size());
ASSERT_TRUE(std::string("123") ==
radioRsp_sim->carrierRestrictionsResp.allowedCarriers[0].mcc);
ASSERT_TRUE(std::string("456") ==
radioRsp_sim->carrierRestrictionsResp.allowedCarriers[0].mnc);
EXPECT_EQ(Carrier::MATCH_TYPE_ALL,
radioRsp_sim->carrierRestrictionsResp.allowedCarriers[0].matchType);
ASSERT_TRUE(radioRsp_sim->carrierRestrictionsResp.allowedCarriersPrioritized);
EXPECT_EQ(SimLockMultiSimPolicy::NO_MULTISIM_POLICY, radioRsp_sim->multiSimPolicyResp);
sleep(10);
/**
* Another test case of the API to cover to allow carrier.
* If the API is supported, this is also used to reset to no carrier restriction
* status for cardStatus.
*/
memset(&carrierRestrictions, 0, sizeof(carrierRestrictions));
carrierRestrictions.allowedCarriers.resize(0);
carrierRestrictions.excludedCarriers.resize(0);
carrierRestrictions.allowedCarriersPrioritized = false;
serial = GetRandomSerialNumber();
radio_sim->setAllowedCarriers(serial, carrierRestrictions, multisimPolicy);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
if (cardStatus.cardState != CardStatus::STATE_ABSENT) {
/* Resetting back to no carrier restriction needs some time */
updateSimCardStatus();
auto startTime = std::chrono::system_clock::now();
while (cardStatus.cardState == CardStatus::STATE_RESTRICTED &&
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now() - startTime)
.count() < 10) {
/* Set 2 seconds as interval to check card status */
sleep(2);
updateSimCardStatus();
}
EXPECT_NE(CardStatus::STATE_RESTRICTED, cardStatus.cardState);
sleep(10);
}
}
}
/*
* Test IRadioSim.getIccCardStatus() for the response returned.
*/
TEST_P(RadioSimTest, getIccCardStatus) {
LOG(DEBUG) << "getIccCardStatus";
EXPECT_LE(cardStatus.applications.size(), RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.imsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS);
LOG(DEBUG) << "getIccCardStatus finished";
}
/*
* Test IRadioSim.supplyIccPinForApp() for the response returned
*/
TEST_P(RadioSimTest, supplyIccPinForApp) {
LOG(DEBUG) << "supplyIccPinForApp";
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->supplyIccPinForApp(serial, std::string("test1"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED}));
}
}
LOG(DEBUG) << "supplyIccPinForApp finished";
}
/*
* Test IRadioSim.supplyIccPukForApp() for the response returned.
*/
TEST_P(RadioSimTest, supplyIccPukForApp) {
LOG(DEBUG) << "supplyIccPukForApp";
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->supplyIccPukForApp(serial, std::string("test1"), std::string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::PASSWORD_INCORRECT, RadioError::INVALID_SIM_STATE}));
}
}
LOG(DEBUG) << "supplyIccPukForApp finished";
}
/*
* Test IRadioSim.supplyIccPin2ForApp() for the response returned.
*/
TEST_P(RadioSimTest, supplyIccPin2ForApp) {
LOG(DEBUG) << "supplyIccPin2ForApp";
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->supplyIccPin2ForApp(serial, std::string("test1"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::PASSWORD_INCORRECT,
RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_PUK2}));
}
}
LOG(DEBUG) << "supplyIccPin2ForApp finished";
}
/*
* Test IRadioSim.supplyIccPuk2ForApp() for the response returned.
*/
TEST_P(RadioSimTest, supplyIccPuk2ForApp) {
LOG(DEBUG) << "supplyIccPuk2ForApp";
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->supplyIccPuk2ForApp(serial, std::string("test1"), std::string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::PASSWORD_INCORRECT, RadioError::INVALID_SIM_STATE}));
}
}
LOG(DEBUG) << "supplyIccPuk2ForApp finished";
}
/*
* Test IRadioSim.changeIccPinForApp() for the response returned.
*/
TEST_P(RadioSimTest, changeIccPinForApp) {
LOG(DEBUG) << "changeIccPinForApp";
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->changeIccPinForApp(serial, std::string("test1"), std::string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED}));
}
}
LOG(DEBUG) << "changeIccPinForApp finished";
}
/*
* Test IRadioSim.changeIccPin2ForApp() for the response returned.
*/
TEST_P(RadioSimTest, changeIccPin2ForApp) {
LOG(DEBUG) << "changeIccPin2ForApp";
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->changeIccPin2ForApp(serial, std::string("test1"), std::string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::PASSWORD_INCORRECT,
RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_PUK2}));
}
}
LOG(DEBUG) << "changeIccPin2ForApp finished";
}
/*
* The following test is disabled due to b/109889468
*
* Test IRadioSim.getImsiForApp() for the response returned.
*/
TEST_P(RadioSimTest, DISABLED_getImsiForApp) {
LOG(DEBUG) << "DISABLED_getImsiForApp";
serial = GetRandomSerialNumber();
// Check success returned while getting imsi for 3GPP and 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppStatus::APP_TYPE_SIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_USIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_RUIM ||
cardStatus.applications[i].appType == AppStatus::APP_TYPE_CSIM) {
radio_sim->getImsiForApp(serial, cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
// IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
if (radioRsp_sim->rspInfo.error == RadioError::NONE) {
EXPECT_NE(radioRsp_sim->imsi, std::string());
EXPECT_GE((int)(radioRsp_sim->imsi).size(), 6);
EXPECT_LE((int)(radioRsp_sim->imsi).size(), 15);
}
}
}
LOG(DEBUG) << "DISABLED_getImsiForApp finished";
}
/*
* Test IRadioSim.iccIoForApp() for the response returned.
*/
TEST_P(RadioSimTest, iccIoForApp) {
LOG(DEBUG) << "iccIoForApp";
serial = GetRandomSerialNumber();
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
IccIo iccIo;
iccIo.command = 0xc0;
iccIo.fileId = 0x6f11;
iccIo.path = std::string("3F007FFF");
iccIo.p1 = 0;
iccIo.p2 = 0;
iccIo.p3 = 0;
iccIo.data = std::string();
iccIo.pin2 = std::string();
iccIo.aid = cardStatus.applications[i].aidPtr;
radio_sim->iccIoForApp(serial, iccIo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
}
LOG(DEBUG) << "iccIoForApp finished";
}
/*
* Test IRadioSim.iccTransmitApduBasicChannel() for the response returned.
*/
TEST_P(RadioSimTest, iccTransmitApduBasicChannel) {
LOG(DEBUG) << "iccTransmitApduBasicChannel";
serial = GetRandomSerialNumber();
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = std::string();
radio_sim->iccTransmitApduBasicChannel(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// TODO(sanketpadawe): Add test for error code
LOG(DEBUG) << "iccTransmitApduBasicChannel finished";
}
/*
* Test IRadioSim.iccOpenLogicalChannel() for the response returned.
*/
TEST_P(RadioSimTest, iccOpenLogicalChannel) {
LOG(DEBUG) << "iccOpenLogicalChannel";
serial = GetRandomSerialNumber();
int p2 = 0x04;
// Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio_sim->iccOpenLogicalChannel(serial, cardStatus.applications[i].aidPtr, p2);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
}
LOG(DEBUG) << "iccOpenLogicalChannel finished";
}
/*
* Test IRadioSim.iccCloseLogicalChannel() for the response returned.
*/
TEST_P(RadioSimTest, iccCloseLogicalChannel) {
LOG(DEBUG) << "iccCloseLogicalChannel";
serial = GetRandomSerialNumber();
// Try closing invalid channel and check INVALID_ARGUMENTS returned as error
radio_sim->iccCloseLogicalChannel(serial, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp_sim->rspInfo.error);
LOG(DEBUG) << "iccCloseLogicalChannel finished";
}
/*
* Test IRadioSim.iccTransmitApduLogicalChannel() for the response returned.
*/
TEST_P(RadioSimTest, iccTransmitApduLogicalChannel) {
LOG(DEBUG) << "iccTransmitApduLogicalChannel";
serial = GetRandomSerialNumber();
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = std::string();
radio_sim->iccTransmitApduLogicalChannel(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
// TODO(sanketpadawe): Add test for error code
LOG(DEBUG) << "iccTransmitApduLogicalChannel finished";
}
/*
* Test IRadioSim.requestIccSimAuthentication() for the response returned.
*/
TEST_P(RadioSimTest, requestIccSimAuthentication) {
LOG(DEBUG) << "requestIccSimAuthentication";
serial = GetRandomSerialNumber();
// Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
// or REQUEST_NOT_SUPPORTED returned as error.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio_sim->requestIccSimAuthentication(serial, 0, std::string("test"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
}
LOG(DEBUG) << "requestIccSimAuthentication finished";
}
/*
* Test IRadioSim.getFacilityLockForApp() for the response returned.
*/
TEST_P(RadioSimTest, getFacilityLockForApp) {
serial = GetRandomSerialNumber();
std::string facility = "";
std::string password = "";
int32_t serviceClass = 1;
std::string appId = "";
radio_sim->getFacilityLockForApp(serial, facility, password, serviceClass, appId);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
}
/*
* Test IRadioSim.setFacilityLockForApp() for the response returned.
*/
TEST_P(RadioSimTest, setFacilityLockForApp) {
serial = GetRandomSerialNumber();
std::string facility = "";
bool lockState = false;
std::string password = "";
int32_t serviceClass = 1;
std::string appId = "";
radio_sim->setFacilityLockForApp(serial, facility, lockState, password, serviceClass, appId);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
}
/*
* Test IRadioSim.getCdmaSubscription() for the response returned.
*/
TEST_P(RadioSimTest, getCdmaSubscription) {
LOG(DEBUG) << "getCdmaSubscription";
serial = GetRandomSerialNumber();
radio_sim->getCdmaSubscription(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
}
LOG(DEBUG) << "getCdmaSubscription finished";
}
/*
* Test IRadioSim.getCdmaSubscriptionSource() for the response returned.
*/
TEST_P(RadioSimTest, getCdmaSubscriptionSource) {
LOG(DEBUG) << "getCdmaSubscriptionSource";
serial = GetRandomSerialNumber();
radio_sim->getCdmaSubscriptionSource(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
}
LOG(DEBUG) << "getCdmaSubscriptionSource finished";
}
/*
* Test IRadioSim.setCdmaSubscriptionSource() for the response returned.
*/
TEST_P(RadioSimTest, setCdmaSubscriptionSource) {
LOG(DEBUG) << "setCdmaSubscriptionSource";
serial = GetRandomSerialNumber();
radio_sim->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::SIM_ABSENT, RadioError::SUBSCRIPTION_NOT_AVAILABLE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setCdmaSubscriptionSource finished";
}
/*
* Test IRadioSim.setUiccSubscription() for the response returned.
*/
TEST_P(RadioSimTest, setUiccSubscription) {
LOG(DEBUG) << "setUiccSubscription";
serial = GetRandomSerialNumber();
SelectUiccSub item;
memset(&item, 0, sizeof(item));
radio_sim->setUiccSubscription(serial, item);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
RadioError::MODEM_ERR, RadioError::SUBSCRIPTION_NOT_SUPPORTED},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setUiccSubscription finished";
}
/*
* Test IRadioSim.sendEnvelope() for the response returned.
*/
TEST_P(RadioSimTest, sendEnvelope) {
LOG(DEBUG) << "sendEnvelope";
serial = GetRandomSerialNumber();
// Test with sending empty string
std::string content = "";
radio_sim->sendEnvelope(serial, content);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendEnvelope finished";
}
/*
* Test IRadioSim.sendTerminalResponseToSim() for the response returned.
*/
TEST_P(RadioSimTest, sendTerminalResponseToSim) {
LOG(DEBUG) << "sendTerminalResponseToSim";
serial = GetRandomSerialNumber();
// Test with sending empty string
std::string commandResponse = "";
radio_sim->sendTerminalResponseToSim(serial, commandResponse);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendTerminalResponseToSim finished";
}
/*
* Test IRadioSim.reportStkServiceIsRunning() for the response returned.
*/
TEST_P(RadioSimTest, reportStkServiceIsRunning) {
LOG(DEBUG) << "reportStkServiceIsRunning";
serial = GetRandomSerialNumber();
radio_sim->reportStkServiceIsRunning(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "reportStkServiceIsRunning finished";
}
/*
* Test IRadioSim.sendEnvelopeWithStatus() for the response returned with empty
* string.
*/
TEST_P(RadioSimTest, sendEnvelopeWithStatus) {
LOG(DEBUG) << "sendEnvelopeWithStatus";
serial = GetRandomSerialNumber();
// Test with sending empty string
std::string contents = "";
radio_sim->sendEnvelopeWithStatus(serial, contents);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type);
EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_sim->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendEnvelopeWithStatus finished";
}

View file

@ -42,6 +42,7 @@ class RadioSimResponse : public BnRadioSimResponse {
bool areUiccApplicationsEnabled;
PhonebookCapacity capacity;
int32_t updatedRecordIndex;
std::string imsi;
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;

View file

@ -18,7 +18,9 @@
RadioVoiceResponse::RadioVoiceResponse(RadioServiceTest& parent) : parent_voice(parent) {}
ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::acceptCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -26,11 +28,15 @@ ndk::ScopedAStatus RadioVoiceResponse::acknowledgeRequest(int32_t /*serial*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::conferenceResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::dialResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -41,34 +47,44 @@ ndk::ScopedAStatus RadioVoiceResponse::emergencyDialResponse(const RadioResponse
}
ndk::ScopedAStatus RadioVoiceResponse::exitEmergencyCallbackModeResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::explicitCallTransferResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getCallForwardStatusResponse(
const RadioResponseInfo& /*info*/,
const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
const RadioResponseInfo& info, const std::vector<CallForwardInfo>& /*callForwardInfos*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioVoiceResponse::getCallWaitingResponse(const RadioResponseInfo& info,
bool /*enable*/,
int32_t /*serviceClass*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioVoiceResponse::getClipResponse(const RadioResponseInfo& info,
ClipStatus /*status*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& /*info*/,
int32_t /*n*/, int32_t /*m*/) {
ndk::ScopedAStatus RadioVoiceResponse::getClirResponse(const RadioResponseInfo& info, int32_t /*n*/,
int32_t /*m*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -81,27 +97,37 @@ ndk::ScopedAStatus RadioVoiceResponse::getCurrentCallsResponse(const RadioRespon
}
ndk::ScopedAStatus RadioVoiceResponse::getLastCallFailCauseResponse(
const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) {
const RadioResponseInfo& info, const LastCallFailCauseInfo& /*failCauseInfo*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioVoiceResponse::getMuteResponse(const RadioResponseInfo& info,
bool /*enable*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getPreferredVoicePrivacyResponse(
const RadioResponseInfo& /*info*/, bool /*enable*/) {
const RadioResponseInfo& info, bool /*enable*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioVoiceResponse::getTtyModeResponse(const RadioResponseInfo& info,
TtyMode /*mode*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::handleStkCallSetupRequestFromSimResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
@ -112,80 +138,114 @@ ndk::ScopedAStatus RadioVoiceResponse::hangupConnectionResponse(const RadioRespo
}
ndk::ScopedAStatus RadioVoiceResponse::hangupForegroundResumeBackgroundResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::hangupWaitingOrBackgroundResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& /*info*/,
ndk::ScopedAStatus RadioVoiceResponse::isVoNrEnabledResponse(const RadioResponseInfo& info,
bool /*enabled*/) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::rejectCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::sendBurstDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::sendCdmaFeatureCodeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::sendDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(
const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::separateConnectionResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::setCallForwardResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::setCallWaitingResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::setClirResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::setMuteResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setPreferredVoicePrivacyResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::setTtyModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::setVoNrEnabledResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::startDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& /*info*/) {
ndk::ScopedAStatus RadioVoiceResponse::stopDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus RadioVoiceResponse::switchWaitingOrHoldingAndActiveResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent_voice.notify(info.serial);
return ndk::ScopedAStatus::ok();
}

View file

@ -265,3 +265,640 @@ TEST_P(RadioVoiceTest, getCurrentCalls) {
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
}
/*
* Test IRadioVoice.getClir() for the response returned.
*/
TEST_P(RadioVoiceTest, getClir) {
serial = GetRandomSerialNumber();
radio_voice->getClir(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
}
/*
* Test IRadioVoice.setClir() for the response returned.
*/
TEST_P(RadioVoiceTest, setClir) {
serial = GetRandomSerialNumber();
int32_t status = 1;
radio_voice->setClir(serial, status);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
}
}
/*
* Test IRadioVoice.getClip() for the response returned.
*/
TEST_P(RadioVoiceTest, getClip) {
serial = GetRandomSerialNumber();
radio_voice->getClip(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
}
/*
* Test IRadioVoice.getTtyMode() for the response returned.
*/
TEST_P(RadioVoiceTest, getTtyMode) {
LOG(DEBUG) << "getTTYMode";
serial = GetRandomSerialNumber();
radio_voice->getTtyMode(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
}
LOG(DEBUG) << "getTTYMode finished";
}
/*
* Test IRadioVoice.setTtyMode() for the response returned.
*/
TEST_P(RadioVoiceTest, setTtyMode) {
LOG(DEBUG) << "setTtyMode";
serial = GetRandomSerialNumber();
radio_voice->setTtyMode(serial, TtyMode::OFF);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
}
LOG(DEBUG) << "setTtyMode finished";
}
/*
* Test IRadioVoice.setPreferredVoicePrivacy() for the response returned.
*/
TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) {
LOG(DEBUG) << "setPreferredVoicePrivacy";
serial = GetRandomSerialNumber();
radio_voice->setPreferredVoicePrivacy(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
LOG(DEBUG) << "setPreferredVoicePrivacy finished";
}
/*
* Test IRadioVoice.getPreferredVoicePrivacy() for the response returned.
*/
TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) {
LOG(DEBUG) << "getPreferredVoicePrivacy";
serial = GetRandomSerialNumber();
radio_voice->getPreferredVoicePrivacy(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
LOG(DEBUG) << "getPreferredVoicePrivacy finished";
}
/*
* Test IRadioVoice.exitEmergencyCallbackMode() for the response returned.
*/
TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) {
LOG(DEBUG) << "exitEmergencyCallbackMode";
serial = GetRandomSerialNumber();
radio_voice->exitEmergencyCallbackMode(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
}
LOG(DEBUG) << "exitEmergencyCallbackMode finished";
}
/*
* Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned.
*/
TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) {
LOG(DEBUG) << "handleStkCallSetupRequestFromSim";
serial = GetRandomSerialNumber();
bool accept = false;
radio_voice->handleStkCallSetupRequestFromSim(serial, accept);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "handleStkCallSetupRequestFromSim finished";
}
/*
* Test IRadioVoice.dial() for the response returned.
*/
TEST_P(RadioVoiceTest, dial) {
LOG(DEBUG) << "dial";
serial = GetRandomSerialNumber();
Dial dialInfo;
memset(&dialInfo, 0, sizeof(dialInfo));
dialInfo.address = std::string("123456789");
radio_voice->dial(serial, dialInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::CANCELLED, RadioError::DEVICE_IN_USE, RadioError::FDN_CHECK_FAILURE,
RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
RadioError::NO_NETWORK_FOUND, RadioError::NO_SUBSCRIPTION,
RadioError::OPERATION_NOT_ALLOWED},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "dial finished";
}
/*
* Test IRadioVoice.hangup() for the response returned.
*/
TEST_P(RadioVoiceTest, hangup) {
LOG(DEBUG) << "hangup";
serial = GetRandomSerialNumber();
radio_voice->hangup(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "hangup finished";
}
/*
* Test IRadioVoice.hangupWaitingOrBackground() for the response returned.
*/
TEST_P(RadioVoiceTest, hangupWaitingOrBackground) {
LOG(DEBUG) << "hangupWaitingOrBackground";
serial = GetRandomSerialNumber();
radio_voice->hangupWaitingOrBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "hangupWaitingOrBackground finished";
}
/*
* Test IRadioVoice.hangupForegroundResumeBackground() for the response returned.
*/
TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) {
LOG(DEBUG) << "hangupForegroundResumeBackground";
serial = GetRandomSerialNumber();
radio_voice->hangupForegroundResumeBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "hangupForegroundResumeBackground finished";
}
/*
* Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned.
*/
TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) {
LOG(DEBUG) << "switchWaitingOrHoldingAndActive";
serial = GetRandomSerialNumber();
radio_voice->switchWaitingOrHoldingAndActive(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "switchWaitingOrHoldingAndActive finished";
}
/*
* Test IRadioVoice.conference() for the response returned.
*/
TEST_P(RadioVoiceTest, conference) {
LOG(DEBUG) << "conference";
serial = GetRandomSerialNumber();
radio_voice->conference(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "conference finished";
}
/*
* Test IRadioVoice.rejectCall() for the response returned.
*/
TEST_P(RadioVoiceTest, rejectCall) {
LOG(DEBUG) << "rejectCall";
serial = GetRandomSerialNumber();
radio_voice->rejectCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "rejectCall finished";
}
/*
* Test IRadioVoice.getLastCallFailCause() for the response returned.
*/
TEST_P(RadioVoiceTest, getLastCallFailCause) {
LOG(DEBUG) << "getLastCallFailCause";
serial = GetRandomSerialNumber();
radio_voice->getLastCallFailCause(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getLastCallFailCause finished";
}
/*
* Test IRadioVoice.getCallForwardStatus() for the response returned.
*/
TEST_P(RadioVoiceTest, getCallForwardStatus) {
LOG(DEBUG) << "getCallForwardStatus";
serial = GetRandomSerialNumber();
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = std::string();
radio_voice->getCallForwardStatus(serial, callInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getCallForwardStatus finished";
}
/*
* Test IRadioVoice.setCallForward() for the response returned.
*/
TEST_P(RadioVoiceTest, setCallForward) {
LOG(DEBUG) << "setCallForward";
serial = GetRandomSerialNumber();
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = std::string();
radio_voice->setCallForward(serial, callInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setCallForward finished";
}
/*
* Test IRadioVoice.getCallWaiting() for the response returned.
*/
TEST_P(RadioVoiceTest, getCallWaiting) {
LOG(DEBUG) << "getCallWaiting";
serial = GetRandomSerialNumber();
radio_voice->getCallWaiting(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "getCallWaiting finished";
}
/*
* Test IRadioVoice.setCallWaiting() for the response returned.
*/
TEST_P(RadioVoiceTest, setCallWaiting) {
LOG(DEBUG) << "setCallWaiting";
serial = GetRandomSerialNumber();
radio_voice->setCallWaiting(serial, true, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setCallWaiting finished";
}
/*
* Test IRadioVoice.acceptCall() for the response returned.
*/
TEST_P(RadioVoiceTest, acceptCall) {
LOG(DEBUG) << "acceptCall";
serial = GetRandomSerialNumber();
radio_voice->acceptCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "acceptCall finished";
}
/*
* Test IRadioVoice.separateConnection() for the response returned.
*/
TEST_P(RadioVoiceTest, separateConnection) {
LOG(DEBUG) << "separateConnection";
serial = GetRandomSerialNumber();
radio_voice->separateConnection(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "separateConnection finished";
}
/*
* Test IRadioVoice.explicitCallTransfer() for the response returned.
*/
TEST_P(RadioVoiceTest, explicitCallTransfer) {
LOG(DEBUG) << "explicitCallTransfer";
serial = GetRandomSerialNumber();
radio_voice->explicitCallTransfer(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "explicitCallTransfer finished";
}
/*
* Test IRadioVoice.sendCdmaFeatureCode() for the response returned.
*/
TEST_P(RadioVoiceTest, sendCdmaFeatureCode) {
LOG(DEBUG) << "sendCdmaFeatureCode";
serial = GetRandomSerialNumber();
radio_voice->sendCdmaFeatureCode(serial, std::string());
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS,
RadioError::INVALID_CALL_ID, RadioError::INVALID_MODEM_STATE,
RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendCdmaFeatureCode finished";
}
/*
* Test IRadioVoice.sendDtmf() for the response returned.
*/
TEST_P(RadioVoiceTest, sendDtmf) {
LOG(DEBUG) << "sendDtmf";
serial = GetRandomSerialNumber();
radio_voice->sendDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendDtmf finished";
}
/*
* Test IRadioVoice.startDtmf() for the response returned.
*/
TEST_P(RadioVoiceTest, startDtmf) {
LOG(DEBUG) << "startDtmf";
serial = GetRandomSerialNumber();
radio_voice->startDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "startDtmf finished";
}
/*
* Test IRadioVoice.stopDtmf() for the response returned.
*/
TEST_P(RadioVoiceTest, stopDtmf) {
LOG(DEBUG) << "stopDtmf";
serial = GetRandomSerialNumber();
radio_voice->stopDtmf(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_CALL_ID,
RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "stopDtmf finished";
}
/*
* Test IRadioVoice.setMute() for the response returned.
*/
TEST_P(RadioVoiceTest, setMute) {
LOG(DEBUG) << "setMute";
serial = GetRandomSerialNumber();
radio_voice->setMute(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::NONE, RadioError::INVALID_ARGUMENTS},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "setMute finished";
}
/*
* Test IRadioVoice.getMute() for the response returned.
*/
TEST_P(RadioVoiceTest, getMute) {
LOG(DEBUG) << "getMute";
serial = GetRandomSerialNumber();
radio_voice->getMute(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
}
LOG(DEBUG) << "getMute finished";
}
/*
* Test IRadioVoice.sendBurstDtmf() for the response returned.
*/
TEST_P(RadioVoiceTest, sendBurstDtmf) {
LOG(DEBUG) << "sendBurstDtmf";
serial = GetRandomSerialNumber();
radio_voice->sendBurstDtmf(serial, "1", 0, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
CHECK_GENERAL_ERROR));
}
LOG(DEBUG) << "sendBurstDtmf finished";
}