1 /*
2  * Copyright (C) 2019 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 
19 #include <log/log.h>
20 #include <chrono>
21 #include <condition_variable>
22 #include <mutex>
23 
24 #include <android/hardware/radio/1.2/types.h>
25 #include <android/hardware/radio/1.3/IRadio.h>
26 #include <android/hardware/radio/1.3/IRadioIndication.h>
27 #include <android/hardware/radio/1.3/IRadioResponse.h>
28 
29 #include "vts_test_util.h"
30 
31 using namespace ::android::hardware::radio::V1_3;
32 using namespace ::android::hardware::radio::V1_2;
33 using namespace ::android::hardware::radio::V1_1;
34 using namespace ::android::hardware::radio::V1_0;
35 
36 using ::android::sp;
37 using ::android::hardware::hidl_bitfield;
38 using ::android::hardware::hidl_string;
39 using ::android::hardware::hidl_vec;
40 using ::android::hardware::Return;
41 using ::android::hardware::Void;
42 
43 #define TIMEOUT_PERIOD 75
44 #define RADIO_SERVICE_NAME "slot1"
45 
46 class RadioHidlTest_v1_3;
47 extern ::android::hardware::radio::V1_2::CardStatus cardStatus;
48 
49 /* Callback class for radio response v1_3*/
50 class RadioResponse_v1_3 : public ::android::hardware::radio::V1_3::IRadioResponse {
51    protected:
52     RadioHidlTest_v1_3& parent_v1_3;
53 
54    public:
55     RadioResponseInfo rspInfo;
56     // Modem
57     bool isModemEnabled;
58     bool enableModemResponseToggle = false;
59 
60     // Data
61     ::android::hardware::radio::V1_2::DataRegStateResult dataRegResp;
62 
63     RadioResponse_v1_3(RadioHidlTest_v1_3& parent_v1_3);
64     virtual ~RadioResponse_v1_3() = default;
65 
66     Return<void> getIccCardStatusResponse(
67             const RadioResponseInfo& info,
68             const ::android::hardware::radio::V1_0::CardStatus& cardStatus);
69 
70     Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
71                                             int32_t remainingRetries);
72 
73     Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
74                                             int32_t remainingRetries);
75 
76     Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
77                                              int32_t remainingRetries);
78 
79     Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
80                                              int32_t remainingRetries);
81 
82     Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
83                                             int32_t remainingRetries);
84 
85     Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
86                                              int32_t remainingRetries);
87 
88     Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info,
89                                                         int32_t remainingRetries);
90 
91     Return<void> getCurrentCallsResponse(
92             const RadioResponseInfo& info,
93             const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& calls);
94 
95     Return<void> dialResponse(const RadioResponseInfo& info);
96 
97     Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
98                                        const ::android::hardware::hidl_string& imsi);
99 
100     Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
101 
102     Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
103 
104     Return<void> hangupForegroundResumeBackgroundResponse(const RadioResponseInfo& info);
105 
106     Return<void> switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info);
107 
108     Return<void> conferenceResponse(const RadioResponseInfo& info);
109 
110     Return<void> rejectCallResponse(const RadioResponseInfo& info);
111 
112     Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
113                                               const LastCallFailCauseInfo& failCauseInfo);
114 
115     Return<void> getSignalStrengthResponse(
116             const RadioResponseInfo& info,
117             const ::android::hardware::radio::V1_0::SignalStrength& sigStrength);
118 
119     Return<void> getVoiceRegistrationStateResponse(
120             const RadioResponseInfo& info,
121             const ::android::hardware::radio::V1_0::VoiceRegStateResult& voiceRegResponse);
122 
123     Return<void> getDataRegistrationStateResponse(
124             const RadioResponseInfo& info,
125             const ::android::hardware::radio::V1_0::DataRegStateResult& dataRegResponse);
126 
127     Return<void> getOperatorResponse(const RadioResponseInfo& info,
128                                      const ::android::hardware::hidl_string& longName,
129                                      const ::android::hardware::hidl_string& shortName,
130                                      const ::android::hardware::hidl_string& numeric);
131 
132     Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
133 
134     Return<void> sendDtmfResponse(const RadioResponseInfo& info);
135 
136     Return<void> sendSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
137 
138     Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
139 
140     Return<void> setupDataCallResponse(const RadioResponseInfo& info,
141                                        const SetupDataCallResult& dcResponse);
142 
143     Return<void> iccIOForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo);
144 
145     Return<void> sendUssdResponse(const RadioResponseInfo& info);
146 
147     Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
148 
149     Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
150 
151     Return<void> setClirResponse(const RadioResponseInfo& info);
152 
153     Return<void> getCallForwardStatusResponse(
154             const RadioResponseInfo& info,
155             const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
156 
157     Return<void> setCallForwardResponse(const RadioResponseInfo& info);
158 
159     Return<void> getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
160                                         int32_t serviceClass);
161 
162     Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
163 
164     Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
165 
166     Return<void> acceptCallResponse(const RadioResponseInfo& info);
167 
168     Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
169 
170     Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t response);
171 
172     Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t retry);
173 
174     Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
175 
176     Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info, bool manual);
177 
178     Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
179 
180     Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
181 
182     Return<void> getAvailableNetworksResponse(
183             const RadioResponseInfo& info,
184             const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
185 
186     Return<void> startDtmfResponse(const RadioResponseInfo& info);
187 
188     Return<void> stopDtmfResponse(const RadioResponseInfo& info);
189 
190     Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
191                                             const ::android::hardware::hidl_string& version);
192 
193     Return<void> separateConnectionResponse(const RadioResponseInfo& info);
194 
195     Return<void> setMuteResponse(const RadioResponseInfo& info);
196 
197     Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
198 
199     Return<void> getClipResponse(const RadioResponseInfo& info, ClipStatus status);
200 
201     Return<void> getDataCallListResponse(
202             const RadioResponseInfo& info,
203             const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
204 
205     Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
206                                               const ::android::hardware::hidl_vec<uint8_t>& data);
207 
208     Return<void> sendOemRilRequestStringsResponse(
209             const RadioResponseInfo& info,
210             const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
211 
212     Return<void> setSuppServiceNotificationsResponse(const RadioResponseInfo& info);
213 
214     Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index);
215 
216     Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
217 
218     Return<void> setBandModeResponse(const RadioResponseInfo& info);
219 
220     Return<void> getAvailableBandModesResponse(
221             const RadioResponseInfo& info,
222             const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
223 
224     Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
225                                       const ::android::hardware::hidl_string& commandResponse);
226 
227     Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
228 
229     Return<void> handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo& info);
230 
231     Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
232 
233     Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
234 
235     Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
236                                                  PreferredNetworkType nwType);
237 
238     Return<void> getNeighboringCidsResponse(
239             const RadioResponseInfo& info,
240             const ::android::hardware::hidl_vec<NeighboringCell>& cells);
241 
242     Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
243 
244     Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
245 
246     Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
247 
248     Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
249                                                   CdmaRoamingType type);
250 
251     Return<void> setTTYModeResponse(const RadioResponseInfo& info);
252 
253     Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
254 
255     Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
256 
257     Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
258 
259     Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
260 
261     Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
262 
263     Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
264 
265     Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
266 
267     Return<void> getGsmBroadcastConfigResponse(
268             const RadioResponseInfo& info,
269             const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
270 
271     Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
272 
273     Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
274 
275     Return<void> getCdmaBroadcastConfigResponse(
276             const RadioResponseInfo& info,
277             const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
278 
279     Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
280 
281     Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
282 
283     Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
284                                              const ::android::hardware::hidl_string& mdn,
285                                              const ::android::hardware::hidl_string& hSid,
286                                              const ::android::hardware::hidl_string& hNid,
287                                              const ::android::hardware::hidl_string& min,
288                                              const ::android::hardware::hidl_string& prl);
289 
290     Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
291 
292     Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
293 
294     Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
295                                            const ::android::hardware::hidl_string& imei,
296                                            const ::android::hardware::hidl_string& imeisv,
297                                            const ::android::hardware::hidl_string& esn,
298                                            const ::android::hardware::hidl_string& meid);
299 
300     Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
301 
302     Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
303                                         const ::android::hardware::hidl_string& smsc);
304 
305     Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
306 
307     Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
308 
309     Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
310 
311     Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
312                                                    CdmaSubscriptionSource source);
313 
314     Return<void> requestIsimAuthenticationResponse(
315             const RadioResponseInfo& info, const ::android::hardware::hidl_string& response);
316 
317     Return<void> acknowledgeIncomingGsmSmsWithPduResponse(const RadioResponseInfo& info);
318 
319     Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
320                                                 const IccIoResult& iccIo);
321 
322     Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
323                                                  RadioTechnology rat);
324 
325     Return<void> getCellInfoListResponse(
326             const RadioResponseInfo& info,
327             const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>&
328                     cellInfo);
329 
330     Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
331 
332     Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
333 
334     Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info, bool isRegistered,
335                                                  RadioTechnologyFamily ratFamily);
336 
337     Return<void> sendImsSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
338 
339     Return<void> iccTransmitApduBasicChannelResponse(const RadioResponseInfo& info,
340                                                      const IccIoResult& result);
341 
342     Return<void> iccOpenLogicalChannelResponse(
343             const RadioResponseInfo& info, int32_t channelId,
344             const ::android::hardware::hidl_vec<int8_t>& selectResponse);
345 
346     Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
347 
348     Return<void> iccTransmitApduLogicalChannelResponse(const RadioResponseInfo& info,
349                                                        const IccIoResult& result);
350 
351     Return<void> nvReadItemResponse(const RadioResponseInfo& info,
352                                     const ::android::hardware::hidl_string& result);
353 
354     Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
355 
356     Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
357 
358     Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
359 
360     Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
361 
362     Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
363 
364     Return<void> getHardwareConfigResponse(
365             const RadioResponseInfo& info,
366             const ::android::hardware::hidl_vec<HardwareConfig>& config);
367 
368     Return<void> requestIccSimAuthenticationResponse(const RadioResponseInfo& info,
369                                                      const IccIoResult& result);
370 
371     Return<void> setDataProfileResponse(const RadioResponseInfo& info);
372 
373     Return<void> requestShutdownResponse(const RadioResponseInfo& info);
374 
375     Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
376                                             const RadioCapability& rc);
377 
378     Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
379                                             const RadioCapability& rc);
380 
381     Return<void> startLceServiceResponse(const RadioResponseInfo& info,
382                                          const LceStatusInfo& statusInfo);
383 
384     Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
385                                         const LceStatusInfo& statusInfo);
386 
387     Return<void> pullLceDataResponse(const RadioResponseInfo& info, const LceDataInfo& lceInfo);
388 
389     Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
390                                               const ActivityStatsInfo& activityInfo);
391 
392     Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info, int32_t numAllowed);
393 
394     Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info, bool allAllowed,
395                                             const CarrierRestrictions& carriers);
396 
397     Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
398 
399     Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
400 
401     Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
402 
403     Return<void> acknowledgeRequest(int32_t serial);
404 
405     /* 1.1 Api */
406     Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info);
407 
408     Return<void> setSimCardPowerResponse_1_1(const RadioResponseInfo& info);
409 
410     Return<void> startNetworkScanResponse(const RadioResponseInfo& info);
411 
412     Return<void> stopNetworkScanResponse(const RadioResponseInfo& info);
413 
414     Return<void> startKeepaliveResponse(const RadioResponseInfo& info,
415                                         const KeepaliveStatus& status);
416 
417     Return<void> stopKeepaliveResponse(const RadioResponseInfo& info);
418 
419     /* 1.2 Api */
420     Return<void> setSignalStrengthReportingCriteriaResponse(const RadioResponseInfo& info);
421 
422     Return<void> setLinkCapacityReportingCriteriaResponse(const RadioResponseInfo& info);
423 
424     Return<void> getIccCardStatusResponse_1_2(
425             const RadioResponseInfo& info,
426             const ::android::hardware::radio::V1_2::CardStatus& card_status);
427 
428     Return<void> getCurrentCallsResponse_1_2(
429             const RadioResponseInfo& info,
430             const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls);
431 
432     Return<void> getSignalStrengthResponse_1_2(
433             const RadioResponseInfo& info,
434             const ::android::hardware::radio::V1_2::SignalStrength& sig_strength);
435 
436     Return<void> getCellInfoListResponse_1_2(
437             const RadioResponseInfo& info,
438             const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>&
439                     cellInfo);
440 
441     Return<void> getVoiceRegistrationStateResponse_1_2(
442             const RadioResponseInfo& info,
443             const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse);
444 
445     Return<void> getDataRegistrationStateResponse_1_2(
446             const RadioResponseInfo& info,
447             const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse);
448 
449     /* 1.3 Api */
450     Return<void> setSystemSelectionChannelsResponse(const RadioResponseInfo& info);
451 
452     Return<void> enableModemResponse(const RadioResponseInfo& info);
453 
454     Return<void> getModemStackStatusResponse(const RadioResponseInfo& info, const bool enabled);
455 };
456 
457 /* Callback class for radio indication */
458 class RadioIndication_v1_3 : public ::android::hardware::radio::V1_3::IRadioIndication {
459    protected:
460     RadioHidlTest_v1_3& parent_v1_3;
461 
462    public:
463     RadioIndication_v1_3(RadioHidlTest_v1_3& parent_v1_3);
464     virtual ~RadioIndication_v1_3() = default;
465 
466     /* 1.2 Api */
467     Return<void> networkScanResult_1_2(
468             RadioIndicationType type,
469             const ::android::hardware::radio::V1_2::NetworkScanResult& result);
470 
471     Return<void> cellInfoList_1_2(
472             RadioIndicationType type,
473             const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>&
474                     records);
475 
476     Return<void> currentLinkCapacityEstimate(
477             RadioIndicationType type,
478             const ::android::hardware::radio::V1_2::LinkCapacityEstimate& lce);
479 
480     Return<void> currentPhysicalChannelConfigs(
481             RadioIndicationType type,
482             const ::android::hardware::hidl_vec<
483                     ::android::hardware::radio::V1_2::PhysicalChannelConfig>& configs);
484 
485     Return<void> currentSignalStrength_1_2(
486             RadioIndicationType type,
487             const ::android::hardware::radio::V1_2::SignalStrength& signalStrength);
488 
489     /* 1.1 Api */
490     Return<void> carrierInfoForImsiEncryption(RadioIndicationType info);
491 
492     Return<void> networkScanResult(
493             RadioIndicationType type,
494             const ::android::hardware::radio::V1_1::NetworkScanResult& result);
495 
496     Return<void> keepaliveStatus(RadioIndicationType type, const KeepaliveStatus& status);
497 
498     /* 1.0 Api */
499     Return<void> radioStateChanged(RadioIndicationType type, RadioState radioState);
500 
501     Return<void> callStateChanged(RadioIndicationType type);
502 
503     Return<void> networkStateChanged(RadioIndicationType type);
504 
505     Return<void> newSms(RadioIndicationType type,
506                         const ::android::hardware::hidl_vec<uint8_t>& pdu);
507 
508     Return<void> newSmsStatusReport(RadioIndicationType type,
509                                     const ::android::hardware::hidl_vec<uint8_t>& pdu);
510 
511     Return<void> newSmsOnSim(RadioIndicationType type, int32_t recordNumber);
512 
513     Return<void> onUssd(RadioIndicationType type, UssdModeType modeType,
514                         const ::android::hardware::hidl_string& msg);
515 
516     Return<void> nitzTimeReceived(RadioIndicationType type,
517                                   const ::android::hardware::hidl_string& nitzTime,
518                                   uint64_t receivedTime);
519 
520     Return<void> currentSignalStrength(
521             RadioIndicationType type,
522             const ::android::hardware::radio::V1_0::SignalStrength& signalStrength);
523 
524     Return<void> dataCallListChanged(
525             RadioIndicationType type,
526             const ::android::hardware::hidl_vec<SetupDataCallResult>& dcList);
527 
528     Return<void> suppSvcNotify(RadioIndicationType type, const SuppSvcNotification& suppSvc);
529 
530     Return<void> stkSessionEnd(RadioIndicationType type);
531 
532     Return<void> stkProactiveCommand(RadioIndicationType type,
533                                      const ::android::hardware::hidl_string& cmd);
534 
535     Return<void> stkEventNotify(RadioIndicationType type,
536                                 const ::android::hardware::hidl_string& cmd);
537 
538     Return<void> stkCallSetup(RadioIndicationType type, int64_t timeout);
539 
540     Return<void> simSmsStorageFull(RadioIndicationType type);
541 
542     Return<void> simRefresh(RadioIndicationType type, const SimRefreshResult& refreshResult);
543 
544     Return<void> callRing(RadioIndicationType type, bool isGsm, const CdmaSignalInfoRecord& record);
545 
546     Return<void> simStatusChanged(RadioIndicationType type);
547 
548     Return<void> cdmaNewSms(RadioIndicationType type, const CdmaSmsMessage& msg);
549 
550     Return<void> newBroadcastSms(RadioIndicationType type,
551                                  const ::android::hardware::hidl_vec<uint8_t>& data);
552 
553     Return<void> cdmaRuimSmsStorageFull(RadioIndicationType type);
554 
555     Return<void> restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state);
556 
557     Return<void> enterEmergencyCallbackMode(RadioIndicationType type);
558 
559     Return<void> cdmaCallWaiting(RadioIndicationType type,
560                                  const CdmaCallWaiting& callWaitingRecord);
561 
562     Return<void> cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status);
563 
564     Return<void> cdmaInfoRec(RadioIndicationType type, const CdmaInformationRecords& records);
565 
566     Return<void> indicateRingbackTone(RadioIndicationType type, bool start);
567 
568     Return<void> resendIncallMute(RadioIndicationType type);
569 
570     Return<void> cdmaSubscriptionSourceChanged(RadioIndicationType type,
571                                                CdmaSubscriptionSource cdmaSource);
572 
573     Return<void> cdmaPrlChanged(RadioIndicationType type, int32_t version);
574 
575     Return<void> exitEmergencyCallbackMode(RadioIndicationType type);
576 
577     Return<void> rilConnected(RadioIndicationType type);
578 
579     Return<void> voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat);
580 
581     Return<void> cellInfoList(
582             RadioIndicationType type,
583             const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>&
584                     records);
585 
586     Return<void> imsNetworkStateChanged(RadioIndicationType type);
587 
588     Return<void> subscriptionStatusChanged(RadioIndicationType type, bool activate);
589 
590     Return<void> srvccStateNotify(RadioIndicationType type, SrvccState state);
591 
592     Return<void> hardwareConfigChanged(
593             RadioIndicationType type, const ::android::hardware::hidl_vec<HardwareConfig>& configs);
594 
595     Return<void> radioCapabilityIndication(RadioIndicationType type, const RadioCapability& rc);
596 
597     Return<void> onSupplementaryServiceIndication(RadioIndicationType type,
598                                                   const StkCcUnsolSsResult& ss);
599 
600     Return<void> stkCallControlAlphaNotify(RadioIndicationType type,
601                                            const ::android::hardware::hidl_string& alpha);
602 
603     Return<void> lceData(RadioIndicationType type, const LceDataInfo& lce);
604 
605     Return<void> pcoData(RadioIndicationType type, const PcoDataInfo& pco);
606 
607     Return<void> modemReset(RadioIndicationType type,
608                             const ::android::hardware::hidl_string& reason);
609 };
610 
611 // The main test class for Radio HIDL.
612 class RadioHidlTest_v1_3 : public ::testing::TestWithParam<std::string> {
613   protected:
614     std::mutex mtx_;
615     std::condition_variable cv_;
616     int count_;
617 
618     /* Serial number for radio request */
619     int serial;
620 
621     /* Update Sim Card Status */
622     void updateSimCardStatus();
623 
624    public:
625     virtual void SetUp() override;
626 
627     /* Used as a mechanism to inform the test about data/event callback */
628     void notify(int receivedSerial);
629 
630     /* Test code calls this function to wait for response */
631     std::cv_status wait();
632 
633     /* radio service handle */
634     sp<::android::hardware::radio::V1_3::IRadio> radio_v1_3;
635 
636     /* radio response handle */
637     sp<RadioResponse_v1_3> radioRsp_v1_3;
638 
639     /* radio indication handle */
640     sp<RadioIndication_v1_3> radioInd_v1_3;
641 };