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