From 2b4c6387d32dd51bacb596197b487b447b262040 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 8 May 2024 23:26:49 +0000 Subject: [PATCH] Fix test of triggerEmergencyNetworkScan triggerEmergencyNetworkScan needs to be triggered after setEmergencyMode. Bug: 336706719 Test: atest VtsHalRadioTargetTest:PerInstance/RadioNetworkTest#triggerEmergencyNetworkScan/0_android_hardware_radio_network_IRadioNetwork_slot1 -- --abi arm64-v8a (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:df7692133547c051389a7eda5a134f8e82dfa163) Merged-In: If32d594525bea3a4a4562e2b1070ef646744513f Change-Id: If32d594525bea3a4a4562e2b1070ef646744513f --- radio/aidl/vts/radio_network_test.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index df3fb1e8a8..7e0ebe8acf 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1777,6 +1777,18 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { serial = GetRandomSerialNumber(); + radio_network->setEmergencyMode(serial, EmergencyMode::EMERGENCY_WWAN); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + + serial = GetRandomSerialNumber(); + EmergencyNetworkScanTrigger scanRequest; scanRequest.accessNetwork = {AccessNetwork::EUTRAN}; scanRequest.scanType = EmergencyScanType::NO_PREFERENCE; @@ -1790,6 +1802,19 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + + // exit emergency mode for other tests + serial = GetRandomSerialNumber(); + + radio_network->exitEmergencyMode(serial); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); } /*