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