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