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