Sim Status Present VTS

Fix and enhance sim-present tests,
Save VTS running time,
Fix serial number inconsistancy issue

Fix and enhance sim-present tests:
In 1.0:
- setupDataCall timeout, need more waiting time
- requestIccSimAuthentication returns REQUEST_NOT_SUPPORTED,
need to check it
- sendSms timeout, would need more waiting time
- sendSMSExpectMore timeout, would need more waiting time
- getAllowedCarriers, getting CardState::RESTRICTED, the previous test
of setAllowedCarriers is doing resetting back to no carrier restriction,
but that needs some time to populate.
In 1.1:
- setSimCardPower_1_1 set sim card power down that makes other tests
fail, reset it back with sim card power on.

Save VTS running time,
- Use waiting loop and prevent unnecessary waiting to save the whole
running time.

Fix serial number inconsistancy issue
- During the enforcement running, it is liked the serial number is
not consistent. And it happens in b/78249227. Suspect that when sim
card is inserted, during the testing running time, the radio may
request some response that is not triggered from the test, but the
test may receive it and think it is what is triggered by the test. The
fix is to check serial number before notifying of unlock the test
lock.

Bug: 76125134
Bug: 78248071
Bug: 78139665
Bug: 78249227
Test: run vts -m VtsHalRadioV1_0Target; run vts -m VtsHalRadioV1_1Target
Change-Id: I08fe9d7ac16283c7ce1a5aeb6b3b372786a8d5c3
This commit is contained in:
sqian
2018-03-28 16:31:59 -07:00
committed by Shuo Qian
parent 3c50fab048
commit 788eb80830
23 changed files with 470 additions and 361 deletions

View File

@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.setGsmBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Create GsmBroadcastSmsConfigInfo #1
GsmBroadcastSmsConfigInfo gbSmsConfig1;
@@ -85,7 +85,7 @@ TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
* Test IRadio.getGsmBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getGsmBroadcastConfig(serial);
@@ -105,7 +105,7 @@ TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
* Test IRadio.setCdmaBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
CdmaBroadcastSmsConfigInfo cbSmsConfig;
cbSmsConfig.serviceCategory = 4096;
@@ -132,7 +132,7 @@ TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
* Test IRadio.getCdmaBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCdmaBroadcastConfig(serial);
@@ -150,7 +150,7 @@ TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
* Test IRadio.setCdmaBroadcastActivation() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool activate = false;
radio->setCdmaBroadcastActivation(serial, activate);
@@ -170,7 +170,7 @@ TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
* Test IRadio.setGsmBroadcastActivation() for the response returned.
*/
TEST_F(RadioHidlTest, setGsmBroadcastActivation) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool activate = false;
radio->setGsmBroadcastActivation(serial, activate);

View File

