From 772801bf8a3021d9ac4299bd0093e38846b60633 Mon Sep 17 00:00:00 2001 From: Aaron Tsai Date: Tue, 13 Jul 2021 15:15:22 +0800 Subject: [PATCH] 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 --- radio/1.5/vts/functional/radio_hidl_hal_api.cpp | 12 ++++++++++++ radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h | 3 +++ radio/1.5/vts/functional/radio_response.cpp | 6 ++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp index 0b49b36927..d108951c0e 100644 --- a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp @@ -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 res = radio_v1_5->getBarringInfo(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type); diff --git a/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h b/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h index 87ce675c5c..65442caff1 100644 --- a/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h +++ b/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h @@ -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; diff --git a/radio/1.5/vts/functional/radio_response.cpp b/radio/1.5/vts/functional/radio_response.cpp index 9b6d450e83..3d6fc17f5b 100644 --- a/radio/1.5/vts/functional/radio_response.cpp +++ b/radio/1.5/vts/functional/radio_response.cpp @@ -763,8 +763,9 @@ Return RadioResponse_v1_5::getCellInfoListResponse_1_2( Return 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 RadioResponse_v1_5::getBarringInfoResponse( Return 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(); }