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