• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <aidl/android/hardware/radio/config/IRadioConfig.h>
18 #include <aidl/android/hardware/radio/voice/EmergencyServiceCategory.h>
19 #include <android-base/logging.h>
20 #include <android/binder_manager.h>
21 
22 #include "radio_voice_utils.h"
23 
24 #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
25 
SetUp()26 void RadioVoiceTest::SetUp() {
27     std::string serviceName = GetParam();
28 
29     if (!isServiceValidForDeviceConfiguration(serviceName)) {
30         ALOGI("Skipped the test due to device configuration.");
31         GTEST_SKIP();
32     }
33 
34     radio_voice = IRadioVoice::fromBinder(
35             ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
36     ASSERT_NE(nullptr, radio_voice.get());
37 
38     radioRsp_voice = ndk::SharedRefBase::make<RadioVoiceResponse>(*this);
39     ASSERT_NE(nullptr, radioRsp_voice.get());
40 
41     count_ = 0;
42 
43     radioInd_voice = ndk::SharedRefBase::make<RadioVoiceIndication>(*this);
44     ASSERT_NE(nullptr, radioInd_voice.get());
45 
46     radio_voice->setResponseFunctions(radioRsp_voice, radioInd_voice);
47 
48     // Assert IRadioSim exists and SIM is present before testing
49     radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder(
50             AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1")));
51     ASSERT_NE(nullptr, radio_sim.get());
52     updateSimCardStatus();
53     EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState);
54 
55     // Assert IRadioConfig exists before testing
56     radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
57             AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
58     ASSERT_NE(nullptr, radio_config.get());
59 
60     if (isDsDsEnabled() || isTsTsEnabled()) {
61         radio_network = IRadioNetwork::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(
62                 "android.hardware.radio.network.IRadioNetwork/slot1")));
63         ASSERT_NE(nullptr, radio_network.get());
64         radioRsp_network = ndk::SharedRefBase::make<RadioNetworkResponse>(*this);
65         radioInd_network = ndk::SharedRefBase::make<RadioNetworkIndication>(*this);
66         radio_network->setResponseFunctions(radioRsp_network, radioInd_network);
67     }
68 }
69 
clearPotentialEstablishedCalls()70 ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() {
71     // Get the current call Id to hangup the established emergency call.
72     serial = GetRandomSerialNumber();
73     radio_voice->getCurrentCalls(serial);
74     EXPECT_EQ(std::cv_status::no_timeout, wait());
75 
76     // Hang up to disconnect the established call channels.
77     for (const Call& call : radioRsp_voice->currentCalls) {
78         serial = GetRandomSerialNumber();
79         radio_voice->hangup(serial, call.index);
80         ALOGI("Hang up to disconnect the established call channel: %d", call.index);
81         EXPECT_EQ(std::cv_status::no_timeout, wait());
82         // Give some time for modem to disconnect the established call channel.
83         sleep(MODEM_EMERGENCY_CALL_DISCONNECT_TIME);
84     }
85 
86     // Verify there are no more current calls.
87     serial = GetRandomSerialNumber();
88     radio_voice->getCurrentCalls(serial);
89     EXPECT_EQ(std::cv_status::no_timeout, wait());
90     EXPECT_EQ(0, radioRsp_voice->currentCalls.size());
91     return ndk::ScopedAStatus::ok();
92 }
93 
94 /*
95  * Test IRadioVoice.emergencyDial() for the response returned.
96  */
TEST_P(RadioVoiceTest,emergencyDial)97 TEST_P(RadioVoiceTest, emergencyDial) {
98     if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
99         ALOGI("Skipping emergencyDial because voice call is not supported in device");
100         return;
101     } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
102                !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
103         ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
104         return;
105     } else {
106         ALOGI("Running emergencyDial because voice call is supported in device");
107     }
108 
109     serial = GetRandomSerialNumber();
110 
111     Dial dialInfo;
112     dialInfo.address = std::string("911");
113     int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
114     std::vector<std::string> urns = {""};
115     EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
116 
117     ndk::ScopedAStatus res =
118             radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
119     ASSERT_OK(res);
120     EXPECT_EQ(std::cv_status::no_timeout, wait());
121     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
122     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
123 
124     ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_voice->rspInfo.error).c_str());
125 
126     RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
127     // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
128     // or Emergency_Only.
129     if (isDsDsEnabled() || isTsTsEnabled()) {
130         serial = GetRandomSerialNumber();
131         radio_network->getVoiceRegistrationState(serial);
132         EXPECT_EQ(std::cv_status::no_timeout, wait());
133         if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
134             isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
135             EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
136         }
137     } else {
138         EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
139     }
140 
141     // Give some time for modem to establish the emergency call channel.
142     sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
143 
144     // Disconnect all the potential established calls to prevent them affecting other tests.
145     clearPotentialEstablishedCalls();
146 }
147 
148 /*
149  * Test IRadioVoice.emergencyDial() with specified service and its response returned.
150  */
TEST_P(RadioVoiceTest,emergencyDial_withServices)151 TEST_P(RadioVoiceTest, emergencyDial_withServices) {
152     if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
153         ALOGI("Skipping emergencyDial because voice call is not supported in device");
154         return;
155     } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
156                !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
157         ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
158         return;
159     } else {
160         ALOGI("Running emergencyDial because voice call is supported in device");
161     }
162 
163     serial = GetRandomSerialNumber();
164 
165     Dial dialInfo;
166     dialInfo.address = std::string("911");
167     int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::AMBULANCE);
168     std::vector<std::string> urns = {"urn:service:sos.ambulance"};
169     EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
170 
171     ndk::ScopedAStatus res =
172             radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
173     ASSERT_OK(res);
174     EXPECT_EQ(std::cv_status::no_timeout, wait());
175     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
176     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
177 
178     ALOGI("emergencyDial_withServices, rspInfo.error = %s\n",
179           toString(radioRsp_voice->rspInfo.error).c_str());
180     RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
181 
182     // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
183     // or Emergency_Only.
184     if (isDsDsEnabled() || isTsTsEnabled()) {
185         serial = GetRandomSerialNumber();
186         radio_network->getVoiceRegistrationState(serial);
187         EXPECT_EQ(std::cv_status::no_timeout, wait());
188         if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
189             isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
190             EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
191         }
192     } else {
193         EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
194     }
195     // Give some time for modem to establish the emergency call channel.
196     sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
197 
198     // Disconnect all the potential established calls to prevent them affecting other tests.
199     clearPotentialEstablishedCalls();
200 }
201 
202 /*
203  * Test IRadioVoice.emergencyDial() with known emergency call routing and its response returned.
204  */
TEST_P(RadioVoiceTest,emergencyDial_withEmergencyRouting)205 TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) {
206     if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
207         ALOGI("Skipping emergencyDial because voice call is not supported in device");
208         return;
209     } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) &&
210                !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) {
211         ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device");
212         return;
213     } else {
214         ALOGI("Running emergencyDial because voice call is supported in device");
215     }
216 
217     serial = GetRandomSerialNumber();
218 
219     Dial dialInfo;
220     dialInfo.address = std::string("911");
221     int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
222     std::vector<std::string> urns = {""};
223     EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY;
224 
225     ndk::ScopedAStatus res =
226             radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
227     ASSERT_OK(res);
228     EXPECT_EQ(std::cv_status::no_timeout, wait());
229     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
230     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
231 
232     ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n",
233           toString(radioRsp_voice->rspInfo.error).c_str());
234     RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error;
235 
236     // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
237     // or Emergency_Only.
238     if (isDsDsEnabled() || isTsTsEnabled()) {
239         serial = GetRandomSerialNumber();
240         radio_network->getVoiceRegistrationState(serial);
241         EXPECT_EQ(std::cv_status::no_timeout, wait());
242         if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) ||
243             isVoiceInService(radioRsp_network->voiceRegResp.regState)) {
244             EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
245         }
246     } else {
247         EXPECT_EQ(RadioError::NONE, rspEmergencyDial);
248     }
249 
250     // Give some time for modem to establish the emergency call channel.
251     sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
252 
253     // Disconnect all the potential established calls to prevent them affecting other tests.
254     clearPotentialEstablishedCalls();
255 }
256 
257 /*
258  * Test IRadioVoice.getCurrentCalls() for the response returned.
259  */
TEST_P(RadioVoiceTest,getCurrentCalls)260 TEST_P(RadioVoiceTest, getCurrentCalls) {
261     serial = GetRandomSerialNumber();
262     radio_voice->getCurrentCalls(serial);
263     EXPECT_EQ(std::cv_status::no_timeout, wait());
264     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
265     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
266     EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
267 }
268 
269 /*
270  * Test IRadioVoice.getClir() for the response returned.
271  */
TEST_P(RadioVoiceTest,getClir)272 TEST_P(RadioVoiceTest, getClir) {
273     serial = GetRandomSerialNumber();
274 
275     radio_voice->getClir(serial);
276 
277     EXPECT_EQ(std::cv_status::no_timeout, wait());
278     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
279     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
280 
281     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
282         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR},
283                                      CHECK_GENERAL_ERROR));
284     }
285 }
286 
287 /*
288  * Test IRadioVoice.setClir() for the response returned.
289  */
TEST_P(RadioVoiceTest,setClir)290 TEST_P(RadioVoiceTest, setClir) {
291     serial = GetRandomSerialNumber();
292     int32_t status = 1;
293 
294     radio_voice->setClir(serial, status);
295 
296     EXPECT_EQ(std::cv_status::no_timeout, wait());
297     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
298     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
299 
300     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
301         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
302     }
303 }
304 
305 /*
306  * Test IRadioVoice.getClip() for the response returned.
307  */
TEST_P(RadioVoiceTest,getClip)308 TEST_P(RadioVoiceTest, getClip) {
309     serial = GetRandomSerialNumber();
310 
311     radio_voice->getClip(serial);
312 
313     EXPECT_EQ(std::cv_status::no_timeout, wait());
314     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
315     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
316 
317     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
318         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR},
319                                      CHECK_GENERAL_ERROR));
320     }
321 }
322 
323 /*
324  * Test IRadioVoice.getTtyMode() for the response returned.
325  */
TEST_P(RadioVoiceTest,getTtyMode)326 TEST_P(RadioVoiceTest, getTtyMode) {
327     LOG(DEBUG) << "getTtyMode";
328     serial = GetRandomSerialNumber();
329 
330     radio_voice->getTtyMode(serial);
331     EXPECT_EQ(std::cv_status::no_timeout, wait());
332     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
333     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
334 
335     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
336         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
337     }
338     LOG(DEBUG) << "getTtyMode finished";
339 }
340 
341 /*
342  * Test IRadioVoice.setTtyMode() for the response returned.
343  */
TEST_P(RadioVoiceTest,setTtyMode)344 TEST_P(RadioVoiceTest, setTtyMode) {
345     LOG(DEBUG) << "setTtyMode";
346     serial = GetRandomSerialNumber();
347 
348     radio_voice->setTtyMode(serial, TtyMode::OFF);
349     EXPECT_EQ(std::cv_status::no_timeout, wait());
350     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
351     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
352 
353     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
354         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
355     }
356     LOG(DEBUG) << "setTtyMode finished";
357 }
358 
359 /*
360  * Test IRadioVoice.setPreferredVoicePrivacy() for the response returned.
361  */
TEST_P(RadioVoiceTest,setPreferredVoicePrivacy)362 TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) {
363     LOG(DEBUG) << "setPreferredVoicePrivacy";
364     serial = GetRandomSerialNumber();
365 
366     radio_voice->setPreferredVoicePrivacy(serial, true);
367     EXPECT_EQ(std::cv_status::no_timeout, wait());
368     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
369     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
370 
371     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
372         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
373                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
374     }
375     LOG(DEBUG) << "setPreferredVoicePrivacy finished";
376 }
377 
378 /*
379  * Test IRadioVoice.getPreferredVoicePrivacy() for the response returned.
380  */
TEST_P(RadioVoiceTest,getPreferredVoicePrivacy)381 TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) {
382     LOG(DEBUG) << "getPreferredVoicePrivacy";
383     serial = GetRandomSerialNumber();
384 
385     radio_voice->getPreferredVoicePrivacy(serial);
386     EXPECT_EQ(std::cv_status::no_timeout, wait());
387     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
388     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
389 
390     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
391         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
392                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
393     }
394     LOG(DEBUG) << "getPreferredVoicePrivacy finished";
395 }
396 
397 /*
398  * Test IRadioVoice.exitEmergencyCallbackMode() for the response returned.
399  */
TEST_P(RadioVoiceTest,exitEmergencyCallbackMode)400 TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) {
401     LOG(DEBUG) << "exitEmergencyCallbackMode";
402     serial = GetRandomSerialNumber();
403 
404     radio_voice->exitEmergencyCallbackMode(serial);
405     EXPECT_EQ(std::cv_status::no_timeout, wait());
406     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
407     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
408 
409     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
410         ASSERT_TRUE(CheckAnyOfErrors(
411                 radioRsp_voice->rspInfo.error,
412                 {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
413     }
414     LOG(DEBUG) << "exitEmergencyCallbackMode finished";
415 }
416 
417 /*
418  * Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned.
419  */
TEST_P(RadioVoiceTest,handleStkCallSetupRequestFromSim)420 TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) {
421     LOG(DEBUG) << "handleStkCallSetupRequestFromSim";
422     serial = GetRandomSerialNumber();
423     bool accept = false;
424 
425     radio_voice->handleStkCallSetupRequestFromSim(serial, accept);
426 
427     EXPECT_EQ(std::cv_status::no_timeout, wait());
428     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
429     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
430 
431     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
432         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
433                                      {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
434                                       RadioError::MODEM_ERR, RadioError::SIM_ABSENT},
435                                      CHECK_GENERAL_ERROR));
436     }
437     LOG(DEBUG) << "handleStkCallSetupRequestFromSim finished";
438 }
439 
440 /*
441  * Test IRadioVoice.dial() for the response returned.
442  */
TEST_P(RadioVoiceTest,dial)443 TEST_P(RadioVoiceTest, dial) {
444     LOG(DEBUG) << "dial";
445     serial = GetRandomSerialNumber();
446 
447     Dial dialInfo;
448     memset(&dialInfo, 0, sizeof(dialInfo));
449     dialInfo.address = std::string("123456789");
450 
451     radio_voice->dial(serial, dialInfo);
452     EXPECT_EQ(std::cv_status::no_timeout, wait());
453     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
454     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
455 
456     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
457         ASSERT_TRUE(CheckAnyOfErrors(
458                 radioRsp_voice->rspInfo.error,
459                 {RadioError::CANCELLED, RadioError::DEVICE_IN_USE, RadioError::FDN_CHECK_FAILURE,
460                  RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
461                  RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
462                  RadioError::NO_NETWORK_FOUND, RadioError::NO_SUBSCRIPTION,
463                  RadioError::OPERATION_NOT_ALLOWED},
464                 CHECK_GENERAL_ERROR));
465     }
466     LOG(DEBUG) << "dial finished";
467 }
468 
469 /*
470  * Test IRadioVoice.hangup() for the response returned.
471  */
TEST_P(RadioVoiceTest,hangup)472 TEST_P(RadioVoiceTest, hangup) {
473     LOG(DEBUG) << "hangup";
474     serial = GetRandomSerialNumber();
475 
476     radio_voice->hangup(serial, 1);
477     EXPECT_EQ(std::cv_status::no_timeout, wait());
478     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
479     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
480 
481     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
482         ASSERT_TRUE(CheckAnyOfErrors(
483                 radioRsp_voice->rspInfo.error,
484                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
485                 CHECK_GENERAL_ERROR));
486     }
487     LOG(DEBUG) << "hangup finished";
488 }
489 
490 /*
491  * Test IRadioVoice.hangupWaitingOrBackground() for the response returned.
492  */
TEST_P(RadioVoiceTest,hangupWaitingOrBackground)493 TEST_P(RadioVoiceTest, hangupWaitingOrBackground) {
494     LOG(DEBUG) << "hangupWaitingOrBackground";
495     serial = GetRandomSerialNumber();
496 
497     radio_voice->hangupWaitingOrBackground(serial);
498     EXPECT_EQ(std::cv_status::no_timeout, wait());
499     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
500     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
501 
502     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
503         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
504                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
505                                      CHECK_GENERAL_ERROR));
506     }
507     LOG(DEBUG) << "hangupWaitingOrBackground finished";
508 }
509 
510 /*
511  * Test IRadioVoice.hangupForegroundResumeBackground() for the response returned.
512  */
TEST_P(RadioVoiceTest,hangupForegroundResumeBackground)513 TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) {
514     LOG(DEBUG) << "hangupForegroundResumeBackground";
515     serial = GetRandomSerialNumber();
516 
517     radio_voice->hangupForegroundResumeBackground(serial);
518     EXPECT_EQ(std::cv_status::no_timeout, wait());
519     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
520     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
521 
522     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
523         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
524                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
525                                      CHECK_GENERAL_ERROR));
526     }
527     LOG(DEBUG) << "hangupForegroundResumeBackground finished";
528 }
529 
530 /*
531  * Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned.
532  */
TEST_P(RadioVoiceTest,switchWaitingOrHoldingAndActive)533 TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) {
534     LOG(DEBUG) << "switchWaitingOrHoldingAndActive";
535     serial = GetRandomSerialNumber();
536 
537     radio_voice->switchWaitingOrHoldingAndActive(serial);
538     EXPECT_EQ(std::cv_status::no_timeout, wait());
539     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
540     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
541 
542     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
543         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
544                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
545                                      CHECK_GENERAL_ERROR));
546     }
547     LOG(DEBUG) << "switchWaitingOrHoldingAndActive finished";
548 }
549 
550 /*
551  * Test IRadioVoice.conference() for the response returned.
552  */
TEST_P(RadioVoiceTest,conference)553 TEST_P(RadioVoiceTest, conference) {
554     LOG(DEBUG) << "conference";
555     serial = GetRandomSerialNumber();
556 
557     radio_voice->conference(serial);
558     EXPECT_EQ(std::cv_status::no_timeout, wait());
559     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
560     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
561 
562     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
563         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
564                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
565                                      CHECK_GENERAL_ERROR));
566     }
567     LOG(DEBUG) << "conference finished";
568 }
569 
570 /*
571  * Test IRadioVoice.rejectCall() for the response returned.
572  */
TEST_P(RadioVoiceTest,rejectCall)573 TEST_P(RadioVoiceTest, rejectCall) {
574     LOG(DEBUG) << "rejectCall";
575     serial = GetRandomSerialNumber();
576 
577     radio_voice->rejectCall(serial);
578     EXPECT_EQ(std::cv_status::no_timeout, wait());
579     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
580     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
581 
582     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
583         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
584                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
585                                      CHECK_GENERAL_ERROR));
586     }
587     LOG(DEBUG) << "rejectCall finished";
588 }
589 
590 /*
591  * Test IRadioVoice.getLastCallFailCause() for the response returned.
592  */
TEST_P(RadioVoiceTest,getLastCallFailCause)593 TEST_P(RadioVoiceTest, getLastCallFailCause) {
594     LOG(DEBUG) << "getLastCallFailCause";
595     serial = GetRandomSerialNumber();
596 
597     radio_voice->getLastCallFailCause(serial);
598     EXPECT_EQ(std::cv_status::no_timeout, wait());
599     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
600     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
601 
602     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
603         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE},
604                                      CHECK_GENERAL_ERROR));
605     }
606     LOG(DEBUG) << "getLastCallFailCause finished";
607 }
608 
609 /*
610  * Test IRadioVoice.getCallForwardStatus() for the response returned.
611  */
TEST_P(RadioVoiceTest,getCallForwardStatus)612 TEST_P(RadioVoiceTest, getCallForwardStatus) {
613     LOG(DEBUG) << "getCallForwardStatus";
614     serial = GetRandomSerialNumber();
615     CallForwardInfo callInfo;
616     memset(&callInfo, 0, sizeof(callInfo));
617     callInfo.number = std::string();
618 
619     radio_voice->getCallForwardStatus(serial, callInfo);
620     EXPECT_EQ(std::cv_status::no_timeout, wait());
621     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
622     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
623 
624     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
625         ASSERT_TRUE(CheckAnyOfErrors(
626                 radioRsp_voice->rspInfo.error,
627                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
628                 CHECK_GENERAL_ERROR));
629     }
630     LOG(DEBUG) << "getCallForwardStatus finished";
631 }
632 
633 /*
634  * Test IRadioVoice.setCallForward() for the response returned.
635  */
TEST_P(RadioVoiceTest,setCallForward)636 TEST_P(RadioVoiceTest, setCallForward) {
637     LOG(DEBUG) << "setCallForward";
638     serial = GetRandomSerialNumber();
639     CallForwardInfo callInfo;
640     memset(&callInfo, 0, sizeof(callInfo));
641     callInfo.number = std::string();
642 
643     radio_voice->setCallForward(serial, callInfo);
644     EXPECT_EQ(std::cv_status::no_timeout, wait());
645     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
646     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
647 
648     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
649         ASSERT_TRUE(CheckAnyOfErrors(
650                 radioRsp_voice->rspInfo.error,
651                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
652                 CHECK_GENERAL_ERROR));
653     }
654     LOG(DEBUG) << "setCallForward finished";
655 }
656 
657 /*
658  * Test IRadioVoice.getCallWaiting() for the response returned.
659  */
TEST_P(RadioVoiceTest,getCallWaiting)660 TEST_P(RadioVoiceTest, getCallWaiting) {
661     LOG(DEBUG) << "getCallWaiting";
662     serial = GetRandomSerialNumber();
663 
664     radio_voice->getCallWaiting(serial, 1);
665     EXPECT_EQ(std::cv_status::no_timeout, wait());
666     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
667     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
668 
669     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
670         ASSERT_TRUE(CheckAnyOfErrors(
671                 radioRsp_voice->rspInfo.error,
672                 {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
673                 CHECK_GENERAL_ERROR));
674     }
675     LOG(DEBUG) << "getCallWaiting finished";
676 }
677 
678 /*
679  * Test IRadioVoice.setCallWaiting() for the response returned.
680  */
TEST_P(RadioVoiceTest,setCallWaiting)681 TEST_P(RadioVoiceTest, setCallWaiting) {
682     LOG(DEBUG) << "setCallWaiting";
683     serial = GetRandomSerialNumber();
684 
685     radio_voice->setCallWaiting(serial, true, 1);
686     EXPECT_EQ(std::cv_status::no_timeout, wait());
687     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
688     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
689 
690     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
691         ASSERT_TRUE(CheckAnyOfErrors(
692                 radioRsp_voice->rspInfo.error,
693                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
694                 CHECK_GENERAL_ERROR));
695     }
696     LOG(DEBUG) << "setCallWaiting finished";
697 }
698 
699 /*
700  * Test IRadioVoice.acceptCall() for the response returned.
701  */
TEST_P(RadioVoiceTest,acceptCall)702 TEST_P(RadioVoiceTest, acceptCall) {
703     LOG(DEBUG) << "acceptCall";
704     serial = GetRandomSerialNumber();
705 
706     radio_voice->acceptCall(serial);
707     EXPECT_EQ(std::cv_status::no_timeout, wait());
708     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
709     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
710 
711     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
712         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
713                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
714                                      CHECK_GENERAL_ERROR));
715     }
716     LOG(DEBUG) << "acceptCall finished";
717 }
718 
719 /*
720  * Test IRadioVoice.separateConnection() for the response returned.
721  */
TEST_P(RadioVoiceTest,separateConnection)722 TEST_P(RadioVoiceTest, separateConnection) {
723     LOG(DEBUG) << "separateConnection";
724     serial = GetRandomSerialNumber();
725 
726     radio_voice->separateConnection(serial, 1);
727     EXPECT_EQ(std::cv_status::no_timeout, wait());
728     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
729     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
730 
731     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
732         ASSERT_TRUE(CheckAnyOfErrors(
733                 radioRsp_voice->rspInfo.error,
734                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
735                 CHECK_GENERAL_ERROR));
736     }
737     LOG(DEBUG) << "separateConnection finished";
738 }
739 
740 /*
741  * Test IRadioVoice.explicitCallTransfer() for the response returned.
742  */
TEST_P(RadioVoiceTest,explicitCallTransfer)743 TEST_P(RadioVoiceTest, explicitCallTransfer) {
744     LOG(DEBUG) << "explicitCallTransfer";
745     serial = GetRandomSerialNumber();
746 
747     radio_voice->explicitCallTransfer(serial);
748     EXPECT_EQ(std::cv_status::no_timeout, wait());
749     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
750     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
751 
752     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
753         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
754                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
755                                      CHECK_GENERAL_ERROR));
756     }
757     LOG(DEBUG) << "explicitCallTransfer finished";
758 }
759 
760 /*
761  * Test IRadioVoice.sendCdmaFeatureCode() for the response returned.
762  */
TEST_P(RadioVoiceTest,sendCdmaFeatureCode)763 TEST_P(RadioVoiceTest, sendCdmaFeatureCode) {
764     LOG(DEBUG) << "sendCdmaFeatureCode";
765     serial = GetRandomSerialNumber();
766 
767     radio_voice->sendCdmaFeatureCode(serial, std::string());
768     EXPECT_EQ(std::cv_status::no_timeout, wait());
769     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
770     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
771 
772     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
773         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
774                                      {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
775                                       RadioError::INVALID_CALL_ID, RadioError::INVALID_MODEM_STATE,
776                                       RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
777                                      CHECK_GENERAL_ERROR));
778     }
779     LOG(DEBUG) << "sendCdmaFeatureCode finished";
780 }
781 
782 /*
783  * Test IRadioVoice.sendDtmf() for the response returned.
784  */
TEST_P(RadioVoiceTest,sendDtmf)785 TEST_P(RadioVoiceTest, sendDtmf) {
786     LOG(DEBUG) << "sendDtmf";
787     serial = GetRandomSerialNumber();
788 
789     radio_voice->sendDtmf(serial, "1");
790     EXPECT_EQ(std::cv_status::no_timeout, wait());
791     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
792     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
793 
794     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
795         ASSERT_TRUE(CheckAnyOfErrors(
796                 radioRsp_voice->rspInfo.error,
797                 {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
798                  RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
799                 CHECK_GENERAL_ERROR));
800     }
801     LOG(DEBUG) << "sendDtmf finished";
802 }
803 
804 /*
805  * Test IRadioVoice.startDtmf() for the response returned.
806  */
TEST_P(RadioVoiceTest,startDtmf)807 TEST_P(RadioVoiceTest, startDtmf) {
808     LOG(DEBUG) << "startDtmf";
809     serial = GetRandomSerialNumber();
810 
811     radio_voice->startDtmf(serial, "1");
812     EXPECT_EQ(std::cv_status::no_timeout, wait());
813     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
814     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
815 
816     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
817         ASSERT_TRUE(CheckAnyOfErrors(
818                 radioRsp_voice->rspInfo.error,
819                 {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
820                  RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
821                 CHECK_GENERAL_ERROR));
822     }
823     LOG(DEBUG) << "startDtmf finished";
824 }
825 
826 /*
827  * Test IRadioVoice.stopDtmf() for the response returned.
828  */
TEST_P(RadioVoiceTest,stopDtmf)829 TEST_P(RadioVoiceTest, stopDtmf) {
830     LOG(DEBUG) << "stopDtmf";
831     serial = GetRandomSerialNumber();
832 
833     radio_voice->stopDtmf(serial);
834     EXPECT_EQ(std::cv_status::no_timeout, wait());
835     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
836     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
837 
838     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
839         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
840                                      {RadioError::NONE, RadioError::INVALID_CALL_ID,
841                                       RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
842                                      CHECK_GENERAL_ERROR));
843     }
844     LOG(DEBUG) << "stopDtmf finished";
845 }
846 
847 /*
848  * Test IRadioVoice.setMute() for the response returned.
849  */
TEST_P(RadioVoiceTest,setMute)850 TEST_P(RadioVoiceTest, setMute) {
851     LOG(DEBUG) << "setMute";
852     serial = GetRandomSerialNumber();
853 
854     radio_voice->setMute(serial, true);
855     EXPECT_EQ(std::cv_status::no_timeout, wait());
856     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
857     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
858 
859     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
860         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
861                                      {RadioError::NONE, RadioError::INVALID_ARGUMENTS},
862                                      CHECK_GENERAL_ERROR));
863     }
864     LOG(DEBUG) << "setMute finished";
865 }
866 
867 /*
868  * Test IRadioVoice.getMute() for the response returned.
869  */
TEST_P(RadioVoiceTest,getMute)870 TEST_P(RadioVoiceTest, getMute) {
871     LOG(DEBUG) << "getMute";
872     serial = GetRandomSerialNumber();
873 
874     radio_voice->getMute(serial);
875     EXPECT_EQ(std::cv_status::no_timeout, wait());
876     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
877     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
878 
879     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
880         EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error);
881     }
882     LOG(DEBUG) << "getMute finished";
883 }
884 
885 /*
886  * Test IRadioVoice.sendBurstDtmf() for the response returned.
887  */
TEST_P(RadioVoiceTest,sendBurstDtmf)888 TEST_P(RadioVoiceTest, sendBurstDtmf) {
889     LOG(DEBUG) << "sendBurstDtmf";
890     serial = GetRandomSerialNumber();
891 
892     radio_voice->sendBurstDtmf(serial, "1", 0, 0);
893     EXPECT_EQ(std::cv_status::no_timeout, wait());
894     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
895     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
896 
897     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
898         ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
899                                      {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
900                                       RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
901                                      CHECK_GENERAL_ERROR));
902     }
903     LOG(DEBUG) << "sendBurstDtmf finished";
904 }
905 
906 /*
907  * Test IRadioVoice.sendUssd() for the response returned.
908  */
TEST_P(RadioVoiceTest,sendUssd)909 TEST_P(RadioVoiceTest, sendUssd) {
910     LOG(DEBUG) << "sendUssd";
911     serial = GetRandomSerialNumber();
912     radio_voice->sendUssd(serial, std::string("test"));
913     EXPECT_EQ(std::cv_status::no_timeout, wait());
914     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
915     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
916 
917     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
918         ASSERT_TRUE(CheckAnyOfErrors(
919                 radioRsp_voice->rspInfo.error,
920                 {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
921                 CHECK_GENERAL_ERROR));
922     }
923     LOG(DEBUG) << "sendUssd finished";
924 }
925 
926 /*
927  * Test IRadioVoice.cancelPendingUssd() for the response returned.
928  */
TEST_P(RadioVoiceTest,cancelPendingUssd)929 TEST_P(RadioVoiceTest, cancelPendingUssd) {
930     LOG(DEBUG) << "cancelPendingUssd";
931     serial = GetRandomSerialNumber();
932 
933     radio_voice->cancelPendingUssd(serial);
934     EXPECT_EQ(std::cv_status::no_timeout, wait());
935     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
936     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
937 
938     if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
939         ASSERT_TRUE(CheckAnyOfErrors(
940                 radioRsp_voice->rspInfo.error,
941                 {RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
942                 CHECK_GENERAL_ERROR));
943     }
944     LOG(DEBUG) << "cancelPendingUssd finished";
945 }
946 
947 /*
948  * Test IRadioVoice.isVoNrEnabled() for the response returned.
949  */
TEST_P(RadioVoiceTest,isVoNrEnabled)950 TEST_P(RadioVoiceTest, isVoNrEnabled) {
951     LOG(DEBUG) << "isVoNrEnabled";
952     serial = GetRandomSerialNumber();
953 
954     radio_voice->isVoNrEnabled(serial);
955     EXPECT_EQ(std::cv_status::no_timeout, wait());
956     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
957     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
958 
959     ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
960                                  {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
961     LOG(DEBUG) << "isVoNrEnabled finished";
962 }
963 
964 /*
965  * Test IRadioVoice.setVoNrEnabled() for the response returned.
966  */
TEST_P(RadioVoiceTest,setVoNrEnabled)967 TEST_P(RadioVoiceTest, setVoNrEnabled) {
968     LOG(DEBUG) << "setVoNrEnabled";
969     serial = GetRandomSerialNumber();
970 
971     radio_voice->setVoNrEnabled(serial, true);
972     EXPECT_EQ(std::cv_status::no_timeout, wait());
973     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type);
974     EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial);
975 
976     ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error,
977                                  {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE}));
978     LOG(DEBUG) << "setVoNrEnabled finished";
979 }
980