/* * Copyright (C) 2019, The LineageOS Project * * Licensed under the Apache License, Version 2.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.1 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #include #include #include #include "SecRadioIndication.h" #include "SecRadioResponse.h" namespace android { namespace hardware { namespace radio { namespace V1_3 { namespace implementation { #define RIL1_SERVICE_NAME "slot1" #define RIL2_SERVICE_NAME "slot2" using ::android::sp; using ::android::hardware::hidl_array; using ::android::hardware::hidl_memory; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; using ::vendor::samsung::hardware::radio::V1_2::implementation::SecRadioIndication; using ::vendor::samsung::hardware::radio::V1_2::implementation::SecRadioResponse; struct Radio : public IRadio { std::string interfaceName; std::mutex secIRadioMutex; sp<::vendor::samsung::hardware::radio::V1_2::IRadio> secIRadio; Radio(const std::string& interfaceName); sp<::vendor::samsung::hardware::radio::V1_2::IRadio> getSecIRadio(); // Methods from ::android::hardware::radio::V1_0::IRadio follow. Return setResponseFunctions( const sp<::android::hardware::radio::V1_0::IRadioResponse>& radioResponse, const sp<::android::hardware::radio::V1_0::IRadioIndication>& radioIndication) override; Return getIccCardStatus(int32_t serial) override; Return supplyIccPinForApp(int32_t serial, const hidl_string& pin, const hidl_string& aid) override; Return supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin, const hidl_string& aid) override; Return supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, const hidl_string& aid) override; Return supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, const hidl_string& pin2, const hidl_string& aid) override; Return changeIccPinForApp(int32_t serial, const hidl_string& oldPin, const hidl_string& newPin, const hidl_string& aid) override; Return changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, const hidl_string& newPin2, const hidl_string& aid) override; Return supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) override; Return getCurrentCalls(int32_t serial) override; Return dial(int32_t serial, const ::android::hardware::radio::V1_0::Dial& dialInfo) override; Return getImsiForApp(int32_t serial, const hidl_string& aid) override; Return hangup(int32_t serial, int32_t gsmIndex) override; Return hangupWaitingOrBackground(int32_t serial) override; Return hangupForegroundResumeBackground(int32_t serial) override; Return switchWaitingOrHoldingAndActive(int32_t serial) override; Return conference(int32_t serial) override; Return rejectCall(int32_t serial) override; Return getLastCallFailCause(int32_t serial) override; Return getSignalStrength(int32_t serial) override; Return getVoiceRegistrationState(int32_t serial) override; Return getDataRegistrationState(int32_t serial) override; Return getOperator(int32_t serial) override; Return setRadioPower(int32_t serial, bool on) override; Return sendDtmf(int32_t serial, const hidl_string& s) override; Return sendSms(int32_t serial, const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override; Return sendSMSExpectMore( int32_t serial, const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override; Return setupDataCall( int32_t serial, ::android::hardware::radio::V1_0::RadioTechnology radioTechnology, const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo, bool modemCognitive, bool roamingAllowed, bool isRoaming) override; Return iccIOForApp(int32_t serial, const ::android::hardware::radio::V1_0::IccIo& iccIo) override; Return sendUssd(int32_t serial, const hidl_string& ussd) override; Return cancelPendingUssd(int32_t serial) override; Return getClir(int32_t serial) override; Return setClir(int32_t serial, int32_t status) override; Return getCallForwardStatus( int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override; Return setCallForward( int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override; Return getCallWaiting(int32_t serial, int32_t serviceClass) override; Return setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override; Return acknowledgeLastIncomingGsmSms( int32_t serial, bool success, ::android::hardware::radio::V1_0::SmsAcknowledgeFailCause cause) override; Return acceptCall(int32_t serial) override; Return deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) override; Return getFacilityLockForApp(int32_t serial, const hidl_string& facility, const hidl_string& password, int32_t serviceClass, const hidl_string& appId) override; Return setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState, const hidl_string& password, int32_t serviceClass, const hidl_string& appId) override; Return setBarringPassword(int32_t serial, const hidl_string& facility, const hidl_string& oldPassword, const hidl_string& newPassword) override; Return getNetworkSelectionMode(int32_t serial) override; Return setNetworkSelectionModeAutomatic(int32_t serial) override; Return setNetworkSelectionModeManual(int32_t serial, const hidl_string& operatorNumeric) override; Return getAvailableNetworks(int32_t serial) override; Return startDtmf(int32_t serial, const hidl_string& s) override; Return stopDtmf(int32_t serial) override; Return getBasebandVersion(int32_t serial) override; Return separateConnection(int32_t serial, int32_t gsmIndex) override; Return setMute(int32_t serial, bool enable) override; Return getMute(int32_t serial) override; Return getClip(int32_t serial) override; Return getDataCallList(int32_t serial) override; Return setSuppServiceNotifications(int32_t serial, bool enable) override; Return writeSmsToSim( int32_t serial, const ::android::hardware::radio::V1_0::SmsWriteArgs& smsWriteArgs) override; Return deleteSmsOnSim(int32_t serial, int32_t index) override; Return setBandMode(int32_t serial, ::android::hardware::radio::V1_0::RadioBandMode mode) override; Return getAvailableBandModes(int32_t serial) override; Return sendEnvelope(int32_t serial, const hidl_string& command) override; Return sendTerminalResponseToSim(int32_t serial, const hidl_string& commandResponse) override; Return handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override; Return explicitCallTransfer(int32_t serial) override; Return setPreferredNetworkType( int32_t serial, ::android::hardware::radio::V1_0::PreferredNetworkType nwType) override; Return getPreferredNetworkType(int32_t serial) override; Return getNeighboringCids(int32_t serial) override; Return setLocationUpdates(int32_t serial, bool enable) override; Return setCdmaSubscriptionSource( int32_t serial, ::android::hardware::radio::V1_0::CdmaSubscriptionSource cdmaSub) override; Return setCdmaRoamingPreference( int32_t serial, ::android::hardware::radio::V1_0::CdmaRoamingType type) override; Return getCdmaRoamingPreference(int32_t serial) override; Return setTTYMode(int32_t serial, ::android::hardware::radio::V1_0::TtyMode mode) override; Return getTTYMode(int32_t serial) override; Return setPreferredVoicePrivacy(int32_t serial, bool enable) override; Return getPreferredVoicePrivacy(int32_t serial) override; Return sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) override; Return sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on, int32_t off) override; Return sendCdmaSms(int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsMessage& sms) override; Return acknowledgeLastIncomingCdmaSms( int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsAck& smsAck) override; Return getGsmBroadcastConfig(int32_t serial) override; Return setGsmBroadcastConfig( int32_t serial, const hidl_vec<::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo>& configInfo) override; Return setGsmBroadcastActivation(int32_t serial, bool activate) override; Return getCdmaBroadcastConfig(int32_t serial) override; Return setCdmaBroadcastConfig( int32_t serial, const hidl_vec<::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo>& configInfo) override; Return setCdmaBroadcastActivation(int32_t serial, bool activate) override; Return getCDMASubscription(int32_t serial) override; Return writeSmsToRuim( int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsWriteArgs& cdmaSms) override; Return deleteSmsOnRuim(int32_t serial, int32_t index) override; Return getDeviceIdentity(int32_t serial) override; Return exitEmergencyCallbackMode(int32_t serial) override; Return getSmscAddress(int32_t serial) override; Return setSmscAddress(int32_t serial, const hidl_string& smsc) override; Return reportSmsMemoryStatus(int32_t serial, bool available) override; Return reportStkServiceIsRunning(int32_t serial) override; Return getCdmaSubscriptionSource(int32_t serial) override; Return requestIsimAuthentication(int32_t serial, const hidl_string& challenge) override; Return acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, const hidl_string& ackPdu) override; Return sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) override; Return getVoiceRadioTechnology(int32_t serial) override; Return getCellInfoList(int32_t serial) override; Return setCellInfoListRate(int32_t serial, int32_t rate) override; Return setInitialAttachApn( int32_t serial, const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo, bool modemCognitive, bool isRoaming) override; Return getImsRegistrationState(int32_t serial) override; Return sendImsSms(int32_t serial, const ::android::hardware::radio::V1_0::ImsSmsMessage& message) override; Return iccTransmitApduBasicChannel( int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override; Return iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) override; Return iccCloseLogicalChannel(int32_t serial, int32_t channelId) override; Return iccTransmitApduLogicalChannel( int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override; Return nvReadItem(int32_t serial, ::android::hardware::radio::V1_0::NvItem itemId) override; Return nvWriteItem(int32_t serial, const ::android::hardware::radio::V1_0::NvWriteItem& item) override; Return nvWriteCdmaPrl(int32_t serial, const hidl_vec& prl) override; Return nvResetConfig(int32_t serial, ::android::hardware::radio::V1_0::ResetNvType resetType) override; Return setUiccSubscription( int32_t serial, const ::android::hardware::radio::V1_0::SelectUiccSub& uiccSub) override; Return setDataAllowed(int32_t serial, bool allow) override; Return getHardwareConfig(int32_t serial) override; Return requestIccSimAuthentication(int32_t serial, int32_t authContext, const hidl_string& authData, const hidl_string& aid) override; Return setDataProfile( int32_t serial, const hidl_vec<::android::hardware::radio::V1_0::DataProfileInfo>& profiles, bool isRoaming) override; Return requestShutdown(int32_t serial) override; Return getRadioCapability(int32_t serial) override; Return setRadioCapability( int32_t serial, const ::android::hardware::radio::V1_0::RadioCapability& rc) override; Return startLceService(int32_t serial, int32_t reportInterval, bool pullMode) override; Return stopLceService(int32_t serial) override; Return pullLceData(int32_t serial) override; Return getModemActivityInfo(int32_t serial) override; Return setAllowedCarriers( int32_t serial, bool allAllowed, const ::android::hardware::radio::V1_0::CarrierRestrictions& carriers) override; Return getAllowedCarriers(int32_t serial) override; Return sendDeviceState(int32_t serial, ::android::hardware::radio::V1_0::DeviceStateType deviceStateType, bool state) override; Return setIndicationFilter( int32_t serial, hidl_bitfield<::android::hardware::radio::V1_2::IndicationFilter> indicationFilter) override; Return setSimCardPower(int32_t serial, bool powerUp) override; Return responseAcknowledgement() override; // Methods from ::android::hardware::radio::V1_1::IRadio follow. Return setCarrierInfoForImsiEncryption( int32_t serial, const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) override; Return setSimCardPower_1_1( int32_t serial, ::android::hardware::radio::V1_1::CardPowerState powerUp) override; Return startNetworkScan( int32_t serial, const ::android::hardware::radio::V1_1::NetworkScanRequest& request) override; Return stopNetworkScan(int32_t serial) override; Return startKeepalive( int32_t serial, const ::android::hardware::radio::V1_1::KeepaliveRequest& keepalive) override; Return stopKeepalive(int32_t serial, int32_t sessionHandle) override; // Methods from ::android::hardware::radio::V1_2::IRadio follow. Return startNetworkScan_1_2( int32_t serial, const ::android::hardware::radio::V1_2::NetworkScanRequest& request) override; Return setIndicationFilter_1_2( int32_t serial, hidl_bitfield<::android::hardware::radio::V1_2::IndicationFilter> indicationFilter) override; Return setSignalStrengthReportingCriteria( int32_t serial, int32_t hysteresisMs, int32_t hysteresisDb, const hidl_vec& thresholdsDbm, ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override; Return setLinkCapacityReportingCriteria( int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps, const hidl_vec& thresholdsDownlinkKbps, const hidl_vec& thresholdsUplinkKbps, ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override; Return setupDataCall_1_2( int32_t serial, ::android::hardware::radio::V1_2::AccessNetwork accessNetwork, const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo, bool modemCognitive, bool roamingAllowed, bool isRoaming, ::android::hardware::radio::V1_2::DataRequestReason reason, const hidl_vec& addresses, const hidl_vec& dnses) override; Return deactivateDataCall_1_2( int32_t serial, int32_t cid, ::android::hardware::radio::V1_2::DataRequestReason reason) override; // Methods from ::android::hardware::radio::V1_3::IRadio follow. Return setSystemSelectionChannels( int32_t serial, bool specifyChannels, const hidl_vec<::android::hardware::radio::V1_1::RadioAccessSpecifier>& specifiers) override; Return enableModem(int32_t serial, bool on) override; Return getModemStackStatus(int32_t serial) override; }; } // namespace implementation } // namespace V1_3 } // namespace radio } // namespace hardware } // namespace android