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