Waiting 10s at the beginning of getBarringInfo test if not yet in-service.

If the previous setRadioPower_1_5_emergencyCall_cancelled test has just finished. Due to radio restarting, modem may need a little more time to acquire network service. Otherwise, the barring info will be empty.

Bug: 191866257
Test: atest VtsHalRadioV1_5TargetTest

Change-Id: I9ae4e7a07b9f47353554ffb63a23b6518aa344b7
Merged-In: I9ae4e7a07b9f47353554ffb63a23b6518aa344b7
This commit is contained in:
Aaron Tsai 2021-07-13 15:15:22 +08:00
parent 572e6cb3d5
commit 772801bf8a
3 changed files with 19 additions and 2 deletions

View file

@ -1251,8 +1251,20 @@ TEST_P(RadioHidlTest_v1_5, sendCdmaSmsExpectMore) {
* Test IRadio.getBarringInfo() for the response returned.
*/
TEST_P(RadioHidlTest_v1_5, getBarringInfo) {
// If the previous setRadioPower_1_5_emergencyCall_cancelled test has just finished.
// Due to radio restarting, modem may need a little more time to acquire network service
// and barring infos. If voice status is in-service, waiting 3s to get barring infos ready.
// Or waiting 10s if voice status is not in-service.
serial = GetRandomSerialNumber();
radio_v1_5->getVoiceRegistrationState_1_5(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
if (isVoiceInService(radioRsp_v1_5->voiceRegResp.regState)) {
sleep(BARRING_INFO_MAX_WAIT_TIME_SECONDS);
} else {
sleep(VOICE_SERVICE_MAX_WAIT_TIME_SECONDS);
}
serial = GetRandomSerialNumber();
Return<void> res = radio_v1_5->getBarringInfo(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);

View file

@ -51,6 +51,8 @@ using ::android::hardware::Void;
#define TIMEOUT_PERIOD 75
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define VOICE_SERVICE_MAX_WAIT_TIME_SECONDS 10
#define BARRING_INFO_MAX_WAIT_TIME_SECONDS 3
#define RADIO_SERVICE_NAME "slot1"
@ -69,6 +71,7 @@ class RadioResponse_v1_5 : public ::android::hardware::radio::V1_5::IRadioRespon
// Call
hidl_vec<::android::hardware::radio::V1_2::Call> currentCalls;
::android::hardware::radio::V1_2::VoiceRegStateResult voiceRegResp;
// Modem
bool isModemEnabled;

View file

@ -763,8 +763,9 @@ Return<void> RadioResponse_v1_5::getCellInfoListResponse_1_2(
Return<void> RadioResponse_v1_5::getVoiceRegistrationStateResponse_1_2(
const RadioResponseInfo& info,
const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) {
const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse) {
rspInfo = info;
voiceRegResp = voiceRegResponse;
parent_v1_5.notify(info.serial);
return Void();
}
@ -989,8 +990,9 @@ Return<void> RadioResponse_v1_5::getBarringInfoResponse(
Return<void> RadioResponse_v1_5::getVoiceRegistrationStateResponse_1_5(
const RadioResponseInfo& info,
const ::android::hardware::radio::V1_5::RegStateResult& /*regResponse*/) {
const ::android::hardware::radio::V1_5::RegStateResult& regResponse) {
rspInfo = info;
voiceRegResp.regState = regResponse.regState;
parent_v1_5.notify(info.serial);
return Void();
}