@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.getDataRegistrationState() for the response returned.
*/
TEST_F(RadioHidlTest, getDataRegistrationState) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getDataRegistrationState(serial);
@@ -39,7 +39,7 @@ TEST_F(RadioHidlTest, getDataRegistrationState) {
* Test IRadio.setupDataCall() for the response returned.
*/
TEST_F(RadioHidlTest, setupDataCall) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioTechnology radioTechnology = RadioTechnology::LTE;
@@ -70,7 +70,7 @@ TEST_F(RadioHidlTest, setupDataCall) {
radio->setupDataCall(serial, radioTechnology, dataProfileInfo, modemCognitive, roamingAllowed,
isRoaming);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(std::cv_status::no_timeout, wait(300));
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
@@ -87,7 +87,7 @@ TEST_F(RadioHidlTest, setupDataCall) {
* Test IRadio.deactivateDataCall() for the response returned.
*/
TEST_F(RadioHidlTest, deactivateDataCall) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
int cid = 1;
bool reasonRadioShutDown = false;
@@ -109,7 +109,7 @@ TEST_F(RadioHidlTest, deactivateDataCall) {
* Test IRadio.getDataCallList() for the response returned.
*/
TEST_F(RadioHidlTest, getDataCallList) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getDataCallList(serial);
@@ -128,7 +128,7 @@ TEST_F(RadioHidlTest, getDataCallList) {
* Test IRadio.setInitialAttachApn() for the response returned.
*/
TEST_F(RadioHidlTest, setInitialAttachApn) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
@@ -171,7 +171,7 @@ TEST_F(RadioHidlTest, setInitialAttachApn) {
* Test IRadio.setDataAllowed() for the response returned.
*/
TEST_F(RadioHidlTest, setDataAllowed) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool allow = true;
radio->setDataAllowed(serial, allow);
@@ -189,7 +189,7 @@ TEST_F(RadioHidlTest, setDataAllowed) {
* Test IRadio.setDataProfile() for the response returned.
*/
TEST_F(RadioHidlTest, setDataProfile) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Create a dataProfileInfo
DataProfileInfo dataProfileInfo;

View File

@@ -30,7 +30,7 @@ TEST_F(RadioHidlTest, getIccCardStatus) {
* Test IRadio.supplyIccPinForApp() for the response returned
*/
TEST_F(RadioHidlTest, supplyIccPinForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
@@ -53,7 +53,7 @@ TEST_F(RadioHidlTest, supplyIccPinForApp) {
* Test IRadio.supplyIccPukForApp() for the response returned.
*/
TEST_F(RadioHidlTest, supplyIccPukForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
@@ -76,7 +76,7 @@ TEST_F(RadioHidlTest, supplyIccPukForApp) {
* Test IRadio.supplyIccPin2ForApp() for the response returned.
*/
TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
@@ -99,7 +99,7 @@ TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
* Test IRadio.supplyIccPuk2ForApp() for the response returned.
*/
TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
@@ -122,7 +122,7 @@ TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
* Test IRadio.changeIccPinForApp() for the response returned.
*/
TEST_F(RadioHidlTest, changeIccPinForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
@@ -145,7 +145,7 @@ TEST_F(RadioHidlTest, changeIccPinForApp) {
* Test IRadio.changeIccPin2ForApp() for the response returned.
*/
TEST_F(RadioHidlTest, changeIccPin2ForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
@@ -168,7 +168,7 @@ TEST_F(RadioHidlTest, changeIccPin2ForApp) {
* Test IRadio.getImsiForApp() for the response returned.
*/
TEST_F(RadioHidlTest, getImsiForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Check success returned while getting imsi for 3GPP and 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
@@ -196,7 +196,7 @@ TEST_F(RadioHidlTest, getImsiForApp) {
* Test IRadio.iccIOForApp() for the response returned.
*/
TEST_F(RadioHidlTest, iccIOForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
IccIo iccIo;
@@ -221,7 +221,7 @@ TEST_F(RadioHidlTest, iccIOForApp) {
* Test IRadio.iccTransmitApduBasicChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = hidl_string();
@@ -238,7 +238,7 @@ TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
* Test IRadio.iccOpenLogicalChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
int serial = GetRandomSerialNumber();
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++) {
@@ -253,7 +253,7 @@ TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
* Test IRadio.iccCloseLogicalChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Try closing invalid channel and check INVALID_ARGUMENTS returned as error
radio->iccCloseLogicalChannel(serial, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -267,7 +267,7 @@ TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
* Test IRadio.iccTransmitApduLogicalChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = hidl_string();
@@ -284,17 +284,18 @@ TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
* Test IRadio.requestIccSimAuthentication() for the response returned.
*/
TEST_F(RadioHidlTest, requestIccSimAuthentication) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
// returned as error.
// or REQUEST_NOT_SUPPORTED returned as error.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio->requestIccSimAuthentication(serial, 0, hidl_string("test"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::INVALID_ARGUMENTS,
RadioError::REQUEST_NOT_SUPPORTED}));
}
}
@@ -302,7 +303,7 @@ TEST_F(RadioHidlTest, requestIccSimAuthentication) {
* Test IRadio.supplyNetworkDepersonalization() for the response returned.
*/
TEST_F(RadioHidlTest, supplyNetworkDepersonalization) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());

View File

@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.getClir() for the response returned.
*/
TEST_F(RadioHidlTest, getClir) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getClir(serial);
@@ -40,7 +40,7 @@ TEST_F(RadioHidlTest, getClir) {
* Test IRadio.setClir() for the response returned.
*/
TEST_F(RadioHidlTest, setClir) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
int32_t status = 1;
radio->setClir(serial, status);
@@ -58,7 +58,7 @@ TEST_F(RadioHidlTest, setClir) {
* Test IRadio.getFacilityLockForApp() for the response returned.
*/
TEST_F(RadioHidlTest, getFacilityLockForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
std::string facility = "";
std::string password = "";
int32_t serviceClass = 1;
@@ -81,7 +81,7 @@ TEST_F(RadioHidlTest, getFacilityLockForApp) {
* Test IRadio.setFacilityLockForApp() for the response returned.
*/
TEST_F(RadioHidlTest, setFacilityLockForApp) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
std::string facility = "";
bool lockState = false;
std::string password = "";
@@ -105,7 +105,7 @@ TEST_F(RadioHidlTest, setFacilityLockForApp) {
* Test IRadio.setBarringPassword() for the response returned.
*/
TEST_F(RadioHidlTest, setBarringPassword) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
std::string facility = "";
std::string oldPassword = "";
std::string newPassword = "";
@@ -128,7 +128,7 @@ TEST_F(RadioHidlTest, setBarringPassword) {
* Test IRadio.getClip() for the response returned.
*/
TEST_F(RadioHidlTest, getClip) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getClip(serial);
@@ -146,7 +146,7 @@ TEST_F(RadioHidlTest, getClip) {
* Test IRadio.setSuppServiceNotifications() for the response returned.
*/
TEST_F(RadioHidlTest, setSuppServiceNotifications) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool enable = false;
radio->setSuppServiceNotifications(serial, enable);
@@ -165,7 +165,7 @@ TEST_F(RadioHidlTest, setSuppServiceNotifications) {
* Test IRadio.requestIsimAuthentication() for the response returned.
*/
TEST_F(RadioHidlTest, requestIsimAuthentication) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
std::string challenge = "";
radio->requestIsimAuthentication(serial, challenge);
@@ -187,7 +187,7 @@ TEST_F(RadioHidlTest, requestIsimAuthentication) {
* Test IRadio.getImsRegistrationState() for the response returned.
*/
TEST_F(RadioHidlTest, getImsRegistrationState) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getImsRegistrationState(serial);

View File

@@ -20,7 +20,7 @@
* Test IRadio.getSignalStrength() for the response returned.
*/
TEST_F(RadioHidlTest, getSignalStrength) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getSignalStrength(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -36,7 +36,7 @@ TEST_F(RadioHidlTest, getSignalStrength) {
* Test IRadio.getVoiceRegistrationState() for the response returned.
*/
TEST_F(RadioHidlTest, getVoiceRegistrationState) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getVoiceRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -52,7 +52,7 @@ TEST_F(RadioHidlTest, getVoiceRegistrationState) {
* Test IRadio.getOperator() for the response returned.
*/
TEST_F(RadioHidlTest, getOperator) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getOperator(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -68,7 +68,7 @@ TEST_F(RadioHidlTest, getOperator) {
* Test IRadio.setRadioPower() for the response returned.
*/
TEST_F(RadioHidlTest, setRadioPower) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setRadioPower(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -84,7 +84,7 @@ TEST_F(RadioHidlTest, setRadioPower) {
* Test IRadio.getNetworkSelectionMode() for the response returned.
*/
TEST_F(RadioHidlTest, getNetworkSelectionMode) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getNetworkSelectionMode(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -100,7 +100,7 @@ TEST_F(RadioHidlTest, getNetworkSelectionMode) {
* Test IRadio.setNetworkSelectionModeAutomatic() for the response returned.
*/
TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setNetworkSelectionModeAutomatic(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -119,7 +119,7 @@ TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) {
* Test IRadio.setNetworkSelectionModeManual() for the response returned.
*/
TEST_F(RadioHidlTest, setNetworkSelectionModeManual) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setNetworkSelectionModeManual(serial, "123456");
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -138,7 +138,7 @@ TEST_F(RadioHidlTest, setNetworkSelectionModeManual) {
* Test IRadio.getAvailableNetworks() for the response returned.
*/
TEST_F(RadioHidlTest, getAvailableNetworks) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getAvailableNetworks(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait(300));
@@ -159,7 +159,7 @@ TEST_F(RadioHidlTest, getAvailableNetworks) {
* Test IRadio.getBasebandVersion() for the response returned.
*/
TEST_F(RadioHidlTest, getBasebandVersion) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getBasebandVersion(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -175,7 +175,7 @@ TEST_F(RadioHidlTest, getBasebandVersion) {
* Test IRadio.setBandMode() for the response returned.
*/
TEST_F(RadioHidlTest, setBandMode) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setBandMode(serial, RadioBandMode::BAND_MODE_USA);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -192,7 +192,7 @@ TEST_F(RadioHidlTest, setBandMode) {
* Test IRadio.getAvailableBandModes() for the response returned.
*/
TEST_F(RadioHidlTest, getAvailableBandModes) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getAvailableBandModes(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -208,7 +208,7 @@ TEST_F(RadioHidlTest, getAvailableBandModes) {
* Test IRadio.setPreferredNetworkType() for the response returned.
*/
TEST_F(RadioHidlTest, setPreferredNetworkType) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setPreferredNetworkType(serial, PreferredNetworkType::GSM_ONLY);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -225,7 +225,7 @@ TEST_F(RadioHidlTest, setPreferredNetworkType) {
* Test IRadio.getPreferredNetworkType() for the response returned.
*/
TEST_F(RadioHidlTest, getPreferredNetworkType) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getPreferredNetworkType(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -241,7 +241,7 @@ TEST_F(RadioHidlTest, getPreferredNetworkType) {
* Test IRadio.getNeighboringCids() for the response returned.
*/
TEST_F(RadioHidlTest, getNeighboringCids) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getNeighboringCids(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -259,7 +259,7 @@ TEST_F(RadioHidlTest, getNeighboringCids) {
* Test IRadio.setLocationUpdates() for the response returned.
*/
TEST_F(RadioHidlTest, setLocationUpdates) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setLocationUpdates(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -276,7 +276,7 @@ TEST_F(RadioHidlTest, setLocationUpdates) {
* Test IRadio.setCdmaRoamingPreference() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaRoamingPreference) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -294,7 +294,7 @@ TEST_F(RadioHidlTest, setCdmaRoamingPreference) {
* Test IRadio.getCdmaRoamingPreference() for the response returned.
*/
TEST_F(RadioHidlTest, getCdmaRoamingPreference) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCdmaRoamingPreference(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -313,7 +313,7 @@ TEST_F(RadioHidlTest, getCdmaRoamingPreference) {
* Test IRadio.getTTYMode() for the response returned.
*/
TEST_F(RadioHidlTest, getTTYMode) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getTTYMode(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -329,7 +329,7 @@ TEST_F(RadioHidlTest, getTTYMode) {
* Test IRadio.setTTYMode() for the response returned.
*/
TEST_F(RadioHidlTest, setTTYMode) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setTTYMode(serial, TtyMode::OFF);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -345,7 +345,7 @@ TEST_F(RadioHidlTest, setTTYMode) {
* Test IRadio.setPreferredVoicePrivacy() for the response returned.
*/
TEST_F(RadioHidlTest, setPreferredVoicePrivacy) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setPreferredVoicePrivacy(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -362,7 +362,7 @@ TEST_F(RadioHidlTest, setPreferredVoicePrivacy) {
* Test IRadio.getPreferredVoicePrivacy() for the response returned.
*/
TEST_F(RadioHidlTest, getPreferredVoicePrivacy) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getPreferredVoicePrivacy(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -379,7 +379,7 @@ TEST_F(RadioHidlTest, getPreferredVoicePrivacy) {
* Test IRadio.getCDMASubscription() for the response returned.
*/
TEST_F(RadioHidlTest, getCDMASubscription) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCDMASubscription(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -397,7 +397,7 @@ TEST_F(RadioHidlTest, getCDMASubscription) {
* Test IRadio.getDeviceIdentity() for the response returned.
*/
TEST_F(RadioHidlTest, getDeviceIdentity) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getDeviceIdentity(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -414,7 +414,7 @@ TEST_F(RadioHidlTest, getDeviceIdentity) {
* Test IRadio.exitEmergencyCallbackMode() for the response returned.
*/
TEST_F(RadioHidlTest, exitEmergencyCallbackMode) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->exitEmergencyCallbackMode(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -432,7 +432,7 @@ TEST_F(RadioHidlTest, exitEmergencyCallbackMode) {
* Test IRadio.getCdmaSubscriptionSource() for the response returned.
*/
TEST_F(RadioHidlTest, getCdmaSubscriptionSource) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCdmaSubscriptionSource(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -450,7 +450,7 @@ TEST_F(RadioHidlTest, getCdmaSubscriptionSource) {
* Test IRadio.setCdmaSubscriptionSource() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaSubscriptionSource) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -469,7 +469,7 @@ TEST_F(RadioHidlTest, setCdmaSubscriptionSource) {
* Test IRadio.getVoiceRadioTechnology() for the response returned.
*/
TEST_F(RadioHidlTest, getVoiceRadioTechnology) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getVoiceRadioTechnology(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -485,7 +485,7 @@ TEST_F(RadioHidlTest, getVoiceRadioTechnology) {
* Test IRadio.getCellInfoList() for the response returned.
*/
TEST_F(RadioHidlTest, getCellInfoList) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCellInfoList(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -503,7 +503,7 @@ TEST_F(RadioHidlTest, getCellInfoList) {
* Test IRadio.setCellInfoListRate() for the response returned.
*/
TEST_F(RadioHidlTest, setCellInfoListRate) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// TODO(sanketpadawe): RIL crashes with value of rate = 10
radio->setCellInfoListRate(serial, 10);
@@ -521,7 +521,7 @@ TEST_F(RadioHidlTest, setCellInfoListRate) {
* Test IRadio.nvReadItem() for the response returned.
*/
TEST_F(RadioHidlTest, nvReadItem) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -538,7 +538,7 @@ TEST_F(RadioHidlTest, nvReadItem) {
* Test IRadio.nvWriteItem() for the response returned.
*/
TEST_F(RadioHidlTest, nvWriteItem) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
NvWriteItem item;
memset(&item, 0, sizeof(item));
item.value = hidl_string();
@@ -558,7 +558,7 @@ TEST_F(RadioHidlTest, nvWriteItem) {
* Test IRadio.nvWriteCdmaPrl() for the response returned.
*/
TEST_F(RadioHidlTest, nvWriteCdmaPrl) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
radio->nvWriteCdmaPrl(serial, hidl_vec<uint8_t>(prl));
@@ -576,9 +576,9 @@ TEST_F(RadioHidlTest, nvWriteCdmaPrl) {
* Test IRadio.nvResetConfig() for the response returned.
*/
TEST_F(RadioHidlTest, nvResetConfig) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->nvResetConfig(++serial, ResetNvType::ERASE);
radio->nvResetConfig(serial, ResetNvType::ERASE);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
@@ -593,7 +593,7 @@ TEST_F(RadioHidlTest, nvResetConfig) {
* Test IRadio.setUiccSubscription() for the response returned.
*/
TEST_F(RadioHidlTest, setUiccSubscription) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
SelectUiccSub item;
memset(&item, 0, sizeof(item));
@@ -615,7 +615,7 @@ TEST_F(RadioHidlTest, setUiccSubscription) {
* Test IRadio.getHardwareConfig() for the response returned.
*/
TEST_F(RadioHidlTest, getHardwareConfig) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getHardwareConfig(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -632,7 +632,7 @@ TEST_F(RadioHidlTest, getHardwareConfig) {
* Test IRadio.requestShutdown() for the response returned.
*/
TEST_F(RadioHidlTest, requestShutdown) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->requestShutdown(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -649,7 +649,7 @@ TEST_F(RadioHidlTest, requestShutdown) {
* Test IRadio.getRadioCapability() for the response returned.
*/
TEST_F(RadioHidlTest, getRadioCapability) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getRadioCapability(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -665,7 +665,7 @@ TEST_F(RadioHidlTest, getRadioCapability) {
* Test IRadio.setRadioCapability() for the response returned.
*/
TEST_F(RadioHidlTest, setRadioCapability) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioCapability rc;
memset(&rc, 0, sizeof(rc));
rc.logicalModemUuid = hidl_string();
@@ -686,7 +686,7 @@ TEST_F(RadioHidlTest, setRadioCapability) {
* Test IRadio.startLceService() for the response returned.
*/
TEST_F(RadioHidlTest, startLceService) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->startLceService(serial, 5, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -704,7 +704,7 @@ TEST_F(RadioHidlTest, startLceService) {
* Test IRadio.stopLceService() for the response returned.
*/
TEST_F(RadioHidlTest, stopLceService) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->stopLceService(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -722,7 +722,7 @@ TEST_F(RadioHidlTest, stopLceService) {
* Test IRadio.pullLceData() for the response returned.
*/
TEST_F(RadioHidlTest, pullLceData) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->pullLceData(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -741,7 +741,7 @@ TEST_F(RadioHidlTest, pullLceData) {
* Test IRadio.getModemActivityInfo() for the response returned.
*/
TEST_F(RadioHidlTest, getModemActivityInfo) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getModemActivityInfo(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -758,7 +758,7 @@ TEST_F(RadioHidlTest, getModemActivityInfo) {
* Test IRadio.setAllowedCarriers() for the response returned.
*/
TEST_F(RadioHidlTest, setAllowedCarriers) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
CarrierRestrictions carriers;
memset(&carriers, 0, sizeof(carriers));
carriers.allowedCarriers.resize(1);
@@ -778,12 +778,26 @@ TEST_F(RadioHidlTest, setAllowedCarriers) {
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
/* Setting to carrier restriction needs some time */
updateSimCardStatus();
auto startTime = std::chrono::system_clock::now();
while (cardStatus.cardState != CardState::RESTRICTED &&
std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime)
.count() < 10) {
/* Set 2 seconds as interval to check card status */
sleep(2);
updateSimCardStatus();
}
EXPECT_EQ(CardState::RESTRICTED, cardStatus.cardState);
sleep(10);
/* Reset back to no carrier restriction */
memset(&carriers, 0, sizeof(carriers));
carriers.allowedCarriers.resize(0);
carriers.excludedCarriers.resize(0);
radio->setAllowedCarriers(++serial, true, carriers);
serial = GetRandomSerialNumber();
radio->setAllowedCarriers(serial, true, carriers);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
@@ -792,13 +806,26 @@ TEST_F(RadioHidlTest, setAllowedCarriers) {
ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
/* Resetting back to no carrier restriction needs some time */
updateSimCardStatus();
startTime = std::chrono::system_clock::now();
while (cardStatus.cardState == CardState::RESTRICTED &&
std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime)
.count() < 10) {
/* Set 2 seconds as interval to check card status */
sleep(2);
updateSimCardStatus();
}
EXPECT_NE(CardState::RESTRICTED, cardStatus.cardState);
sleep(10);
}
/*
* Test IRadio.getAllowedCarriers() for the response returned.
*/
TEST_F(RadioHidlTest, getAllowedCarriers) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getAllowedCarriers(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -815,7 +842,7 @@ TEST_F(RadioHidlTest, getAllowedCarriers) {
* Test IRadio.sendDeviceState() for the response returned.
*/
TEST_F(RadioHidlTest, sendDeviceState) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -834,7 +861,7 @@ TEST_F(RadioHidlTest, sendDeviceState) {
* Test IRadio.setIndicationFilter() for the response returned.
*/
TEST_F(RadioHidlTest, setIndicationFilter) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setIndicationFilter(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -853,7 +880,7 @@ TEST_F(RadioHidlTest, setIndicationFilter) {
* Test IRadio.setSimCardPower() for the response returned.
*/
TEST_F(RadioHidlTest, setSimCardPower) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setSimCardPower(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());

View File

@@ -22,14 +22,14 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.sendSms() for the response returned.
*/
TEST_F(RadioHidlTest, sendSms) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
GsmSmsMessage msg;
msg.smscPdu = "";
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
radio->sendSms(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(std::cv_status::no_timeout, wait(300));
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
@@ -46,7 +46,7 @@ TEST_F(RadioHidlTest, sendSms) {
* Test IRadio.sendSMSExpectMore() for the response returned.
*/
TEST_F(RadioHidlTest, sendSMSExpectMore) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
GsmSmsMessage msg;
msg.smscPdu = "";
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
@@ -56,7 +56,7 @@ TEST_F(RadioHidlTest, sendSMSExpectMore) {
// TODO(shuoq): add more test for this API when inserted sim card is
// considered
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(std::cv_status::no_timeout, wait(300));
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
@@ -72,7 +72,7 @@ TEST_F(RadioHidlTest, sendSMSExpectMore) {
* Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned.
*/
TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool success = true;
radio->acknowledgeLastIncomingGsmSms(serial, success,
@@ -93,7 +93,7 @@ TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
* Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
*/
TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool success = true;
std::string ackPdu = "";
@@ -112,7 +112,7 @@ TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
* Test IRadio.sendCdmaSms() for the response returned.
*/
TEST_F(RadioHidlTest, sendCdmaSms) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
@@ -156,7 +156,7 @@ TEST_F(RadioHidlTest, sendCdmaSms) {
* Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned.
*/
TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Create a CdmaSmsAck
CdmaSmsAck cdmaSmsAck;
@@ -180,7 +180,7 @@ TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
* Test IRadio.sendImsSms() for the response returned.
*/
TEST_F(RadioHidlTest, sendImsSms) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
@@ -230,7 +230,7 @@ TEST_F(RadioHidlTest, sendImsSms) {
* Test IRadio.getSmscAddress() for the response returned.
*/
TEST_F(RadioHidlTest, getSmscAddress) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getSmscAddress(serial);
@@ -250,7 +250,7 @@ TEST_F(RadioHidlTest, getSmscAddress) {
* Test IRadio.setSmscAddress() for the response returned.
*/
TEST_F(RadioHidlTest, setSmscAddress) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
hidl_string address = hidl_string("smscAddress");
radio->setSmscAddress(serial, address);
@@ -271,7 +271,7 @@ TEST_F(RadioHidlTest, setSmscAddress) {
* Test IRadio.writeSmsToSim() for the response returned.
*/
TEST_F(RadioHidlTest, writeSmsToSim) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
SmsWriteArgs smsWriteArgs;
smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
smsWriteArgs.smsc = "";
@@ -297,7 +297,7 @@ TEST_F(RadioHidlTest, writeSmsToSim) {
* Test IRadio.deleteSmsOnSim() for the response returned.
*/
TEST_F(RadioHidlTest, deleteSmsOnSim) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
int index = 1;
radio->deleteSmsOnSim(serial, index);
@@ -320,7 +320,7 @@ TEST_F(RadioHidlTest, deleteSmsOnSim) {
* Test IRadio.writeSmsToRuim() for the response returned.
*/
TEST_F(RadioHidlTest, writeSmsToRuim) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
@@ -371,7 +371,7 @@ TEST_F(RadioHidlTest, writeSmsToRuim) {
* Test IRadio.deleteSmsOnRuim() for the response returned.
*/
TEST_F(RadioHidlTest, deleteSmsOnRuim) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
int index = 1;
// Create a CdmaSmsAddress
@@ -422,7 +422,7 @@ TEST_F(RadioHidlTest, deleteSmsOnRuim) {
* Test IRadio.reportSmsMemoryStatus() for the response returned.
*/
TEST_F(RadioHidlTest, reportSmsMemoryStatus) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool available = true;
radio->reportSmsMemoryStatus(serial, available);

View File

@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.sendEnvelope() for the response returned.
*/
TEST_F(RadioHidlTest, sendEnvelope) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Test with sending empty string
std::string content = "";
@@ -45,7 +45,7 @@ TEST_F(RadioHidlTest, sendEnvelope) {
* Test IRadio.sendTerminalResponseToSim() for the response returned.
*/
TEST_F(RadioHidlTest, sendTerminalResponseToSim) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Test with sending empty string
std::string commandResponse = "";
@@ -68,7 +68,7 @@ TEST_F(RadioHidlTest, sendTerminalResponseToSim) {
* Test IRadio.handleStkCallSetupRequestFromSim() for the response returned.
*/
TEST_F(RadioHidlTest, handleStkCallSetupRequestFromSim) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
bool accept = false;
radio->handleStkCallSetupRequestFromSim(serial, accept);
@@ -89,7 +89,7 @@ TEST_F(RadioHidlTest, handleStkCallSetupRequestFromSim) {
* Test IRadio.reportStkServiceIsRunning() for the response returned.
*/
TEST_F(RadioHidlTest, reportStkServiceIsRunning) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->reportStkServiceIsRunning(serial);
@@ -108,7 +108,7 @@ TEST_F(RadioHidlTest, reportStkServiceIsRunning) {
* string.
*/
TEST_F(RadioHidlTest, sendEnvelopeWithStatus) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
// Test with sending empty string
std::string contents = "";

View File

@@ -37,22 +37,21 @@ void RadioHidlTest::SetUp() {
radio->setResponseFunctions(radioRsp, radioInd);
int serial = GetRandomSerialNumber();
radio->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
updateSimCardStatus();
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
/* Vts Testing with Sim Absent only. This needs to be removed later in P when sim present
* scenarios will be tested. */
EXPECT_EQ(CardState::ABSENT, cardStatus.cardState);
/* Enforce Vts Testing with Sim Status Present only. */
EXPECT_EQ(CardState::PRESENT, cardStatus.cardState);
}
void RadioHidlTest::notify() {
void RadioHidlTest::notify(int receivedSerial) {
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
if (serial == receivedSerial) {
count++;
cv.notify_one();
}
}
std::cv_status RadioHidlTest::wait(int sec) {
@@ -69,3 +68,9 @@ std::cv_status RadioHidlTest::wait(int sec) {
count--;
return status;
}
void RadioHidlTest::updateSimCardStatus() {
serial = GetRandomSerialNumber();
radio->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
}

View File

@@ -533,11 +533,17 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
std::condition_variable cv;
int count;
/* Serial number for radio request */
int serial;
/* Update Sim Card Status */
void updateSimCardStatus();
public:
virtual void SetUp() override;
/* Used as a mechanism to inform the test about data/event callback */
void notify();
void notify(int receivedSerial);
/* Test code calls this function to wait for response */
std::cv_status wait(int sec = TIMEOUT_PERIOD);

View File

@@ -20,7 +20,7 @@
* Test IRadio.getCurrentCalls() for the response returned.
*/
TEST_F(RadioHidlTest, getCurrentCalls) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCurrentCalls(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -36,7 +36,7 @@ TEST_F(RadioHidlTest, getCurrentCalls) {
* Test IRadio.dial() for the response returned.
*/
TEST_F(RadioHidlTest, dial) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Dial dialInfo;
memset(&dialInfo, 0, sizeof(dialInfo));
@@ -63,7 +63,7 @@ TEST_F(RadioHidlTest, dial) {
* Test IRadio.hangup() for the response returned.
*/
TEST_F(RadioHidlTest, hangup) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->hangup(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -82,7 +82,7 @@ TEST_F(RadioHidlTest, hangup) {
* Test IRadio.hangupWaitingOrBackground() for the response returned.
*/
TEST_F(RadioHidlTest, hangupWaitingOrBackground) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->hangupWaitingOrBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -100,7 +100,7 @@ TEST_F(RadioHidlTest, hangupWaitingOrBackground) {
* Test IRadio.hangupForegroundResumeBackground() for the response returned.
*/
TEST_F(RadioHidlTest, hangupForegroundResumeBackground) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->hangupForegroundResumeBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -118,7 +118,7 @@ TEST_F(RadioHidlTest, hangupForegroundResumeBackground) {
* Test IRadio.switchWaitingOrHoldingAndActive() for the response returned.
*/
TEST_F(RadioHidlTest, switchWaitingOrHoldingAndActive) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->switchWaitingOrHoldingAndActive(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -136,7 +136,7 @@ TEST_F(RadioHidlTest, switchWaitingOrHoldingAndActive) {
* Test IRadio.conference() for the response returned.
*/
TEST_F(RadioHidlTest, conference) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->conference(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -154,7 +154,7 @@ TEST_F(RadioHidlTest, conference) {
* Test IRadio.rejectCall() for the response returned.
*/
TEST_F(RadioHidlTest, rejectCall) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->rejectCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -172,7 +172,7 @@ TEST_F(RadioHidlTest, rejectCall) {
* Test IRadio.getLastCallFailCause() for the response returned.
*/
TEST_F(RadioHidlTest, getLastCallFailCause) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getLastCallFailCause(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -189,7 +189,7 @@ TEST_F(RadioHidlTest, getLastCallFailCause) {
* Test IRadio.sendUssd() for the response returned.
*/
TEST_F(RadioHidlTest, sendUssd) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->sendUssd(serial, hidl_string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
@@ -207,7 +207,7 @@ TEST_F(RadioHidlTest, sendUssd) {
* Test IRadio.cancelPendingUssd() for the response returned.
*/
TEST_F(RadioHidlTest, cancelPendingUssd) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->cancelPendingUssd(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -226,7 +226,7 @@ TEST_F(RadioHidlTest, cancelPendingUssd) {
* Test IRadio.getCallForwardStatus() for the response returned.
*/
TEST_F(RadioHidlTest, getCallForwardStatus) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = hidl_string();
@@ -248,7 +248,7 @@ TEST_F(RadioHidlTest, getCallForwardStatus) {
* Test IRadio.setCallForward() for the response returned.
*/
TEST_F(RadioHidlTest, setCallForward) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = hidl_string();
@@ -270,7 +270,7 @@ TEST_F(RadioHidlTest, setCallForward) {
* Test IRadio.getCallWaiting() for the response returned.
*/
TEST_F(RadioHidlTest, getCallWaiting) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getCallWaiting(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -289,7 +289,7 @@ TEST_F(RadioHidlTest, getCallWaiting) {
* Test IRadio.setCallWaiting() for the response returned.
*/
TEST_F(RadioHidlTest, setCallWaiting) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setCallWaiting(serial, true, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -308,7 +308,7 @@ TEST_F(RadioHidlTest, setCallWaiting) {
* Test IRadio.acceptCall() for the response returned.
*/
TEST_F(RadioHidlTest, acceptCall) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->acceptCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -326,7 +326,7 @@ TEST_F(RadioHidlTest, acceptCall) {
* Test IRadio.separateConnection() for the response returned.
*/
TEST_F(RadioHidlTest, separateConnection) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->separateConnection(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -345,7 +345,7 @@ TEST_F(RadioHidlTest, separateConnection) {
* Test IRadio.explicitCallTransfer() for the response returned.
*/
TEST_F(RadioHidlTest, explicitCallTransfer) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->explicitCallTransfer(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -363,7 +363,7 @@ TEST_F(RadioHidlTest, explicitCallTransfer) {
* Test IRadio.sendCDMAFeatureCode() for the response returned.
*/
TEST_F(RadioHidlTest, sendCDMAFeatureCode) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->sendCDMAFeatureCode(serial, hidl_string());
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -383,7 +383,7 @@ TEST_F(RadioHidlTest, sendCDMAFeatureCode) {
* Test IRadio.sendDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, sendDtmf) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->sendDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -403,7 +403,7 @@ TEST_F(RadioHidlTest, sendDtmf) {
* Test IRadio.startDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, startDtmf) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->startDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -423,7 +423,7 @@ TEST_F(RadioHidlTest, startDtmf) {
* Test IRadio.stopDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, stopDtmf) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->stopDtmf(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -442,7 +442,7 @@ TEST_F(RadioHidlTest, stopDtmf) {
* Test IRadio.setMute() for the response returned.
*/
TEST_F(RadioHidlTest, setMute) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->setMute(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -460,7 +460,7 @@ TEST_F(RadioHidlTest, setMute) {
* Test IRadio.getMute() for the response returned.
*/
TEST_F(RadioHidlTest, getMute) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->getMute(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -476,7 +476,7 @@ TEST_F(RadioHidlTest, getMute) {
* Test IRadio.sendBurstDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, sendBurstDtmf) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio->sendBurstDtmf(serial, "1", 0, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());

View File

@@ -24,69 +24,69 @@ Return<void> RadioResponse::getIccCardStatusResponse(const RadioResponseInfo& in
const CardStatus& card_status) {
rspInfo = info;
cardStatus = card_status;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::supplyIccPinForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::supplyIccPukForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::changeIccPinForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::changeIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info,
int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getCurrentCallsResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<Call>& /*calls*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::dialResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -94,72 +94,72 @@ Return<void> RadioResponse::getIMSIForAppResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& imsi) {
rspInfo = info;
this->imsi = imsi;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::hangupConnectionResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::conferenceResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::rejectCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getLastCallFailCauseResponse(
const RadioResponseInfo& info, const LastCallFailCauseInfo& /*failCauseInfo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getSignalStrengthResponse(const RadioResponseInfo& info,
const SignalStrength& /*sig_strength*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getVoiceRegistrationStateResponse(
const RadioResponseInfo& info, const VoiceRegStateResult& /*voiceRegResponse*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getDataRegistrationStateResponse(
const RadioResponseInfo& info, const DataRegStateResult& /*dataRegResponse*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -168,19 +168,19 @@ Return<void> RadioResponse::getOperatorResponse(
const ::android::hardware::hidl_string& /*shortName*/,
const ::android::hardware::hidl_string& /*numeric*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -188,7 +188,7 @@ Return<void> RadioResponse::sendSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms) {
rspInfo = info;
sendSmsResult = sms;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -196,14 +196,14 @@ Return<void> RadioResponse::sendSMSExpectMoreResponse(const RadioResponseInfo& i
const SendSmsResult& sms) {
rspInfo = info;
sendSmsResult = sms;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setupDataCallResponse(const RadioResponseInfo& info,
const SetupDataCallResult& /*dcResponse*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -211,32 +211,32 @@ Return<void> RadioResponse::iccIOForAppResponse(const RadioResponseInfo& info,
const IccIoResult& iccIo) {
rspInfo = info;
this->iccIoResult = iccIo;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendUssdResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::cancelPendingUssdResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getClirResponse(const RadioResponseInfo& info, int32_t /*n*/,
int32_t /*m*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setClirResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -244,84 +244,84 @@ Return<void> RadioResponse::getCallForwardStatusResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<CallForwardInfo>&
/*callForwardInfos*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCallForwardResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getCallWaitingResponse(const RadioResponseInfo& info, bool /*enable*/,
int32_t /*serviceClass*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCallWaitingResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::acceptCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::deactivateDataCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t /*response*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t /*retry*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getNetworkSelectionModeResponse(const RadioResponseInfo& info,
bool /*manual*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setNetworkSelectionModeManualResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -329,50 +329,50 @@ Return<void> RadioResponse::getAvailableNetworksResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::startDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::stopDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getBasebandVersionResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*version*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::separateConnectionResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setMuteResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getMuteResponse(const RadioResponseInfo& info, bool /*enable*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getClipResponse(const RadioResponseInfo& info, ClipStatus /*status*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -380,7 +380,7 @@ Return<void> RadioResponse::getDataCallListResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcResponse*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -397,26 +397,26 @@ Return<void> RadioResponse::sendOemRilRequestStringsResponse(
Return<void> RadioResponse::setSuppServiceNotificationsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index) {
rspInfo = info;
writeSmsToSimIndex = index;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::deleteSmsOnSimResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setBandModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -424,46 +424,46 @@ Return<void> RadioResponse::getAvailableBandModesResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<RadioBandMode>& /*bandModes*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendEnvelopeResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*commandResponse*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendTerminalResponseToSimResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::explicitCallTransferResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setPreferredNetworkTypeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
PreferredNetworkType /*nw_type*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -471,69 +471,69 @@ Return<void> RadioResponse::getNeighboringCidsResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setLocationUpdatesResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
CdmaRoamingType /*type*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setTTYModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getTTYModeResponse(const RadioResponseInfo& info, TtyMode /*mode*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getPreferredVoicePrivacyResponse(const RadioResponseInfo& info,
bool /*enable*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendBurstDtmfResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -541,13 +541,13 @@ Return<void> RadioResponse::sendCdmaSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms) {
rspInfo = info;
sendSmsResult = sms;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -555,19 +555,19 @@ Return<void> RadioResponse::getGsmBroadcastConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setGsmBroadcastConfigResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setGsmBroadcastActivationResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -575,19 +575,19 @@ Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCdmaBroadcastActivationResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -598,20 +598,20 @@ Return<void> RadioResponse::getCDMASubscriptionResponse(
const ::android::hardware::hidl_string& /*min*/,
const ::android::hardware::hidl_string& /*prl*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index) {
rspInfo = info;
writeSmsToRuimIndex = index;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::deleteSmsOnRuimResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -621,13 +621,13 @@ Return<void> RadioResponse::getDeviceIdentityResponse(
const ::android::hardware::hidl_string& /*esn*/,
const ::android::hardware::hidl_string& /*meid*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -635,79 +635,79 @@ Return<void> RadioResponse::getSmscAddressResponse(const RadioResponseInfo& info
const ::android::hardware::hidl_string& smsc) {
rspInfo = info;
smscAddress = smsc;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setSmscAddressResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::reportSmsMemoryStatusResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::reportStkServiceIsRunningResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
CdmaSubscriptionSource /*source*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::requestIsimAuthenticationResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*response*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
const IccIoResult& /*iccIo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
RadioTechnology /*rat*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getCellInfoListResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<CellInfo>& /*cellInfo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setCellInfoListRateResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setInitialAttachApnResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -715,7 +715,7 @@ Return<void> RadioResponse::getImsRegistrationStateResponse(const RadioResponseI
bool /*isRegistered*/,
RadioTechnologyFamily /*ratFamily*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -723,7 +723,7 @@ Return<void> RadioResponse::sendImsSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms) {
rspInfo = info;
sendSmsResult = sms;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -731,7 +731,7 @@ Return<void> RadioResponse::iccTransmitApduBasicChannelResponse(const RadioRespo
const IccIoResult& result) {
rspInfo = info;
this->iccIoResult = result;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -740,13 +740,13 @@ Return<void> RadioResponse::iccOpenLogicalChannelResponse(
const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) {
rspInfo = info;
this->channelId = channelId;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -754,44 +754,44 @@ Return<void> RadioResponse::iccTransmitApduLogicalChannelResponse(const RadioRes
const IccIoResult& result) {
rspInfo = info;
this->iccIoResult = result;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::nvReadItemResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& /*result*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -799,7 +799,7 @@ Return<void> RadioResponse::getHardwareConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -807,68 +807,68 @@ Return<void> RadioResponse::requestIccSimAuthenticationResponse(const RadioRespo
const IccIoResult& result) {
rspInfo = info;
this->iccIoResult = result;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setDataProfileResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::requestShutdownResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& /*rc*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& /*rc*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::startLceServiceResponse(const RadioResponseInfo& info,
const LceStatusInfo& /*statusInfo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::stopLceServiceResponse(const RadioResponseInfo& info,
const LceStatusInfo& /*statusInfo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::pullLceDataResponse(const RadioResponseInfo& info,
const LceDataInfo& /*lceInfo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::getModemActivityInfoResponse(
const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setAllowedCarriersResponse(const RadioResponseInfo& info,
int32_t /*numAllowed*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
@@ -876,25 +876,25 @@ Return<void> RadioResponse::getAllowedCarriersResponse(const RadioResponseInfo&
bool /*allAllowed*/,
const CarrierRestrictions& /*carriers*/) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::sendDeviceStateResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setIndicationFilterResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}
Return<void> RadioResponse::setSimCardPowerResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
parent.notify(info.serial);
return Void();
}

View File

@@ -21,13 +21,13 @@ SapCallback::SapCallback(SapHidlTest& parent) : parent(parent) {}
Return<void> SapCallback::connectResponse(int32_t token, SapConnectRsp /*sapConnectRsp*/,
int32_t /*maxMsgSize*/) {
sapResponseToken = token;
parent.notify();
parent.notify(token);
return Void();
}
Return<void> SapCallback::disconnectResponse(int32_t token) {
sapResponseToken = token;
parent.notify();
parent.notify(token);
return Void();
}
@@ -40,7 +40,7 @@ Return<void> SapCallback::apduResponse(int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& /*apduRsp*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
parent.notify(token);
return Void();
}
@@ -49,21 +49,21 @@ Return<void> SapCallback::transferAtrResponse(
const ::android::hardware::hidl_vec<uint8_t>& /*atr*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
parent.notify(token);
return Void();
}
Return<void> SapCallback::powerResponse(int32_t token, SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
parent.notify(token);
return Void();
}
Return<void> SapCallback::resetSimResponse(int32_t token, SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
parent.notify(token);
return Void();
}
@@ -75,7 +75,7 @@ Return<void> SapCallback::transferCardReaderStatusResponse(int32_t token, SapRes
int32_t /*cardReaderStatus*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
parent.notify(token);
return Void();
}
@@ -86,6 +86,6 @@ Return<void> SapCallback::errorResponse(int32_t /*token*/) {
Return<void> SapCallback::transferProtocolResponse(int32_t token, SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
parent.notify(token);
return Void();
}

View File

@@ -20,7 +20,7 @@
* Test ISap.connectReq() for the response returned.
*/
TEST_F(SapHidlTest, connectReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
int32_t maxMsgSize = 100;
sap->connectReq(token, maxMsgSize);
@@ -32,7 +32,7 @@ TEST_F(SapHidlTest, connectReq) {
* Test IRadio.disconnectReq() for the response returned
*/
TEST_F(SapHidlTest, disconnectReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
sap->disconnectReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -43,7 +43,7 @@ TEST_F(SapHidlTest, disconnectReq) {
* Test IRadio.apduReq() for the response returned.
*/
TEST_F(SapHidlTest, apduReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
SapApduType sapApduType = SapApduType::APDU;
android::hardware::hidl_vec<uint8_t> command = {};
@@ -61,7 +61,7 @@ TEST_F(SapHidlTest, apduReq) {
* Test IRadio.transferAtrReq() for the response returned.
*/
TEST_F(SapHidlTest, transferAtrReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
sap->transferAtrReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -77,7 +77,7 @@ TEST_F(SapHidlTest, transferAtrReq) {
* Test IRadio.powerReq() for the response returned.
*/
TEST_F(SapHidlTest, powerReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
bool state = true;
sap->powerReq(token, state);
@@ -94,7 +94,7 @@ TEST_F(SapHidlTest, powerReq) {
* Test IRadio.resetSimReq() for the response returned.
*/
TEST_F(SapHidlTest, resetSimReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
sap->resetSimReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -110,7 +110,7 @@ TEST_F(SapHidlTest, resetSimReq) {
* Test IRadio.transferCardReaderStatusReq() for the response returned.
*/
TEST_F(SapHidlTest, transferCardReaderStatusReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
sap->transferCardReaderStatusReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -124,7 +124,7 @@ TEST_F(SapHidlTest, transferCardReaderStatusReq) {
* Test IRadio.setTransferProtocolReq() for the response returned.
*/
TEST_F(SapHidlTest, setTransferProtocolReq) {
int32_t token = GetRandomSerialNumber();
token = GetRandomSerialNumber();
SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0;
sap->setTransferProtocolReq(token, sapTransferProtocol);

View File

@@ -31,10 +31,12 @@ void SapHidlTest::SetUp() {
void SapHidlTest::TearDown() {}
void SapHidlTest::notify() {
void SapHidlTest::notify(int receivedToken) {
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
if (token == receivedToken) {
cv.notify_one();
}
}
std::cv_status SapHidlTest::wait() {

View File

@@ -107,7 +107,7 @@ class SapHidlTest : public ::testing::VtsHalHidlTargetTestBase {
virtual void TearDown() override;
/* Used as a mechanism to inform the test about data/event callback */
void notify();
void notify(int receivedToken);
/* Test code calls this function to wait for response */
std::cv_status wait();
@@ -117,4 +117,7 @@ class SapHidlTest : public ::testing::VtsHalHidlTargetTestBase {
/* Sap Callback object */
sp<SapCallback> sapCb;
/* Token for sap request */
int32_t token;
};

View File

@@ -21,18 +21,57 @@
* Test IRadio.setSimCardPower() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) {
int serial = GetRandomSerialNumber();
/* Record the sim card state for the testing environment */
CardState cardStateForTest = cardStatus.cardState;
/* Test setSimCardPower power down */
serial = GetRandomSerialNumber();
radio_v1_1->setSimCardPower_1_1(serial, CardPowerState::POWER_DOWN);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_1->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED,
RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE}));
/* Wait some time for setting sim power down and then verify it */
updateSimCardStatus();
auto startTime = std::chrono::system_clock::now();
while (cardStatus.cardState != CardState::ABSENT &&
std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() - startTime)
.count() < 80) {
/* Set 2 seconds as interval to check card status */
sleep(2);
updateSimCardStatus();
}
EXPECT_EQ(CardState::ABSENT, cardStatus.cardState);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(
CheckAnyOfErrors(radioRsp_v1_1->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED,
RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE}));
/* Test setSimCardPower power up */
serial = GetRandomSerialNumber();
radio_v1_1->setSimCardPower_1_1(serial, CardPowerState::POWER_UP);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_1->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED,
RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE}));
/**
* If the sim card status for the testing environment is PRESENT,
* verify if sim status is reset back.
*/
if (cardStateForTest == CardState::PRESENT) {
/* Wait some time for resetting back to sim power on and then verify it */
updateSimCardStatus();
startTime = std::chrono::system_clock::now();
while (cardStatus.cardState != CardState::PRESENT &&
std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
startTime)
.count() < 80) {
/* Set 2 seconds as interval to check card status */
sleep(2);
updateSimCardStatus();
}
EXPECT_EQ(CardState::PRESENT, cardStatus.cardState);
}
}
@@ -40,7 +79,7 @@ TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) {
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, startNetworkScan) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
NetworkScanRequest request;
request.type = ScanType::ONE_SHOT;
@@ -74,7 +113,7 @@ TEST_F(RadioHidlTest_v1_1, startNetworkScan) {
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
NetworkScanRequest request;
request.type = ScanType::ONE_SHOT;
@@ -98,7 +137,7 @@ TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) {
* Test IRadio.stopNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, stopNetworkScan) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio_v1_1->stopNetworkScan(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -117,7 +156,7 @@ TEST_F(RadioHidlTest_v1_1, stopNetworkScan) {
* Test IRadio.setCarrierInfoForImsiEncryption() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
ImsiEncryptionInfo imsiInfo;
imsiInfo.mcc = "310";
imsiInfo.mnc = "004";
@@ -222,7 +261,7 @@ TEST_F(RadioHidlTest_v1_1, startKeepalive) {
}};
for (auto req = requests.begin(); req != requests.end(); req++) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio_v1_1->startKeepalive(serial, *req);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
@@ -238,7 +277,7 @@ TEST_F(RadioHidlTest_v1_1, startKeepalive) {
* Test IRadio.stopKeepalive() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, stopKeepalive) {
int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
radio_v1_1->stopKeepalive(serial, 0xBAD);
EXPECT_EQ(std::cv_status::no_timeout, wait());

View File

@@ -42,22 +42,21 @@ void RadioHidlTest_v1_1::SetUp() {
radio_v1_1->setResponseFunctions(radioRsp_v1_1, radioInd_v1_1);
int serial = GetRandomSerialNumber();
radio_v1_1->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
updateSimCardStatus();
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_v1_1->rspInfo.error);
/* Vts Testing with Sim Absent only. This needs to be removed later in P when sim present
* scenarios will be tested. */
EXPECT_EQ(CardState::ABSENT, cardStatus.cardState);
/* Enforce Vts Testing with Sim Status Present only. */
EXPECT_EQ(CardState::PRESENT, cardStatus.cardState);
}
void RadioHidlTest_v1_1::notify() {
void RadioHidlTest_v1_1::notify(int receivedSerial) {
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
if (serial == receivedSerial) {
count++;
cv.notify_one();
}
}
std::cv_status RadioHidlTest_v1_1::wait(int sec) {
@@ -74,3 +73,9 @@ std::cv_status RadioHidlTest_v1_1::wait(int sec) {
count--;
return status;
}
void RadioHidlTest_v1_1::updateSimCardStatus() {
serial = GetRandomSerialNumber();
radio_v1_1->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
}

View File

@@ -558,11 +558,17 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase {
std::condition_variable cv;
int count;
/* Serial number for radio request */
int serial;
/* Update Sim Card Status */
void updateSimCardStatus();
public:
virtual void SetUp() override;
/* Used as a mechanism to inform the test about data/event callback */
void notify();
void notify(int receivedSerial);
/* Test code calls this function to wait for response */
std::cv_status wait(int sec = TIMEOUT_PERIOD);

View File

@@ -25,7 +25,7 @@ Return<void> RadioResponse_v1_1::getIccCardStatusResponse(const RadioResponseInf
const CardStatus& card_status) {
rspInfo = info;
cardStatus = card_status;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}
@@ -661,25 +661,25 @@ Return<void> RadioResponse_v1_1::acknowledgeRequest(int32_t /*serial*/) {
Return<void> RadioResponse_v1_1::setCarrierInfoForImsiEncryptionResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_1::setSimCardPowerResponse_1_1(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_1::startNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}
@@ -687,12 +687,12 @@ Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo&
const KeepaliveStatus& status) {
rspInfo = info;
keepaliveStatus = status;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
parent_v1_1.notify(info.serial);
return Void();
}

View File

@@ -23,7 +23,7 @@
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -51,7 +51,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan) {
* Test IRadio.startNetworkScan() with invalid specifier.
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
::android::hardware::radio::V1_2::NetworkScanRequest request = {.type = ScanType::ONE_SHOT,
.interval = 60};
@@ -77,7 +77,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) {
* Test IRadio.startNetworkScan() with invalid interval (lower boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -113,7 +113,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) {
* Test IRadio.startNetworkScan() with invalid interval (upper boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -149,7 +149,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) {
* Test IRadio.startNetworkScan() with invalid max search time (lower boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -185,7 +185,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) {
* Test IRadio.startNetworkScan() with invalid max search time (upper boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -221,7 +221,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) {
* Test IRadio.startNetworkScan() with invalid periodicity (lower boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -257,7 +257,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) {
* Test IRadio.startNetworkScan() with invalid periodicity (upper boundary).
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -293,7 +293,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) {
* Test IRadio.startNetworkScan() with valid periodicity
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -328,7 +328,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) {
* Test IRadio.startNetworkScan() with valid periodicity and plmns
*/
TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {
.radioAccessNetwork = RadioAccessNetworks::GERAN,
@@ -364,7 +364,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) {
* Test IRadio.setIndicationFilter_1_2()
*/
TEST_F(RadioHidlTest_v1_2, setIndicationFilter_1_2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setIndicationFilter_1_2(
serial, static_cast<int>(::android::hardware::radio::V1_2::IndicationFilter::ALL));
@@ -382,7 +382,7 @@ TEST_F(RadioHidlTest_v1_2, setIndicationFilter_1_2) {
* Test IRadio.setSignalStrengthReportingCriteria() with invalid hysteresisDb
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_invalidHysteresisDb) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000,
@@ -402,7 +402,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_invalidHysteresisD
* Test IRadio.setSignalStrengthReportingCriteria() with empty parameters
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_EmptyParams) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 0, 0, {}, ::android::hardware::radio::V1_2::AccessNetwork::GERAN);
@@ -420,7 +420,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_EmptyParams) {
* Test IRadio.setSignalStrengthReportingCriteria() for GERAN
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Geran) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-109, -103, -97, -89},
@@ -439,7 +439,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Geran) {
* Test IRadio.setSignalStrengthReportingCriteria() for UTRAN
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Utran) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-110, -97, -73, -49, -25},
@@ -458,7 +458,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Utran) {
* Test IRadio.setSignalStrengthReportingCriteria() for EUTRAN
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Eutran) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-140, -128, -118, -108, -98, -44},
@@ -477,7 +477,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Eutran) {
* Test IRadio.setSignalStrengthReportingCriteria() for CDMA2000
*/
TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Cdma2000) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria(
serial, 5000, 2, {-105, -90, -75, -65},
@@ -496,7 +496,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Cdma2000) {
* Test IRadio.setLinkCapacityReportingCriteria() invalid hysteresisDlKbps
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlKbps) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 5000,
@@ -517,7 +517,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlK
* Test IRadio.setLinkCapacityReportingCriteria() invalid hysteresisUlKbps
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlKbps) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 5000, 500,
@@ -538,7 +538,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlK
* Test IRadio.setLinkCapacityReportingCriteria() empty params
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 0, 0, 0, {}, {}, ::android::hardware::radio::V1_2::AccessNetwork::GERAN);
@@ -556,7 +556,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) {
* Test IRadio.setLinkCapacityReportingCriteria() GERAN
*/
TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria(
serial, 5000, 500, 100, {1000, 5000, 10000, 20000}, {500, 1000, 5000, 10000},
@@ -575,7 +575,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) {
* Test IRadio.setupDataCall_1_2() for the response returned.
*/
TEST_F(RadioHidlTest_v1_2, setupDataCall_1_2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
::android::hardware::radio::V1_2::AccessNetwork accessNetwork =
::android::hardware::radio::V1_2::AccessNetwork::EUTRAN;
@@ -635,7 +635,7 @@ TEST_F(RadioHidlTest_v1_2, setupDataCall_1_2) {
* Test IRadio.deactivateDataCall_1_2() for the response returned.
*/
TEST_F(RadioHidlTest_v1_2, deactivateDataCall_1_2) {
const int serial = GetRandomSerialNumber();
serial = GetRandomSerialNumber();
int cid = 1;
::android::hardware::radio::V1_2::DataRequestReason reason =
::android::hardware::radio::V1_2::DataRequestReason::NORMAL;

View File

@@ -42,21 +42,24 @@ void RadioHidlTest_v1_2::SetUp() {
radio_v1_2->setResponseFunctions(radioRsp_v1_2, radioInd_v1_2);
int serial = GetRandomSerialNumber();
radio_v1_2->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
updateSimCardStatus();
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_v1_2->rspInfo.error);
/* Enforce Vts Testing with Sim Status Present only. */
EXPECT_EQ(CardState::PRESENT, cardStatus.base.cardState);
}
/*
* Notify that the response message is received.
*/
void RadioHidlTest_v1_2::notify() {
void RadioHidlTest_v1_2::notify(int receivedSerial) {
std::unique_lock<std::mutex> lock(mtx_);
count_++;
cv_.notify_one();
if (serial == receivedSerial) {
count_++;
cv_.notify_one();
}
}
/*
@@ -75,4 +78,10 @@ std::cv_status RadioHidlTest_v1_2::wait() {
}
count_--;
return status;
}
void RadioHidlTest_v1_2::updateSimCardStatus() {
serial = GetRandomSerialNumber();
radio_v1_2->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
}

View File

@@ -613,11 +613,17 @@ class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase {
std::condition_variable cv_;
int count_;
/* Serial number for radio request */
int serial;
/* Update Sim Card Status */
void updateSimCardStatus();
public:
virtual void SetUp() override;
/* Used as a mechanism to inform the test about data/event callback */
void notify();
void notify(int receivedSerial);
/* Test code calls this function to wait for response */
std::cv_status wait();

View File

@@ -155,7 +155,7 @@ Return<void> RadioResponse_v1_2::sendSMSExpectMoreResponse(const RadioResponseIn
Return<void> RadioResponse_v1_2::setupDataCallResponse(const RadioResponseInfo& info,
const SetupDataCallResult& /*dcResponse*/) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -211,7 +211,7 @@ Return<void> RadioResponse_v1_2::acceptCallResponse(const RadioResponseInfo& /*i
Return<void> RadioResponse_v1_2::deactivateDataCallResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -320,7 +320,7 @@ Return<void> RadioResponse_v1_2::getAvailableBandModesResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<RadioBandMode>& bandModes) {
rspInfo = info;
radioBandModes = bandModes;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -677,13 +677,13 @@ Return<void> RadioResponse_v1_2::setSimCardPowerResponse_1_1(const RadioResponse
Return<void> RadioResponse_v1_2::startNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_2::stopNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -700,14 +700,14 @@ Return<void> RadioResponse_v1_2::stopKeepaliveResponse(const RadioResponseInfo&
Return<void> RadioResponse_v1_2::setSignalStrengthReportingCriteriaResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_2::setLinkCapacityReportingCriteriaResponse(
const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -716,7 +716,7 @@ Return<void> RadioResponse_v1_2::getIccCardStatusResponse_1_2(
const ::android::hardware::radio::V1_2::CardStatus& card_status) {
rspInfo = info;
cardStatus = card_status;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -724,7 +724,7 @@ Return<void> RadioResponse_v1_2::getCurrentCallsResponse_1_2(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& /*calls*/) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -732,7 +732,7 @@ Return<void> RadioResponse_v1_2::getSignalStrengthResponse_1_2(
const RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::SignalStrength& /*sig_strength*/) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}
@@ -740,7 +740,7 @@ Return<void> RadioResponse_v1_2::getCellInfoListResponse_1_2(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>& /*cellInfo*/) {
rspInfo = info;
parent_v1_2.notify();
parent_v1_2.notify(info.serial);
return Void();
}