• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 <android-base/logging.h>
18 #include <android/hardware/radio/1.2/IRadio.h>
19 #include <radio_hidl_hal_utils_v1_0.h>
20 
21 /*
22  * Test IRadio.getSignalStrength() for the response returned.
23  */
TEST_P(RadioHidlTest,getSignalStrength)24 TEST_P(RadioHidlTest, getSignalStrength) {
25     LOG(DEBUG) << "getSignalStrength";
26     serial = GetRandomSerialNumber();
27 
28     radio->getSignalStrength(serial);
29     EXPECT_EQ(std::cv_status::no_timeout, wait());
30     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
31     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
32 
33     if (cardStatus.cardState == CardState::ABSENT) {
34         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
35     }
36     LOG(DEBUG) << "getSignalStrength finished";
37 }
38 
39 /*
40  * Test IRadio.getVoiceRegistrationState() for the response returned.
41  */
TEST_P(RadioHidlTest,getVoiceRegistrationState)42 TEST_P(RadioHidlTest, getVoiceRegistrationState) {
43     LOG(DEBUG) << "getVoiceRegistrationState";
44     serial = GetRandomSerialNumber();
45 
46     radio->getVoiceRegistrationState(serial);
47     EXPECT_EQ(std::cv_status::no_timeout, wait());
48     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
49     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
50 
51     if (cardStatus.cardState == CardState::ABSENT) {
52         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
53     }
54     LOG(DEBUG) << "getVoiceRegistrationState finished";
55 }
56 
57 /*
58  * Test IRadio.getOperator() for the response returned.
59  */
TEST_P(RadioHidlTest,getOperator)60 TEST_P(RadioHidlTest, getOperator) {
61     LOG(DEBUG) << "getOperator";
62     serial = GetRandomSerialNumber();
63 
64     radio->getOperator(serial);
65     EXPECT_EQ(std::cv_status::no_timeout, wait());
66     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
67     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
68 
69     if (cardStatus.cardState == CardState::ABSENT) {
70         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
71     }
72     LOG(DEBUG) << "getOperator finished";
73 }
74 
75 /*
76  * Test IRadio.setRadioPower() for the response returned.
77  */
TEST_P(RadioHidlTest,setRadioPower)78 TEST_P(RadioHidlTest, setRadioPower) {
79     LOG(DEBUG) << "setRadioPower";
80     serial = GetRandomSerialNumber();
81 
82     radio->setRadioPower(serial, 1);
83     EXPECT_EQ(std::cv_status::no_timeout, wait());
84     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
85     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
86 
87     if (cardStatus.cardState == CardState::ABSENT) {
88         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
89     }
90     LOG(DEBUG) << "setRadioPower finished";
91 }
92 
93 /*
94  * Test IRadio.getNetworkSelectionMode() for the response returned.
95  */
TEST_P(RadioHidlTest,getNetworkSelectionMode)96 TEST_P(RadioHidlTest, getNetworkSelectionMode) {
97     LOG(DEBUG) << "getNetworkSelectionMode";
98     serial = GetRandomSerialNumber();
99 
100     radio->getNetworkSelectionMode(serial);
101     EXPECT_EQ(std::cv_status::no_timeout, wait());
102     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
103     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
104 
105     if (cardStatus.cardState == CardState::ABSENT) {
106         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
107     }
108     LOG(DEBUG) << "getNetworkSelectionMode finished";
109 }
110 
111 /*
112  * Test IRadio.setNetworkSelectionModeAutomatic() for the response returned.
113  */
TEST_P(RadioHidlTest,setNetworkSelectionModeAutomatic)114 TEST_P(RadioHidlTest, setNetworkSelectionModeAutomatic) {
115     LOG(DEBUG) << "setNetworkSelectionModeAutomatic";
116     serial = GetRandomSerialNumber();
117 
118     radio->setNetworkSelectionModeAutomatic(serial);
119     EXPECT_EQ(std::cv_status::no_timeout, wait());
120     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
121     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
122 
123     if (cardStatus.cardState == CardState::ABSENT) {
124         ASSERT_TRUE(CheckAnyOfErrors(
125             radioRsp->rspInfo.error,
126             {RadioError::NONE, RadioError::ILLEGAL_SIM_OR_ME, RadioError::OPERATION_NOT_ALLOWED},
127             CHECK_GENERAL_ERROR));
128     }
129     LOG(DEBUG) << "setNetworkSelectionModeAutomatic finished";
130 }
131 
132 /*
133  * Test IRadio.setNetworkSelectionModeManual() for the response returned.
134  */
TEST_P(RadioHidlTest,setNetworkSelectionModeManual)135 TEST_P(RadioHidlTest, setNetworkSelectionModeManual) {
136     LOG(DEBUG) << "setNetworkSelectionModeManual";
137     serial = GetRandomSerialNumber();
138 
139     radio->setNetworkSelectionModeManual(serial, "123456");
140     EXPECT_EQ(std::cv_status::no_timeout, wait());
141     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
142     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
143 
144     if (cardStatus.cardState == CardState::ABSENT) {
145         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
146                                      {RadioError::NONE, RadioError::ILLEGAL_SIM_OR_ME,
147                                       RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
148                                      CHECK_GENERAL_ERROR));
149     }
150     LOG(DEBUG) << "setNetworkSelectionModeManual finished";
151 }
152 
153 /*
154  * Test IRadio.getAvailableNetworks() for the response returned.
155  */
TEST_P(RadioHidlTest,getAvailableNetworks)156 TEST_P(RadioHidlTest, getAvailableNetworks) {
157     LOG(DEBUG) << "getAvailableNetworks";
158     serial = GetRandomSerialNumber();
159 
160     radio->getAvailableNetworks(serial);
161     EXPECT_EQ(std::cv_status::no_timeout, wait(300));
162     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
163     ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
164                 radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
165 
166     if (cardStatus.cardState == CardState::ABSENT) {
167         ASSERT_TRUE(
168             CheckAnyOfErrors(radioRsp->rspInfo.error,
169                              {RadioError::NONE, RadioError::CANCELLED, RadioError::DEVICE_IN_USE,
170                               RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
171                              CHECK_GENERAL_ERROR));
172   }
173   LOG(DEBUG) << "getAvailableNetworks finished";
174 }
175 
176 /*
177  * Test IRadio.getBasebandVersion() for the response returned.
178  */
TEST_P(RadioHidlTest,getBasebandVersion)179 TEST_P(RadioHidlTest, getBasebandVersion) {
180     LOG(DEBUG) << "getBasebandVersion";
181     serial = GetRandomSerialNumber();
182 
183     radio->getBasebandVersion(serial);
184     EXPECT_EQ(std::cv_status::no_timeout, wait());
185     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
186     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
187 
188     if (cardStatus.cardState == CardState::ABSENT) {
189         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
190     }
191     LOG(DEBUG) << "getBasebandVersion finished";
192 }
193 
194 /*
195  * Test IRadio.setBandMode() for the response returned.
196  */
TEST_P(RadioHidlTest,setBandMode)197 TEST_P(RadioHidlTest, setBandMode) {
198     LOG(DEBUG) << "setBandMode";
199     serial = GetRandomSerialNumber();
200 
201     radio->setBandMode(serial, RadioBandMode::BAND_MODE_USA);
202     EXPECT_EQ(std::cv_status::no_timeout, wait());
203     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
204     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
205 
206     if (cardStatus.cardState == CardState::ABSENT) {
207         ASSERT_TRUE(
208             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
209     }
210     LOG(DEBUG) << "setBandMode finished";
211 }
212 
213 /*
214  * Test IRadio.getAvailableBandModes() for the response returned.
215  */
TEST_P(RadioHidlTest,getAvailableBandModes)216 TEST_P(RadioHidlTest, getAvailableBandModes) {
217     LOG(DEBUG) << "getAvailableBandModes";
218     serial = GetRandomSerialNumber();
219 
220     radio->getAvailableBandModes(serial);
221     EXPECT_EQ(std::cv_status::no_timeout, wait());
222     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
223     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
224 
225     if (cardStatus.cardState == CardState::ABSENT) {
226         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
227     }
228     LOG(DEBUG) << "getAvailableBandModes finished";
229 }
230 
231 /*
232  * Test IRadio.setPreferredNetworkType() for the response returned.
233  */
TEST_P(RadioHidlTest,setPreferredNetworkType)234 TEST_P(RadioHidlTest, setPreferredNetworkType) {
235     LOG(DEBUG) << "setPreferredNetworkType";
236     serial = GetRandomSerialNumber();
237 
238     radio->setPreferredNetworkType(serial, PreferredNetworkType::GSM_ONLY);
239     EXPECT_EQ(std::cv_status::no_timeout, wait());
240     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
241     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
242 
243     if (cardStatus.cardState == CardState::ABSENT) {
244         ASSERT_TRUE(
245             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
246     }
247     LOG(DEBUG) << "setPreferredNetworkType finished";
248 }
249 
250 /*
251  * Test IRadio.getPreferredNetworkType() for the response returned.
252  */
TEST_P(RadioHidlTest,getPreferredNetworkType)253 TEST_P(RadioHidlTest, getPreferredNetworkType) {
254     LOG(DEBUG) << "getPreferredNetworkType";
255     serial = GetRandomSerialNumber();
256 
257     radio->getPreferredNetworkType(serial);
258     EXPECT_EQ(std::cv_status::no_timeout, wait());
259     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
260     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
261 
262     if (cardStatus.cardState == CardState::ABSENT) {
263         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
264     }
265     LOG(DEBUG) << "getPreferredNetworkType finished";
266 }
267 
268 /*
269  * Test IRadio.getNeighboringCids() for the response returned.
270  */
TEST_P(RadioHidlTest,getNeighboringCids)271 TEST_P(RadioHidlTest, getNeighboringCids) {
272     LOG(DEBUG) << "getNeighboringCids";
273     serial = GetRandomSerialNumber();
274 
275     radio->getNeighboringCids(serial);
276     EXPECT_EQ(std::cv_status::no_timeout, wait());
277     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
278     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
279 
280     if (cardStatus.cardState == CardState::ABSENT) {
281         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
282                                      {RadioError::NONE, RadioError::SIM_ABSENT},
283                                      CHECK_GENERAL_ERROR));
284     }
285     LOG(DEBUG) << "getNeighboringCids finished";
286 }
287 
288 /*
289  * Test IRadio.setLocationUpdates() for the response returned.
290  */
TEST_P(RadioHidlTest,setLocationUpdates)291 TEST_P(RadioHidlTest, setLocationUpdates) {
292     LOG(DEBUG) << "setLocationUpdates";
293     serial = GetRandomSerialNumber();
294 
295     radio->setLocationUpdates(serial, true);
296     EXPECT_EQ(std::cv_status::no_timeout, wait());
297     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
298     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
299 
300     if (cardStatus.cardState == CardState::ABSENT) {
301         ASSERT_TRUE(
302             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT}));
303     }
304     LOG(DEBUG) << "setLocationUpdates finished";
305 }
306 
307 /*
308  * Test IRadio.setCdmaRoamingPreference() for the response returned.
309  */
TEST_P(RadioHidlTest,setCdmaRoamingPreference)310 TEST_P(RadioHidlTest, setCdmaRoamingPreference) {
311     LOG(DEBUG) << "setCdmaRoamingPreference";
312     serial = GetRandomSerialNumber();
313 
314     radio->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK);
315     EXPECT_EQ(std::cv_status::no_timeout, wait());
316     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
317     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
318 
319     if (cardStatus.cardState == CardState::ABSENT) {
320         ASSERT_TRUE(CheckAnyOfErrors(
321             radioRsp->rspInfo.error,
322             {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::REQUEST_NOT_SUPPORTED}));
323     }
324     LOG(DEBUG) << "setCdmaRoamingPreference finished";
325 }
326 
327 /*
328  * Test IRadio.getCdmaRoamingPreference() for the response returned.
329  */
TEST_P(RadioHidlTest,getCdmaRoamingPreference)330 TEST_P(RadioHidlTest, getCdmaRoamingPreference) {
331     LOG(DEBUG) << "getCdmaRoamingPreference";
332     serial = GetRandomSerialNumber();
333 
334     radio->getCdmaRoamingPreference(serial);
335     EXPECT_EQ(std::cv_status::no_timeout, wait());
336     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
337     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
338 
339     if (cardStatus.cardState == CardState::ABSENT) {
340         ASSERT_TRUE(
341             CheckAnyOfErrors(radioRsp->rspInfo.error,
342                              {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::MODEM_ERR},
343                              CHECK_GENERAL_ERROR));
344     }
345     LOG(DEBUG) << "getCdmaRoamingPreference finished";
346 }
347 
348 /*
349  * Test IRadio.getTTYMode() for the response returned.
350  */
TEST_P(RadioHidlTest,getTTYMode)351 TEST_P(RadioHidlTest, getTTYMode) {
352     LOG(DEBUG) << "getTTYMode";
353     serial = GetRandomSerialNumber();
354 
355     radio->getTTYMode(serial);
356     EXPECT_EQ(std::cv_status::no_timeout, wait());
357     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
358     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
359 
360     if (cardStatus.cardState == CardState::ABSENT) {
361         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
362     }
363     LOG(DEBUG) << "getTTYMode finished";
364 }
365 
366 /*
367  * Test IRadio.setTTYMode() for the response returned.
368  */
TEST_P(RadioHidlTest,setTTYMode)369 TEST_P(RadioHidlTest, setTTYMode) {
370     LOG(DEBUG) << "setTTYMode";
371     serial = GetRandomSerialNumber();
372 
373     radio->setTTYMode(serial, TtyMode::OFF);
374     EXPECT_EQ(std::cv_status::no_timeout, wait());
375     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
376     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
377 
378     if (cardStatus.cardState == CardState::ABSENT) {
379         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
380     }
381     LOG(DEBUG) << "setTTYMode finished";
382 }
383 
384 /*
385  * Test IRadio.setPreferredVoicePrivacy() for the response returned.
386  */
TEST_P(RadioHidlTest,setPreferredVoicePrivacy)387 TEST_P(RadioHidlTest, setPreferredVoicePrivacy) {
388     LOG(DEBUG) << "setPreferredVoicePrivacy";
389     serial = GetRandomSerialNumber();
390 
391     radio->setPreferredVoicePrivacy(serial, true);
392     EXPECT_EQ(std::cv_status::no_timeout, wait());
393     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
394     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
395 
396     if (cardStatus.cardState == CardState::ABSENT) {
397         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
398                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
399     }
400     LOG(DEBUG) << "setPreferredVoicePrivacy finished";
401 }
402 
403 /*
404  * Test IRadio.getPreferredVoicePrivacy() for the response returned.
405  */
TEST_P(RadioHidlTest,getPreferredVoicePrivacy)406 TEST_P(RadioHidlTest, getPreferredVoicePrivacy) {
407     LOG(DEBUG) << "getPreferredVoicePrivacy";
408     serial = GetRandomSerialNumber();
409 
410     radio->getPreferredVoicePrivacy(serial);
411     EXPECT_EQ(std::cv_status::no_timeout, wait());
412     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
413     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
414 
415     if (cardStatus.cardState == CardState::ABSENT) {
416         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
417                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
418     }
419     LOG(DEBUG) << "getPreferredVoicePrivacy finished";
420 }
421 
422 /*
423  * Test IRadio.getCDMASubscription() for the response returned.
424  */
TEST_P(RadioHidlTest,getCDMASubscription)425 TEST_P(RadioHidlTest, getCDMASubscription) {
426     LOG(DEBUG) << "getCDMASubscription";
427     serial = GetRandomSerialNumber();
428 
429     radio->getCDMASubscription(serial);
430     EXPECT_EQ(std::cv_status::no_timeout, wait());
431     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
432     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
433 
434     if (cardStatus.cardState == CardState::ABSENT) {
435         ASSERT_TRUE(CheckAnyOfErrors(
436             radioRsp->rspInfo.error,
437             {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
438     }
439     LOG(DEBUG) << "getCDMASubscription finished";
440 }
441 
442 /*
443  * Test IRadio.getDeviceIdentity() for the response returned.
444  */
TEST_P(RadioHidlTest,getDeviceIdentity)445 TEST_P(RadioHidlTest, getDeviceIdentity) {
446     LOG(DEBUG) << "getDeviceIdentity";
447     serial = GetRandomSerialNumber();
448 
449     radio->getDeviceIdentity(serial);
450     EXPECT_EQ(std::cv_status::no_timeout, wait());
451     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
452     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
453 
454     if (cardStatus.cardState == CardState::ABSENT) {
455         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
456                                      {RadioError::NONE, RadioError::EMPTY_RECORD}));
457     }
458     LOG(DEBUG) << "getDeviceIdentity finished";
459 }
460 
461 /*
462  * Test IRadio.exitEmergencyCallbackMode() for the response returned.
463  */
TEST_P(RadioHidlTest,exitEmergencyCallbackMode)464 TEST_P(RadioHidlTest, exitEmergencyCallbackMode) {
465     LOG(DEBUG) << "exitEmergencyCallbackMode";
466     serial = GetRandomSerialNumber();
467 
468     radio->exitEmergencyCallbackMode(serial);
469     EXPECT_EQ(std::cv_status::no_timeout, wait());
470     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
471     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
472 
473     if (cardStatus.cardState == CardState::ABSENT) {
474         ASSERT_TRUE(CheckAnyOfErrors(
475             radioRsp->rspInfo.error,
476             {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
477     }
478     LOG(DEBUG) << "exitEmergencyCallbackMode finished";
479 }
480 
481 /*
482  * Test IRadio.getCdmaSubscriptionSource() for the response returned.
483  */
TEST_P(RadioHidlTest,getCdmaSubscriptionSource)484 TEST_P(RadioHidlTest, getCdmaSubscriptionSource) {
485     LOG(DEBUG) << "getCdmaSubscriptionSource";
486     serial = GetRandomSerialNumber();
487 
488     radio->getCdmaSubscriptionSource(serial);
489     EXPECT_EQ(std::cv_status::no_timeout, wait());
490     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
491     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
492 
493     if (cardStatus.cardState == CardState::ABSENT) {
494         ASSERT_TRUE(CheckAnyOfErrors(
495             radioRsp->rspInfo.error,
496             {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
497     }
498     LOG(DEBUG) << "getCdmaSubscriptionSource finished";
499 }
500 
501 /*
502  * Test IRadio.setCdmaSubscriptionSource() for the response returned.
503  */
TEST_P(RadioHidlTest,setCdmaSubscriptionSource)504 TEST_P(RadioHidlTest, setCdmaSubscriptionSource) {
505     LOG(DEBUG) << "setCdmaSubscriptionSource";
506     serial = GetRandomSerialNumber();
507 
508     radio->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM);
509     EXPECT_EQ(std::cv_status::no_timeout, wait());
510     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
511     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
512 
513     if (cardStatus.cardState == CardState::ABSENT) {
514         ASSERT_TRUE(CheckAnyOfErrors(
515             radioRsp->rspInfo.error,
516             {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::SUBSCRIPTION_NOT_AVAILABLE},
517             CHECK_GENERAL_ERROR));
518     }
519     LOG(DEBUG) << "setCdmaSubscriptionSource finished";
520 }
521 
522 /*
523  * Test IRadio.getVoiceRadioTechnology() for the response returned.
524  */
TEST_P(RadioHidlTest,getVoiceRadioTechnology)525 TEST_P(RadioHidlTest, getVoiceRadioTechnology) {
526     LOG(DEBUG) << "getVoiceRadioTechnology";
527     serial = GetRandomSerialNumber();
528 
529     radio->getVoiceRadioTechnology(serial);
530     EXPECT_EQ(std::cv_status::no_timeout, wait());
531     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
532     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
533 
534     if (cardStatus.cardState == CardState::ABSENT) {
535         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
536     }
537     LOG(DEBUG) << "getVoiceRadioTechnology finished";
538 }
539 
540 /*
541  * Test IRadio.getCellInfoList() for the response returned.
542  */
TEST_P(RadioHidlTest,getCellInfoList)543 TEST_P(RadioHidlTest, getCellInfoList) {
544     LOG(DEBUG) << "getCellInfoList";
545     serial = GetRandomSerialNumber();
546 
547     radio->getCellInfoList(serial);
548     EXPECT_EQ(std::cv_status::no_timeout, wait());
549     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
550     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
551 
552     if (cardStatus.cardState == CardState::ABSENT) {
553         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
554                                      {RadioError::NONE, RadioError::NO_NETWORK_FOUND},
555                                      CHECK_GENERAL_ERROR));
556     }
557     LOG(DEBUG) << "getCellInfoList finished";
558 }
559 
560 /*
561  * Test IRadio.setCellInfoListRate() for the response returned.
562  */
TEST_P(RadioHidlTest,setCellInfoListRate)563 TEST_P(RadioHidlTest, setCellInfoListRate) {
564     LOG(DEBUG) << "setCellInfoListRate";
565     serial = GetRandomSerialNumber();
566 
567     // TODO(sanketpadawe): RIL crashes with value of rate = 10
568     radio->setCellInfoListRate(serial, 10);
569     EXPECT_EQ(std::cv_status::no_timeout, wait());
570     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
571     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
572 
573     if (cardStatus.cardState == CardState::ABSENT) {
574         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
575                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
576     }
577     LOG(DEBUG) << "setCellInfoListRate finished";
578 }
579 
580 /*
581  * Test IRadio.nvReadItem() for the response returned.
582  */
TEST_P(RadioHidlTest,nvReadItem)583 TEST_P(RadioHidlTest, nvReadItem) {
584     LOG(DEBUG) << "nvReadItem";
585     serial = GetRandomSerialNumber();
586 
587     radio->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25);
588     EXPECT_EQ(std::cv_status::no_timeout, wait());
589     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
590     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
591 
592     if (cardStatus.cardState == CardState::ABSENT) {
593         ASSERT_TRUE(
594             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
595     }
596     LOG(DEBUG) << "nvReadItem finished";
597 }
598 
599 /*
600  * Test IRadio.nvWriteItem() for the response returned.
601  */
TEST_P(RadioHidlTest,nvWriteItem)602 TEST_P(RadioHidlTest, nvWriteItem) {
603     LOG(DEBUG) << "nvWriteItem";
604     serial = GetRandomSerialNumber();
605     NvWriteItem item;
606     memset(&item, 0, sizeof(item));
607     item.value = hidl_string();
608 
609     radio->nvWriteItem(serial, item);
610     EXPECT_EQ(std::cv_status::no_timeout, wait());
611     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
612     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
613 
614     if (cardStatus.cardState == CardState::ABSENT) {
615         ASSERT_TRUE(
616             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
617     }
618     LOG(DEBUG) << "nvWriteItem finished";
619 }
620 
621 /*
622  * Test IRadio.nvWriteCdmaPrl() for the response returned.
623  */
TEST_P(RadioHidlTest,nvWriteCdmaPrl)624 TEST_P(RadioHidlTest, nvWriteCdmaPrl) {
625     LOG(DEBUG) << "nvWriteCdmaPrl";
626     serial = GetRandomSerialNumber();
627     std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
628 
629     radio->nvWriteCdmaPrl(serial, hidl_vec<uint8_t>(prl));
630     EXPECT_EQ(std::cv_status::no_timeout, wait());
631     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
632     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
633 
634     if (cardStatus.cardState == CardState::ABSENT) {
635         ASSERT_TRUE(
636             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
637     }
638     LOG(DEBUG) << "nvWriteCdmaPrl finished";
639 }
640 
641 /*
642  * Test IRadio.nvResetConfig() for the response returned.
643  */
TEST_P(RadioHidlTest,nvResetConfig)644 TEST_P(RadioHidlTest, nvResetConfig) {
645     LOG(DEBUG) << "nvResetConfig";
646     serial = GetRandomSerialNumber();
647 
648     radio->nvResetConfig(serial, ResetNvType::FACTORY_RESET);
649     EXPECT_EQ(std::cv_status::no_timeout, wait());
650     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
651     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
652 
653     if (cardStatus.cardState == CardState::ABSENT) {
654         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
655                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
656     }
657     // wait until modem reset finishes
658     sleep(10);
659     LOG(DEBUG) << "nvResetConfig finished";
660 }
661 
662 /*
663  * Test IRadio.setUiccSubscription() for the response returned.
664  */
TEST_P(RadioHidlTest,setUiccSubscription)665 TEST_P(RadioHidlTest, setUiccSubscription) {
666     LOG(DEBUG) << "setUiccSubscription";
667     serial = GetRandomSerialNumber();
668     SelectUiccSub item;
669     memset(&item, 0, sizeof(item));
670 
671     radio->setUiccSubscription(serial, item);
672     EXPECT_EQ(std::cv_status::no_timeout, wait());
673     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
674     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
675 
676     if (cardStatus.cardState == CardState::ABSENT) {
677         ASSERT_TRUE(
678             CheckAnyOfErrors(radioRsp->rspInfo.error,
679                              {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
680                               RadioError::MODEM_ERR, RadioError::SUBSCRIPTION_NOT_SUPPORTED},
681                              CHECK_GENERAL_ERROR));
682     }
683     LOG(DEBUG) << "setUiccSubscription finished";
684 }
685 
686 /*
687  * Test IRadio.getHardwareConfig() for the response returned.
688  */
TEST_P(RadioHidlTest,getHardwareConfig)689 TEST_P(RadioHidlTest, getHardwareConfig) {
690     LOG(DEBUG) << "getHardwareConfig";
691     serial = GetRandomSerialNumber();
692 
693     radio->getHardwareConfig(serial);
694     EXPECT_EQ(std::cv_status::no_timeout, wait());
695     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
696     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
697 
698     if (cardStatus.cardState == CardState::ABSENT) {
699         ASSERT_TRUE(
700             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
701     }
702     LOG(DEBUG) << "getHardwareConfig finished";
703 }
704 
705 /*
706  * The following test is disabled due to b/64734869
707  *
708  * Test IRadio.requestShutdown() for the response returned.
709  */
TEST_P(RadioHidlTest,DISABLED_requestShutdown)710 TEST_P(RadioHidlTest, DISABLED_requestShutdown) {
711     serial = GetRandomSerialNumber();
712 
713     radio->requestShutdown(serial);
714     EXPECT_EQ(std::cv_status::no_timeout, wait());
715     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
716     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
717 
718     if (cardStatus.cardState == CardState::ABSENT) {
719         ASSERT_TRUE(
720             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
721     }
722 }
723 
724 /*
725  * Test IRadio.getRadioCapability() for the response returned.
726  */
TEST_P(RadioHidlTest,getRadioCapability)727 TEST_P(RadioHidlTest, getRadioCapability) {
728     LOG(DEBUG) << "getRadioCapability";
729     serial = GetRandomSerialNumber();
730 
731     radio->getRadioCapability(serial);
732     EXPECT_EQ(std::cv_status::no_timeout, wait());
733     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
734     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
735 
736     if (cardStatus.cardState == CardState::ABSENT) {
737         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
738     }
739     LOG(DEBUG) << "getRadioCapability finished";
740 }
741 
742 /*
743  * Test IRadio.setRadioCapability() for the response returned.
744  */
TEST_P(RadioHidlTest,setRadioCapability)745 TEST_P(RadioHidlTest, setRadioCapability) {
746     LOG(DEBUG) << "setRadioCapability";
747     serial = GetRandomSerialNumber();
748     RadioCapability rc;
749     memset(&rc, 0, sizeof(rc));
750     rc.logicalModemUuid = hidl_string();
751 
752     radio->setRadioCapability(serial, rc);
753     EXPECT_EQ(std::cv_status::no_timeout, wait());
754     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
755     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
756 
757     if (cardStatus.cardState == CardState::ABSENT) {
758         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
759                                      {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
760                                      CHECK_GENERAL_ERROR));
761     }
762     LOG(DEBUG) << "setRadioCapability finished";
763 }
764 
765 /*
766  * Test IRadio.startLceService() for the response returned.
767  */
TEST_P(RadioHidlTest,startLceService)768 TEST_P(RadioHidlTest, startLceService) {
769     LOG(DEBUG) << "startLceService";
770     serial = GetRandomSerialNumber();
771 
772     radio->startLceService(serial, 5, true);
773     EXPECT_EQ(std::cv_status::no_timeout, wait());
774     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
775     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
776 
777     // HAL 1.2 and later use the always-on LCE that relies on indications.
778     SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2);
779 
780     if (cardStatus.cardState == CardState::ABSENT) {
781         ASSERT_TRUE(CheckAnyOfErrors(
782             radioRsp->rspInfo.error,
783             {RadioError::INTERNAL_ERR, RadioError::LCE_NOT_SUPPORTED,
784              RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT, RadioError::NONE}));
785     }
786     LOG(DEBUG) << "startLceService finished";
787 }
788 
789 /*
790  * Test IRadio.stopLceService() for the response returned.
791  */
TEST_P(RadioHidlTest,stopLceService)792 TEST_P(RadioHidlTest, stopLceService) {
793     LOG(DEBUG) << "stopLceService";
794     serial = GetRandomSerialNumber();
795 
796     radio->stopLceService(serial);
797     EXPECT_EQ(std::cv_status::no_timeout, wait());
798     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
799     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
800 
801     // HAL 1.2 and later use the always-on LCE that relies on indications.
802     SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2);
803 
804     if (cardStatus.cardState == CardState::ABSENT) {
805         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
806                                      {RadioError::NONE, RadioError::LCE_NOT_SUPPORTED,
807                                       RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT}));
808     }
809     LOG(DEBUG) << "stopLceService finished";
810 }
811 
812 /*
813  * Test IRadio.pullLceData() for the response returned.
814  */
TEST_P(RadioHidlTest,pullLceData)815 TEST_P(RadioHidlTest, pullLceData) {
816     LOG(DEBUG) << "pullLceData";
817     serial = GetRandomSerialNumber();
818 
819     radio->pullLceData(serial);
820     EXPECT_EQ(std::cv_status::no_timeout, wait());
821     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
822     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
823 
824     // HAL 1.2 and later use the always-on LCE that relies on indications.
825     SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2);
826 
827     if (cardStatus.cardState == CardState::ABSENT) {
828         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
829                                      {RadioError::NONE, RadioError::INTERNAL_ERR,
830                                       RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT},
831                                      CHECK_OEM_ERROR));
832     }
833     LOG(DEBUG) << "pullLceData finished";
834 }
835 
836 /*
837  * Test IRadio.getModemActivityInfo() for the response returned.
838  */
TEST_P(RadioHidlTest,getModemActivityInfo)839 TEST_P(RadioHidlTest, getModemActivityInfo) {
840     LOG(DEBUG) << "getModemActivityInfo";
841     serial = GetRandomSerialNumber();
842 
843     radio->getModemActivityInfo(serial);
844     EXPECT_EQ(std::cv_status::no_timeout, wait());
845     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
846     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
847 
848     if (cardStatus.cardState == CardState::ABSENT) {
849         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
850                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
851     }
852     LOG(DEBUG) << "getModemActivityInfo finished";
853 }
854 
855 /*
856  * The following test is disabled due to b/79930549
857  *
858  * Test IRadio.setAllowedCarriers() for the response returned.
859  */
TEST_P(RadioHidlTest,DISABLED_setAllowedCarriers)860 TEST_P(RadioHidlTest, DISABLED_setAllowedCarriers) {
861     serial = GetRandomSerialNumber();
862     CarrierRestrictions carriers;
863     memset(&carriers, 0, sizeof(carriers));
864     carriers.allowedCarriers.resize(1);
865     carriers.excludedCarriers.resize(0);
866     carriers.allowedCarriers[0].mcc = hidl_string();
867     carriers.allowedCarriers[0].mnc = hidl_string();
868     carriers.allowedCarriers[0].matchType = CarrierMatchType::ALL;
869     carriers.allowedCarriers[0].matchData = hidl_string();
870 
871     radio->setAllowedCarriers(serial, false, carriers);
872     EXPECT_EQ(std::cv_status::no_timeout, wait());
873     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
874     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
875 
876     if (cardStatus.cardState == CardState::ABSENT) {
877         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
878                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
879     }
880 
881     if (radioRsp->rspInfo.error == RadioError::NONE) {
882         /* Setting to carrier restriction needs some time */
883         updateSimCardStatus();
884         auto startTime = std::chrono::system_clock::now();
885         while (cardStatus.cardState != CardState::RESTRICTED &&
886                std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
887                                                            startTime)
888                        .count() < 10) {
889             /* Set 2 seconds as interval to check card status */
890             sleep(2);
891             updateSimCardStatus();
892         }
893         EXPECT_EQ(CardState::RESTRICTED, cardStatus.cardState);
894     }
895     sleep(10);
896 
897     /**
898      * Another test case of the API to cover to allow carrier.
899      * If the API is supported, this is also used to reset to no carrier restriction
900      * status for cardStatus.
901      */
902     memset(&carriers, 0, sizeof(carriers));
903     carriers.allowedCarriers.resize(0);
904     carriers.excludedCarriers.resize(0);
905 
906     serial = GetRandomSerialNumber();
907     radio->setAllowedCarriers(serial, true, carriers);
908     EXPECT_EQ(std::cv_status::no_timeout, wait());
909     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
910     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
911 
912     if (cardStatus.cardState == CardState::ABSENT) {
913         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
914                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
915     }
916 
917     if (radioRsp->rspInfo.error == RadioError::NONE) {
918         /* Resetting back to no carrier restriction needs some time */
919         updateSimCardStatus();
920         auto startTime = std::chrono::system_clock::now();
921         while (cardStatus.cardState == CardState::RESTRICTED &&
922                std::chrono::duration_cast<chrono::seconds>(std::chrono::system_clock::now() -
923                                                            startTime)
924                        .count() < 10) {
925             /* Set 2 seconds as interval to check card status */
926             sleep(2);
927             updateSimCardStatus();
928         }
929         EXPECT_NE(CardState::RESTRICTED, cardStatus.cardState);
930         sleep(10);
931     }
932 }
933 
934 /*
935  * Test IRadio.getAllowedCarriers() for the response returned.
936  */
TEST_P(RadioHidlTest,getAllowedCarriers)937 TEST_P(RadioHidlTest, getAllowedCarriers) {
938     LOG(DEBUG) << "getAllowedCarriers";
939     serial = GetRandomSerialNumber();
940 
941     radio->getAllowedCarriers(serial);
942     EXPECT_EQ(std::cv_status::no_timeout, wait());
943     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
944     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
945 
946     if (cardStatus.cardState == CardState::ABSENT) {
947         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
948                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
949     }
950     LOG(DEBUG) << "getAllowedCarriers finished";
951 }
952 
953 /*
954  * Test IRadio.sendDeviceState() for the response returned.
955  */
TEST_P(RadioHidlTest,sendDeviceState)956 TEST_P(RadioHidlTest, sendDeviceState) {
957     LOG(DEBUG) << "sendDeviceState";
958     serial = GetRandomSerialNumber();
959 
960     radio->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true);
961     EXPECT_EQ(std::cv_status::no_timeout, wait());
962     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
963     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
964 
965     std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
966 
967     if (cardStatus.cardState == CardState::ABSENT) {
968         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
969                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
970     }
971     LOG(DEBUG) << "sendDeviceState finished";
972 }
973 
974 /*
975  * Test IRadio.setIndicationFilter() for the response returned.
976  */
TEST_P(RadioHidlTest,setIndicationFilter)977 TEST_P(RadioHidlTest, setIndicationFilter) {
978     LOG(DEBUG) << "setIndicationFilter";
979     serial = GetRandomSerialNumber();
980 
981     radio->setIndicationFilter(serial, 1);
982     EXPECT_EQ(std::cv_status::no_timeout, wait());
983     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
984     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
985 
986     // setIndicationFilter is deprecated on radio::V1_2 with setIndicationFilter_1_2
987     SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2);
988 
989     std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
990 
991     if (cardStatus.cardState == CardState::ABSENT) {
992         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
993                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
994     }
995     LOG(DEBUG) << "setIndicationFilter finished";
996 }
997 
998 /*
999  * Test IRadio.setSimCardPower() for the response returned.
1000  */
TEST_P(RadioHidlTest,setSimCardPower)1001 TEST_P(RadioHidlTest, setSimCardPower) {
1002     LOG(DEBUG) << "setSimCardPower";
1003     serial = GetRandomSerialNumber();
1004 
1005     radio->setSimCardPower(serial, true);
1006     EXPECT_EQ(std::cv_status::no_timeout, wait());
1007     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
1008     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
1009 
1010     // setSimCardPower is deprecated on radio::V1_1 with setSimCardPower_1_1
1011     SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_1);
1012 
1013     if (cardStatus.cardState == CardState::ABSENT) {
1014         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
1015                                      {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
1016     }
1017     LOG(DEBUG) << "setSimCardPower finished";
1018 }
1019