Willi Ye | daf0b73 | 2019-10-22 22:48:05 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019, The LineageOS Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.1 (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.1 |
| 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/hardware/radio/1.3/IRadio.h> |
| 20 | #include <hidl/MQDescriptor.h> |
| 21 | #include <hidl/Status.h> |
| 22 | #include <vendor/samsung/hardware/radio/1.2/IRadio.h> |
| 23 | |
| 24 | #include "SecRadioIndication.h" |
| 25 | #include "SecRadioResponse.h" |
| 26 | |
| 27 | namespace android { |
| 28 | namespace hardware { |
| 29 | namespace radio { |
| 30 | namespace V1_3 { |
| 31 | namespace implementation { |
| 32 | |
| 33 | #define RIL1_SERVICE_NAME "slot1" |
| 34 | #define RIL2_SERVICE_NAME "slot2" |
| 35 | |
| 36 | using ::android::sp; |
| 37 | using ::android::hardware::hidl_array; |
| 38 | using ::android::hardware::hidl_memory; |
| 39 | using ::android::hardware::hidl_string; |
| 40 | using ::android::hardware::hidl_vec; |
| 41 | using ::android::hardware::Return; |
| 42 | using ::android::hardware::Void; |
| 43 | using ::vendor::samsung::hardware::radio::V1_2::implementation::SecRadioIndication; |
| 44 | using ::vendor::samsung::hardware::radio::V1_2::implementation::SecRadioResponse; |
| 45 | |
| 46 | struct Radio : public IRadio { |
| 47 | std::string interfaceName; |
| 48 | std::mutex secIRadioMutex; |
| 49 | sp<::vendor::samsung::hardware::radio::V1_2::IRadio> secIRadio; |
| 50 | |
| 51 | Radio(const std::string& interfaceName); |
| 52 | |
| 53 | sp<::vendor::samsung::hardware::radio::V1_2::IRadio> getSecIRadio(); |
| 54 | |
| 55 | // Methods from ::android::hardware::radio::V1_0::IRadio follow. |
| 56 | Return<void> setResponseFunctions( |
| 57 | const sp<::android::hardware::radio::V1_0::IRadioResponse>& radioResponse, |
| 58 | const sp<::android::hardware::radio::V1_0::IRadioIndication>& radioIndication) override; |
| 59 | Return<void> getIccCardStatus(int32_t serial) override; |
| 60 | Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin, |
| 61 | const hidl_string& aid) override; |
| 62 | Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin, |
| 63 | const hidl_string& aid) override; |
| 64 | Return<void> supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, |
| 65 | const hidl_string& aid) override; |
| 66 | Return<void> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, |
| 67 | const hidl_string& pin2, const hidl_string& aid) override; |
| 68 | Return<void> changeIccPinForApp(int32_t serial, const hidl_string& oldPin, |
| 69 | const hidl_string& newPin, const hidl_string& aid) override; |
| 70 | Return<void> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, |
| 71 | const hidl_string& newPin2, const hidl_string& aid) override; |
| 72 | Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) override; |
| 73 | Return<void> getCurrentCalls(int32_t serial) override; |
| 74 | Return<void> dial(int32_t serial, |
| 75 | const ::android::hardware::radio::V1_0::Dial& dialInfo) override; |
| 76 | Return<void> getImsiForApp(int32_t serial, const hidl_string& aid) override; |
| 77 | Return<void> hangup(int32_t serial, int32_t gsmIndex) override; |
| 78 | Return<void> hangupWaitingOrBackground(int32_t serial) override; |
| 79 | Return<void> hangupForegroundResumeBackground(int32_t serial) override; |
| 80 | Return<void> switchWaitingOrHoldingAndActive(int32_t serial) override; |
| 81 | Return<void> conference(int32_t serial) override; |
| 82 | Return<void> rejectCall(int32_t serial) override; |
| 83 | Return<void> getLastCallFailCause(int32_t serial) override; |
| 84 | Return<void> getSignalStrength(int32_t serial) override; |
| 85 | Return<void> getVoiceRegistrationState(int32_t serial) override; |
| 86 | Return<void> getDataRegistrationState(int32_t serial) override; |
| 87 | Return<void> getOperator(int32_t serial) override; |
| 88 | Return<void> setRadioPower(int32_t serial, bool on) override; |
| 89 | Return<void> sendDtmf(int32_t serial, const hidl_string& s) override; |
| 90 | Return<void> sendSms(int32_t serial, |
| 91 | const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override; |
| 92 | Return<void> sendSMSExpectMore( |
| 93 | int32_t serial, const ::android::hardware::radio::V1_0::GsmSmsMessage& message) override; |
| 94 | Return<void> setupDataCall( |
| 95 | int32_t serial, ::android::hardware::radio::V1_0::RadioTechnology radioTechnology, |
| 96 | const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo, |
| 97 | bool modemCognitive, bool roamingAllowed, bool isRoaming) override; |
| 98 | Return<void> iccIOForApp(int32_t serial, |
| 99 | const ::android::hardware::radio::V1_0::IccIo& iccIo) override; |
| 100 | Return<void> sendUssd(int32_t serial, const hidl_string& ussd) override; |
| 101 | Return<void> cancelPendingUssd(int32_t serial) override; |
| 102 | Return<void> getClir(int32_t serial) override; |
| 103 | Return<void> setClir(int32_t serial, int32_t status) override; |
| 104 | Return<void> getCallForwardStatus( |
| 105 | int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override; |
| 106 | Return<void> setCallForward( |
| 107 | int32_t serial, const ::android::hardware::radio::V1_0::CallForwardInfo& callInfo) override; |
| 108 | Return<void> getCallWaiting(int32_t serial, int32_t serviceClass) override; |
| 109 | Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override; |
| 110 | Return<void> acknowledgeLastIncomingGsmSms( |
| 111 | int32_t serial, bool success, |
| 112 | ::android::hardware::radio::V1_0::SmsAcknowledgeFailCause cause) override; |
| 113 | Return<void> acceptCall(int32_t serial) override; |
| 114 | Return<void> deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) override; |
| 115 | Return<void> getFacilityLockForApp(int32_t serial, const hidl_string& facility, |
| 116 | const hidl_string& password, int32_t serviceClass, |
| 117 | const hidl_string& appId) override; |
| 118 | Return<void> setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState, |
| 119 | const hidl_string& password, int32_t serviceClass, |
| 120 | const hidl_string& appId) override; |
| 121 | Return<void> setBarringPassword(int32_t serial, const hidl_string& facility, |
| 122 | const hidl_string& oldPassword, |
| 123 | const hidl_string& newPassword) override; |
| 124 | Return<void> getNetworkSelectionMode(int32_t serial) override; |
| 125 | Return<void> setNetworkSelectionModeAutomatic(int32_t serial) override; |
| 126 | Return<void> setNetworkSelectionModeManual(int32_t serial, |
| 127 | const hidl_string& operatorNumeric) override; |
| 128 | Return<void> getAvailableNetworks(int32_t serial) override; |
| 129 | Return<void> startDtmf(int32_t serial, const hidl_string& s) override; |
| 130 | Return<void> stopDtmf(int32_t serial) override; |
| 131 | Return<void> getBasebandVersion(int32_t serial) override; |
| 132 | Return<void> separateConnection(int32_t serial, int32_t gsmIndex) override; |
| 133 | Return<void> setMute(int32_t serial, bool enable) override; |
| 134 | Return<void> getMute(int32_t serial) override; |
| 135 | Return<void> getClip(int32_t serial) override; |
| 136 | Return<void> getDataCallList(int32_t serial) override; |
| 137 | Return<void> setSuppServiceNotifications(int32_t serial, bool enable) override; |
| 138 | Return<void> writeSmsToSim( |
| 139 | int32_t serial, const ::android::hardware::radio::V1_0::SmsWriteArgs& smsWriteArgs) override; |
| 140 | Return<void> deleteSmsOnSim(int32_t serial, int32_t index) override; |
| 141 | Return<void> setBandMode(int32_t serial, |
| 142 | ::android::hardware::radio::V1_0::RadioBandMode mode) override; |
| 143 | Return<void> getAvailableBandModes(int32_t serial) override; |
| 144 | Return<void> sendEnvelope(int32_t serial, const hidl_string& command) override; |
| 145 | Return<void> sendTerminalResponseToSim(int32_t serial, |
| 146 | const hidl_string& commandResponse) override; |
| 147 | Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override; |
| 148 | Return<void> explicitCallTransfer(int32_t serial) override; |
| 149 | Return<void> setPreferredNetworkType( |
| 150 | int32_t serial, ::android::hardware::radio::V1_0::PreferredNetworkType nwType) override; |
| 151 | Return<void> getPreferredNetworkType(int32_t serial) override; |
| 152 | Return<void> getNeighboringCids(int32_t serial) override; |
| 153 | Return<void> setLocationUpdates(int32_t serial, bool enable) override; |
| 154 | Return<void> setCdmaSubscriptionSource( |
| 155 | int32_t serial, ::android::hardware::radio::V1_0::CdmaSubscriptionSource cdmaSub) override; |
| 156 | Return<void> setCdmaRoamingPreference( |
| 157 | int32_t serial, ::android::hardware::radio::V1_0::CdmaRoamingType type) override; |
| 158 | Return<void> getCdmaRoamingPreference(int32_t serial) override; |
| 159 | Return<void> setTTYMode(int32_t serial, ::android::hardware::radio::V1_0::TtyMode mode) override; |
| 160 | Return<void> getTTYMode(int32_t serial) override; |
| 161 | Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable) override; |
| 162 | Return<void> getPreferredVoicePrivacy(int32_t serial) override; |
| 163 | Return<void> sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) override; |
| 164 | Return<void> sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on, |
| 165 | int32_t off) override; |
| 166 | Return<void> sendCdmaSms(int32_t serial, |
| 167 | const ::android::hardware::radio::V1_0::CdmaSmsMessage& sms) override; |
| 168 | Return<void> acknowledgeLastIncomingCdmaSms( |
| 169 | int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsAck& smsAck) override; |
| 170 | Return<void> getGsmBroadcastConfig(int32_t serial) override; |
| 171 | Return<void> setGsmBroadcastConfig( |
| 172 | int32_t serial, |
| 173 | const hidl_vec<::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo>& configInfo) |
| 174 | override; |
| 175 | Return<void> setGsmBroadcastActivation(int32_t serial, bool activate) override; |
| 176 | Return<void> getCdmaBroadcastConfig(int32_t serial) override; |
| 177 | Return<void> setCdmaBroadcastConfig( |
| 178 | int32_t serial, |
| 179 | const hidl_vec<::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo>& configInfo) |
| 180 | override; |
| 181 | Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate) override; |
| 182 | Return<void> getCDMASubscription(int32_t serial) override; |
| 183 | Return<void> writeSmsToRuim( |
| 184 | int32_t serial, const ::android::hardware::radio::V1_0::CdmaSmsWriteArgs& cdmaSms) override; |
| 185 | Return<void> deleteSmsOnRuim(int32_t serial, int32_t index) override; |
| 186 | Return<void> getDeviceIdentity(int32_t serial) override; |
| 187 | Return<void> exitEmergencyCallbackMode(int32_t serial) override; |
| 188 | Return<void> getSmscAddress(int32_t serial) override; |
| 189 | Return<void> setSmscAddress(int32_t serial, const hidl_string& smsc) override; |
| 190 | Return<void> reportSmsMemoryStatus(int32_t serial, bool available) override; |
| 191 | Return<void> reportStkServiceIsRunning(int32_t serial) override; |
| 192 | Return<void> getCdmaSubscriptionSource(int32_t serial) override; |
| 193 | Return<void> requestIsimAuthentication(int32_t serial, const hidl_string& challenge) override; |
| 194 | Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, |
| 195 | const hidl_string& ackPdu) override; |
| 196 | Return<void> sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) override; |
| 197 | Return<void> getVoiceRadioTechnology(int32_t serial) override; |
| 198 | Return<void> getCellInfoList(int32_t serial) override; |
| 199 | Return<void> setCellInfoListRate(int32_t serial, int32_t rate) override; |
| 200 | Return<void> setInitialAttachApn( |
| 201 | int32_t serial, const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo, |
| 202 | bool modemCognitive, bool isRoaming) override; |
| 203 | Return<void> getImsRegistrationState(int32_t serial) override; |
| 204 | Return<void> sendImsSms(int32_t serial, |
| 205 | const ::android::hardware::radio::V1_0::ImsSmsMessage& message) override; |
| 206 | Return<void> iccTransmitApduBasicChannel( |
| 207 | int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override; |
| 208 | Return<void> iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) override; |
| 209 | Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId) override; |
| 210 | Return<void> iccTransmitApduLogicalChannel( |
| 211 | int32_t serial, const ::android::hardware::radio::V1_0::SimApdu& message) override; |
| 212 | Return<void> nvReadItem(int32_t serial, |
| 213 | ::android::hardware::radio::V1_0::NvItem itemId) override; |
| 214 | Return<void> nvWriteItem(int32_t serial, |
| 215 | const ::android::hardware::radio::V1_0::NvWriteItem& item) override; |
| 216 | Return<void> nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) override; |
| 217 | Return<void> nvResetConfig(int32_t serial, |
| 218 | ::android::hardware::radio::V1_0::ResetNvType resetType) override; |
| 219 | Return<void> setUiccSubscription( |
| 220 | int32_t serial, const ::android::hardware::radio::V1_0::SelectUiccSub& uiccSub) override; |
| 221 | Return<void> setDataAllowed(int32_t serial, bool allow) override; |
| 222 | Return<void> getHardwareConfig(int32_t serial) override; |
| 223 | Return<void> requestIccSimAuthentication(int32_t serial, int32_t authContext, |
| 224 | const hidl_string& authData, |
| 225 | const hidl_string& aid) override; |
| 226 | Return<void> setDataProfile( |
| 227 | int32_t serial, const hidl_vec<::android::hardware::radio::V1_0::DataProfileInfo>& profiles, |
| 228 | bool isRoaming) override; |
| 229 | Return<void> requestShutdown(int32_t serial) override; |
| 230 | Return<void> getRadioCapability(int32_t serial) override; |
| 231 | Return<void> setRadioCapability( |
| 232 | int32_t serial, const ::android::hardware::radio::V1_0::RadioCapability& rc) override; |
| 233 | Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode) override; |
| 234 | Return<void> stopLceService(int32_t serial) override; |
| 235 | Return<void> pullLceData(int32_t serial) override; |
| 236 | Return<void> getModemActivityInfo(int32_t serial) override; |
| 237 | Return<void> setAllowedCarriers( |
| 238 | int32_t serial, bool allAllowed, |
| 239 | const ::android::hardware::radio::V1_0::CarrierRestrictions& carriers) override; |
| 240 | Return<void> getAllowedCarriers(int32_t serial) override; |
| 241 | Return<void> sendDeviceState(int32_t serial, |
| 242 | ::android::hardware::radio::V1_0::DeviceStateType deviceStateType, |
| 243 | bool state) override; |
| 244 | Return<void> setIndicationFilter( |
| 245 | int32_t serial, |
| 246 | hidl_bitfield<::android::hardware::radio::V1_2::IndicationFilter> indicationFilter) override; |
| 247 | Return<void> setSimCardPower(int32_t serial, bool powerUp) override; |
| 248 | Return<void> responseAcknowledgement() override; |
| 249 | |
| 250 | // Methods from ::android::hardware::radio::V1_1::IRadio follow. |
| 251 | Return<void> setCarrierInfoForImsiEncryption( |
| 252 | int32_t serial, |
| 253 | const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) override; |
| 254 | Return<void> setSimCardPower_1_1( |
| 255 | int32_t serial, ::android::hardware::radio::V1_1::CardPowerState powerUp) override; |
| 256 | Return<void> startNetworkScan( |
| 257 | int32_t serial, |
| 258 | const ::android::hardware::radio::V1_1::NetworkScanRequest& request) override; |
| 259 | Return<void> stopNetworkScan(int32_t serial) override; |
| 260 | Return<void> startKeepalive( |
| 261 | int32_t serial, |
| 262 | const ::android::hardware::radio::V1_1::KeepaliveRequest& keepalive) override; |
| 263 | Return<void> stopKeepalive(int32_t serial, int32_t sessionHandle) override; |
| 264 | |
| 265 | // Methods from ::android::hardware::radio::V1_2::IRadio follow. |
| 266 | Return<void> startNetworkScan_1_2( |
| 267 | int32_t serial, |
| 268 | const ::android::hardware::radio::V1_2::NetworkScanRequest& request) override; |
| 269 | Return<void> setIndicationFilter_1_2( |
| 270 | int32_t serial, |
| 271 | hidl_bitfield<::android::hardware::radio::V1_2::IndicationFilter> indicationFilter) override; |
| 272 | Return<void> setSignalStrengthReportingCriteria( |
| 273 | int32_t serial, int32_t hysteresisMs, int32_t hysteresisDb, |
| 274 | const hidl_vec<int32_t>& thresholdsDbm, |
| 275 | ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override; |
| 276 | Return<void> setLinkCapacityReportingCriteria( |
| 277 | int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps, |
| 278 | const hidl_vec<int32_t>& thresholdsDownlinkKbps, |
| 279 | const hidl_vec<int32_t>& thresholdsUplinkKbps, |
| 280 | ::android::hardware::radio::V1_2::AccessNetwork accessNetwork) override; |
| 281 | Return<void> setupDataCall_1_2( |
| 282 | int32_t serial, ::android::hardware::radio::V1_2::AccessNetwork accessNetwork, |
| 283 | const ::android::hardware::radio::V1_0::DataProfileInfo& dataProfileInfo, |
| 284 | bool modemCognitive, bool roamingAllowed, bool isRoaming, |
| 285 | ::android::hardware::radio::V1_2::DataRequestReason reason, |
| 286 | const hidl_vec<hidl_string>& addresses, const hidl_vec<hidl_string>& dnses) override; |
| 287 | Return<void> deactivateDataCall_1_2( |
| 288 | int32_t serial, int32_t cid, |
| 289 | ::android::hardware::radio::V1_2::DataRequestReason reason) override; |
| 290 | |
| 291 | // Methods from ::android::hardware::radio::V1_3::IRadio follow. |
| 292 | Return<void> setSystemSelectionChannels( |
| 293 | int32_t serial, bool specifyChannels, |
| 294 | const hidl_vec<::android::hardware::radio::V1_1::RadioAccessSpecifier>& specifiers) override; |
| 295 | Return<void> enableModem(int32_t serial, bool on) override; |
| 296 | Return<void> getModemStackStatus(int32_t serial) override; |
| 297 | }; |
| 298 | |
| 299 | } // namespace implementation |
| 300 | } // namespace V1_3 |
| 301 | } // namespace radio |
| 302 | } // namespace hardware |
| 303 | } // namespace android |