Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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/hardware/radio/1.0/IRadio.h> |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 18 | #include <android/hardware/radio/deprecated/1.0/IOemHook.h> |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 19 | |
| 20 | #include <hwbinder/IPCThreadState.h> |
| 21 | #include <hwbinder/ProcessState.h> |
| 22 | #include <ril_service.h> |
| 23 | #include <hidl/HidlTransportSupport.h> |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 24 | #include <utils/SystemClock.h> |
Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame] | 25 | #include <inttypes.h> |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 26 | |
| 27 | #define INVALID_HEX_CHAR 16 |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 28 | |
| 29 | using namespace android::hardware::radio::V1_0; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 30 | using namespace android::hardware::radio::deprecated::V1_0; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 31 | using ::android::hardware::configureRpcThreadpool; |
| 32 | using ::android::hardware::joinRpcThreadpool; |
| 33 | using ::android::hardware::Return; |
| 34 | using ::android::hardware::Status; |
| 35 | using ::android::hardware::hidl_string; |
| 36 | using ::android::hardware::hidl_vec; |
| 37 | using ::android::hardware::hidl_array; |
| 38 | using ::android::hardware::Void; |
| 39 | using android::CommandInfo; |
| 40 | using android::RequestInfo; |
| 41 | using android::requestToString; |
| 42 | using android::sp; |
| 43 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 44 | #define BOOL_TO_INT(x) (x ? 1 : 0) |
| 45 | #define ATOI_NULL_HANDLED(x) (x ? atoi(x) : -1) |
| 46 | #define ATOI_NULL_HANDLED_DEF(x, defaultVal) (x ? atoi(x) : defaultVal) |
| 47 | |
| 48 | RIL_RadioFunctions *s_vendorFunctions = NULL; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 49 | static CommandInfo *s_commands; |
| 50 | |
| 51 | struct RadioImpl; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 52 | struct OemHookImpl; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 53 | |
| 54 | #if (SIM_COUNT >= 2) |
| 55 | sp<RadioImpl> radioService[SIM_COUNT]; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 56 | sp<OemHookImpl> oemHookService[SIM_COUNT]; |
| 57 | // counter used for synchronization. It is incremented every time response callbacks are updated. |
| 58 | volatile int32_t mCounter[SIM_COUNT]; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 59 | #else |
| 60 | sp<RadioImpl> radioService[1]; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 61 | sp<OemHookImpl> oemHookService[1]; |
| 62 | // counter used for synchronization. It is incremented every time response callbacks are updated. |
| 63 | volatile int32_t mCounter[1]; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 64 | #endif |
| 65 | |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 66 | static pthread_rwlock_t radioServiceRwlock = PTHREAD_RWLOCK_INITIALIZER; |
| 67 | |
| 68 | #if (SIM_COUNT >= 2) |
| 69 | static pthread_rwlock_t radioServiceRwlock2 = PTHREAD_RWLOCK_INITIALIZER; |
| 70 | #if (SIM_COUNT >= 3) |
| 71 | static pthread_rwlock_t radioServiceRwlock3 = PTHREAD_RWLOCK_INITIALIZER; |
| 72 | #if (SIM_COUNT >= 4) |
| 73 | static pthread_rwlock_t radioServiceRwlock4 = PTHREAD_RWLOCK_INITIALIZER; |
| 74 | #endif |
| 75 | #endif |
| 76 | #endif |
| 77 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 78 | void convertRilHardwareConfigListToHal(void *response, size_t responseLen, |
| 79 | hidl_vec<HardwareConfig>& records); |
| 80 | |
| 81 | void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc); |
| 82 | |
| 83 | void convertRilLceDataInfoToHal(void *response, size_t responseLen, LceDataInfo& lce); |
| 84 | |
| 85 | void convertRilSignalStrengthToHal(void *response, size_t responseLen, |
| 86 | SignalStrength& signalStrength); |
| 87 | |
| 88 | void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse, |
| 89 | SetupDataCallResult& dcResult); |
| 90 | |
| 91 | void convertRilDataCallListToHal(void *response, size_t responseLen, |
| 92 | hidl_vec<SetupDataCallResult>& dcResultList); |
| 93 | |
| 94 | void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<CellInfo>& records); |
| 95 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 96 | struct RadioImpl : public IRadio { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 97 | int32_t mSlotId; |
| 98 | sp<IRadioResponse> mRadioResponse; |
| 99 | sp<IRadioIndication> mRadioIndication; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 100 | |
| 101 | Return<void> setResponseFunctions( |
| 102 | const ::android::sp<IRadioResponse>& radioResponse, |
| 103 | const ::android::sp<IRadioIndication>& radioIndication); |
| 104 | |
| 105 | Return<void> getIccCardStatus(int32_t serial); |
| 106 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 107 | Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin, |
| 108 | const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 109 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 110 | Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, |
| 111 | const hidl_string& pin, const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 112 | |
| 113 | Return<void> supplyIccPin2ForApp(int32_t serial, |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 114 | const hidl_string& pin2, |
| 115 | const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 116 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 117 | Return<void> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, |
| 118 | const hidl_string& pin2, const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 119 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 120 | Return<void> changeIccPinForApp(int32_t serial, const hidl_string& oldPin, |
| 121 | const hidl_string& newPin, const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 122 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 123 | Return<void> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, |
| 124 | const hidl_string& newPin2, const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 125 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 126 | Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 127 | |
| 128 | Return<void> getCurrentCalls(int32_t serial); |
| 129 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 130 | Return<void> dial(int32_t serial, const Dial& dialInfo); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 131 | |
| 132 | Return<void> getImsiForApp(int32_t serial, |
| 133 | const ::android::hardware::hidl_string& aid); |
| 134 | |
| 135 | Return<void> hangup(int32_t serial, int32_t gsmIndex); |
| 136 | |
| 137 | Return<void> hangupWaitingOrBackground(int32_t serial); |
| 138 | |
| 139 | Return<void> hangupForegroundResumeBackground(int32_t serial); |
| 140 | |
| 141 | Return<void> switchWaitingOrHoldingAndActive(int32_t serial); |
| 142 | |
| 143 | Return<void> conference(int32_t serial); |
| 144 | |
| 145 | Return<void> rejectCall(int32_t serial); |
| 146 | |
| 147 | Return<void> getLastCallFailCause(int32_t serial); |
| 148 | |
| 149 | Return<void> getSignalStrength(int32_t serial); |
| 150 | |
| 151 | Return<void> getVoiceRegistrationState(int32_t serial); |
| 152 | |
| 153 | Return<void> getDataRegistrationState(int32_t serial); |
| 154 | |
| 155 | Return<void> getOperator(int32_t serial); |
| 156 | |
| 157 | Return<void> setRadioPower(int32_t serial, bool on); |
| 158 | |
| 159 | Return<void> sendDtmf(int32_t serial, |
| 160 | const ::android::hardware::hidl_string& s); |
| 161 | |
| 162 | Return<void> sendSms(int32_t serial, const GsmSmsMessage& message); |
| 163 | |
| 164 | Return<void> sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message); |
| 165 | |
| 166 | Return<void> setupDataCall(int32_t serial, |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 167 | RadioTechnology radioTechnology, |
| 168 | const DataProfileInfo& profileInfo, |
| 169 | bool modemCognitive, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 170 | bool roamingAllowed, |
| 171 | bool isRoaming); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 172 | |
| 173 | Return<void> iccIOForApp(int32_t serial, |
| 174 | const IccIo& iccIo); |
| 175 | |
| 176 | Return<void> sendUssd(int32_t serial, |
| 177 | const ::android::hardware::hidl_string& ussd); |
| 178 | |
| 179 | Return<void> cancelPendingUssd(int32_t serial); |
| 180 | |
| 181 | Return<void> getClir(int32_t serial); |
| 182 | |
| 183 | Return<void> setClir(int32_t serial, int32_t status); |
| 184 | |
| 185 | Return<void> getCallForwardStatus(int32_t serial, |
| 186 | const CallForwardInfo& callInfo); |
| 187 | |
| 188 | Return<void> setCallForward(int32_t serial, |
| 189 | const CallForwardInfo& callInfo); |
| 190 | |
| 191 | Return<void> getCallWaiting(int32_t serial, int32_t serviceClass); |
| 192 | |
| 193 | Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass); |
| 194 | |
| 195 | Return<void> acknowledgeLastIncomingGsmSms(int32_t serial, |
| 196 | bool success, SmsAcknowledgeFailCause cause); |
| 197 | |
| 198 | Return<void> acceptCall(int32_t serial); |
| 199 | |
| 200 | Return<void> deactivateDataCall(int32_t serial, |
| 201 | int32_t cid, bool reasonRadioShutDown); |
| 202 | |
| 203 | Return<void> getFacilityLockForApp(int32_t serial, |
| 204 | const ::android::hardware::hidl_string& facility, |
| 205 | const ::android::hardware::hidl_string& password, |
| 206 | int32_t serviceClass, |
| 207 | const ::android::hardware::hidl_string& appId); |
| 208 | |
| 209 | Return<void> setFacilityLockForApp(int32_t serial, |
| 210 | const ::android::hardware::hidl_string& facility, |
| 211 | bool lockState, |
| 212 | const ::android::hardware::hidl_string& password, |
| 213 | int32_t serviceClass, |
| 214 | const ::android::hardware::hidl_string& appId); |
| 215 | |
| 216 | Return<void> setBarringPassword(int32_t serial, |
| 217 | const ::android::hardware::hidl_string& facility, |
| 218 | const ::android::hardware::hidl_string& oldPassword, |
| 219 | const ::android::hardware::hidl_string& newPassword); |
| 220 | |
| 221 | Return<void> getNetworkSelectionMode(int32_t serial); |
| 222 | |
| 223 | Return<void> setNetworkSelectionModeAutomatic(int32_t serial); |
| 224 | |
| 225 | Return<void> setNetworkSelectionModeManual(int32_t serial, |
| 226 | const ::android::hardware::hidl_string& operatorNumeric); |
| 227 | |
| 228 | Return<void> getAvailableNetworks(int32_t serial); |
| 229 | |
| 230 | Return<void> startDtmf(int32_t serial, |
| 231 | const ::android::hardware::hidl_string& s); |
| 232 | |
| 233 | Return<void> stopDtmf(int32_t serial); |
| 234 | |
| 235 | Return<void> getBasebandVersion(int32_t serial); |
| 236 | |
| 237 | Return<void> separateConnection(int32_t serial, int32_t gsmIndex); |
| 238 | |
| 239 | Return<void> setMute(int32_t serial, bool enable); |
| 240 | |
| 241 | Return<void> getMute(int32_t serial); |
| 242 | |
| 243 | Return<void> getClip(int32_t serial); |
| 244 | |
| 245 | Return<void> getDataCallList(int32_t serial); |
| 246 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 247 | Return<void> sendScreenState(int32_t serial, bool enable); |
| 248 | |
| 249 | Return<void> setSuppServiceNotifications(int32_t serial, bool enable); |
| 250 | |
| 251 | Return<void> writeSmsToSim(int32_t serial, |
| 252 | const SmsWriteArgs& smsWriteArgs); |
| 253 | |
| 254 | Return<void> deleteSmsOnSim(int32_t serial, int32_t index); |
| 255 | |
| 256 | Return<void> setBandMode(int32_t serial, RadioBandMode mode); |
| 257 | |
| 258 | Return<void> getAvailableBandModes(int32_t serial); |
| 259 | |
| 260 | Return<void> sendEnvelope(int32_t serial, |
| 261 | const ::android::hardware::hidl_string& command); |
| 262 | |
| 263 | Return<void> sendTerminalResponseToSim(int32_t serial, |
| 264 | const ::android::hardware::hidl_string& commandResponse); |
| 265 | |
| 266 | Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept); |
| 267 | |
| 268 | Return<void> explicitCallTransfer(int32_t serial); |
| 269 | |
| 270 | Return<void> setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType); |
| 271 | |
| 272 | Return<void> getPreferredNetworkType(int32_t serial); |
| 273 | |
| 274 | Return<void> getNeighboringCids(int32_t serial); |
| 275 | |
| 276 | Return<void> setLocationUpdates(int32_t serial, bool enable); |
| 277 | |
| 278 | Return<void> setCdmaSubscriptionSource(int32_t serial, |
| 279 | CdmaSubscriptionSource cdmaSub); |
| 280 | |
| 281 | Return<void> setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type); |
| 282 | |
| 283 | Return<void> getCdmaRoamingPreference(int32_t serial); |
| 284 | |
| 285 | Return<void> setTTYMode(int32_t serial, TtyMode mode); |
| 286 | |
| 287 | Return<void> getTTYMode(int32_t serial); |
| 288 | |
| 289 | Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable); |
| 290 | |
| 291 | Return<void> getPreferredVoicePrivacy(int32_t serial); |
| 292 | |
| 293 | Return<void> sendCDMAFeatureCode(int32_t serial, |
| 294 | const ::android::hardware::hidl_string& featureCode); |
| 295 | |
| 296 | Return<void> sendBurstDtmf(int32_t serial, |
| 297 | const ::android::hardware::hidl_string& dtmf, |
| 298 | int32_t on, |
| 299 | int32_t off); |
| 300 | |
| 301 | Return<void> sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms); |
| 302 | |
| 303 | Return<void> acknowledgeLastIncomingCdmaSms(int32_t serial, |
| 304 | const CdmaSmsAck& smsAck); |
| 305 | |
| 306 | Return<void> getGsmBroadcastConfig(int32_t serial); |
| 307 | |
| 308 | Return<void> setGsmBroadcastConfig(int32_t serial, |
| 309 | const hidl_vec<GsmBroadcastSmsConfigInfo>& configInfo); |
| 310 | |
| 311 | Return<void> setGsmBroadcastActivation(int32_t serial, bool activate); |
| 312 | |
| 313 | Return<void> getCdmaBroadcastConfig(int32_t serial); |
| 314 | |
| 315 | Return<void> setCdmaBroadcastConfig(int32_t serial, |
| 316 | const hidl_vec<CdmaBroadcastSmsConfigInfo>& configInfo); |
| 317 | |
| 318 | Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate); |
| 319 | |
| 320 | Return<void> getCDMASubscription(int32_t serial); |
| 321 | |
| 322 | Return<void> writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms); |
| 323 | |
| 324 | Return<void> deleteSmsOnRuim(int32_t serial, int32_t index); |
| 325 | |
| 326 | Return<void> getDeviceIdentity(int32_t serial); |
| 327 | |
| 328 | Return<void> exitEmergencyCallbackMode(int32_t serial); |
| 329 | |
| 330 | Return<void> getSmscAddress(int32_t serial); |
| 331 | |
| 332 | Return<void> setSmscAddress(int32_t serial, |
| 333 | const ::android::hardware::hidl_string& smsc); |
| 334 | |
| 335 | Return<void> reportSmsMemoryStatus(int32_t serial, bool available); |
| 336 | |
| 337 | Return<void> reportStkServiceIsRunning(int32_t serial); |
| 338 | |
| 339 | Return<void> getCdmaSubscriptionSource(int32_t serial); |
| 340 | |
| 341 | Return<void> requestIsimAuthentication(int32_t serial, |
| 342 | const ::android::hardware::hidl_string& challenge); |
| 343 | |
| 344 | Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, |
| 345 | bool success, |
| 346 | const ::android::hardware::hidl_string& ackPdu); |
| 347 | |
| 348 | Return<void> sendEnvelopeWithStatus(int32_t serial, |
| 349 | const ::android::hardware::hidl_string& contents); |
| 350 | |
| 351 | Return<void> getVoiceRadioTechnology(int32_t serial); |
| 352 | |
| 353 | Return<void> getCellInfoList(int32_t serial); |
| 354 | |
| 355 | Return<void> setCellInfoListRate(int32_t serial, int32_t rate); |
| 356 | |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 357 | Return<void> setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 358 | bool modemCognitive, bool isRoaming); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 359 | |
| 360 | Return<void> getImsRegistrationState(int32_t serial); |
| 361 | |
| 362 | Return<void> sendImsSms(int32_t serial, const ImsSmsMessage& message); |
| 363 | |
| 364 | Return<void> iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message); |
| 365 | |
| 366 | Return<void> iccOpenLogicalChannel(int32_t serial, |
| 367 | const ::android::hardware::hidl_string& aid); |
| 368 | |
| 369 | Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId); |
| 370 | |
| 371 | Return<void> iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message); |
| 372 | |
| 373 | Return<void> nvReadItem(int32_t serial, NvItem itemId); |
| 374 | |
| 375 | Return<void> nvWriteItem(int32_t serial, const NvWriteItem& item); |
| 376 | |
| 377 | Return<void> nvWriteCdmaPrl(int32_t serial, |
| 378 | const ::android::hardware::hidl_vec<uint8_t>& prl); |
| 379 | |
| 380 | Return<void> nvResetConfig(int32_t serial, ResetNvType resetType); |
| 381 | |
| 382 | Return<void> setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub); |
| 383 | |
| 384 | Return<void> setDataAllowed(int32_t serial, bool allow); |
| 385 | |
| 386 | Return<void> getHardwareConfig(int32_t serial); |
| 387 | |
| 388 | Return<void> requestIccSimAuthentication(int32_t serial, |
| 389 | int32_t authContext, |
| 390 | const ::android::hardware::hidl_string& authData, |
| 391 | const ::android::hardware::hidl_string& aid); |
| 392 | |
| 393 | Return<void> setDataProfile(int32_t serial, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 394 | const ::android::hardware::hidl_vec<DataProfileInfo>& profiles, bool isRoaming); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 395 | |
| 396 | Return<void> requestShutdown(int32_t serial); |
| 397 | |
| 398 | Return<void> getRadioCapability(int32_t serial); |
| 399 | |
| 400 | Return<void> setRadioCapability(int32_t serial, const RadioCapability& rc); |
| 401 | |
| 402 | Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode); |
| 403 | |
| 404 | Return<void> stopLceService(int32_t serial); |
| 405 | |
| 406 | Return<void> pullLceData(int32_t serial); |
| 407 | |
| 408 | Return<void> getModemActivityInfo(int32_t serial); |
| 409 | |
| 410 | Return<void> setAllowedCarriers(int32_t serial, |
| 411 | bool allAllowed, |
| 412 | const CarrierRestrictions& carriers); |
| 413 | |
| 414 | Return<void> getAllowedCarriers(int32_t serial); |
| 415 | |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 416 | Return<void> sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state); |
| 417 | |
| 418 | Return<void> setIndicationFilter(int32_t serial, int32_t indicationFilter); |
| 419 | |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 420 | Return<void> setSimCardPower(int32_t serial, bool powerUp); |
| 421 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 422 | Return<void> responseAcknowledgement(); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 423 | |
| 424 | void checkReturnStatus(Return<void>& ret); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 425 | }; |
| 426 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 427 | struct OemHookImpl : public IOemHook { |
| 428 | int32_t mSlotId; |
| 429 | sp<IOemHookResponse> mOemHookResponse; |
| 430 | sp<IOemHookIndication> mOemHookIndication; |
| 431 | |
| 432 | Return<void> setResponseFunctions( |
| 433 | const ::android::sp<IOemHookResponse>& oemHookResponse, |
| 434 | const ::android::sp<IOemHookIndication>& oemHookIndication); |
| 435 | |
| 436 | Return<void> sendRequestRaw(int32_t serial, |
| 437 | const ::android::hardware::hidl_vec<uint8_t>& data); |
| 438 | |
| 439 | Return<void> sendRequestStrings(int32_t serial, |
| 440 | const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data); |
| 441 | }; |
| 442 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 443 | void memsetAndFreeStrings(int numPointers, ...) { |
| 444 | va_list ap; |
| 445 | va_start(ap, numPointers); |
| 446 | for (int i = 0; i < numPointers; i++) { |
| 447 | char *ptr = va_arg(ap, char *); |
| 448 | if (ptr) { |
| 449 | #ifdef MEMSET_FREED |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 450 | // TODO: Should pass in the maximum length of the string |
| 451 | memsetString(ptr); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 452 | #endif |
| 453 | free(ptr); |
| 454 | } |
| 455 | } |
| 456 | va_end(ap); |
| 457 | } |
| 458 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 459 | void sendErrorResponse(RequestInfo *pRI, RIL_Errno err) { |
| 460 | android::Parcel p; // TODO: should delete this after translation of all commands is complete |
| 461 | pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber, |
| 462 | (int) RadioResponseType::SOLICITED, pRI->token, err, NULL, 0); |
| 463 | } |
| 464 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 465 | /** |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 466 | * Copies over src to dest. If memory allocation fails, responseFunction() is called for the |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 467 | * request with error RIL_E_NO_MEMORY. |
| 468 | * Returns true on success, and false on failure. |
| 469 | */ |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 470 | bool copyHidlStringToRil(char **dest, const hidl_string &src, RequestInfo *pRI) { |
| 471 | size_t len = src.size(); |
| 472 | if (len == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 473 | *dest = NULL; |
| 474 | return true; |
| 475 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 476 | *dest = (char *) calloc(len + 1, sizeof(char)); |
| 477 | if (*dest == NULL) { |
| 478 | RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 479 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 480 | return false; |
| 481 | } |
| 482 | strncpy(*dest, src, len + 1); |
| 483 | return true; |
| 484 | } |
| 485 | |
| 486 | hidl_string convertCharPtrToHidlString(const char *ptr) { |
| 487 | hidl_string ret; |
| 488 | if (ptr != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 489 | // TODO: replace this with strnlen |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 490 | ret.setToExternal(ptr, strlen(ptr)); |
| 491 | } |
| 492 | return ret; |
| 493 | } |
| 494 | |
| 495 | bool dispatchVoid(int serial, int slotId, int request) { |
| 496 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 497 | if (pRI == NULL) { |
| 498 | return false; |
| 499 | } |
| 500 | s_vendorFunctions->onRequest(request, NULL, 0, pRI); |
| 501 | return true; |
| 502 | } |
| 503 | |
| 504 | bool dispatchString(int serial, int slotId, int request, const char * str) { |
| 505 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 506 | if (pRI == NULL) { |
| 507 | return false; |
| 508 | } |
| 509 | |
| 510 | char *pString; |
| 511 | if (!copyHidlStringToRil(&pString, str, pRI)) { |
| 512 | return false; |
| 513 | } |
| 514 | |
| 515 | s_vendorFunctions->onRequest(request, pString, sizeof(char *), pRI); |
| 516 | |
| 517 | memsetAndFreeStrings(1, pString); |
| 518 | return true; |
| 519 | } |
| 520 | |
| 521 | bool dispatchStrings(int serial, int slotId, int request, int countStrings, ...) { |
| 522 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 523 | if (pRI == NULL) { |
| 524 | return false; |
| 525 | } |
| 526 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 527 | char **pStrings; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 528 | pStrings = (char **)calloc(countStrings, sizeof(char *)); |
| 529 | if (pStrings == NULL) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 530 | RLOGE("Memory allocation failed for request %s", requestToString(request)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 531 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 532 | return false; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 533 | } |
| 534 | va_list ap; |
| 535 | va_start(ap, countStrings); |
| 536 | for (int i = 0; i < countStrings; i++) { |
| 537 | const char* str = va_arg(ap, const char *); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 538 | if (!copyHidlStringToRil(&pStrings[i], str, pRI)) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 539 | va_end(ap); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 540 | for (int j = 0; j < i; j++) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 541 | memsetAndFreeStrings(1, pStrings[j]); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 542 | } |
| 543 | free(pStrings); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 544 | return false; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 545 | } |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 546 | } |
| 547 | va_end(ap); |
| 548 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 549 | s_vendorFunctions->onRequest(request, pStrings, countStrings * sizeof(char *), pRI); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 550 | |
| 551 | if (pStrings != NULL) { |
| 552 | for (int i = 0 ; i < countStrings ; i++) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 553 | memsetAndFreeStrings(1, pStrings[i]); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 554 | } |
| 555 | |
| 556 | #ifdef MEMSET_FREED |
| 557 | memset(pStrings, 0, countStrings * sizeof(char *)); |
| 558 | #endif |
| 559 | free(pStrings); |
| 560 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 561 | return true; |
| 562 | } |
| 563 | |
| 564 | bool dispatchStrings(int serial, int slotId, int request, const hidl_vec<hidl_string>& data) { |
| 565 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 566 | if (pRI == NULL) { |
| 567 | return false; |
| 568 | } |
| 569 | |
| 570 | int countStrings = data.size(); |
| 571 | char **pStrings; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 572 | pStrings = (char **)calloc(countStrings, sizeof(char *)); |
| 573 | if (pStrings == NULL) { |
| 574 | RLOGE("Memory allocation failed for request %s", requestToString(request)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 575 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 576 | return false; |
| 577 | } |
| 578 | |
| 579 | for (int i = 0; i < countStrings; i++) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 580 | if (!copyHidlStringToRil(&pStrings[i], data[i], pRI)) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 581 | for (int j = 0; j < i; j++) { |
| 582 | memsetAndFreeStrings(1, pStrings[j]); |
| 583 | } |
| 584 | free(pStrings); |
| 585 | return false; |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | s_vendorFunctions->onRequest(request, pStrings, countStrings * sizeof(char *), pRI); |
| 590 | |
| 591 | if (pStrings != NULL) { |
| 592 | for (int i = 0 ; i < countStrings ; i++) { |
| 593 | memsetAndFreeStrings(1, pStrings[i]); |
| 594 | } |
| 595 | |
| 596 | #ifdef MEMSET_FREED |
| 597 | memset(pStrings, 0, countStrings * sizeof(char *)); |
| 598 | #endif |
| 599 | free(pStrings); |
| 600 | } |
| 601 | return true; |
| 602 | } |
| 603 | |
| 604 | bool dispatchInts(int serial, int slotId, int request, int countInts, ...) { |
| 605 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 606 | if (pRI == NULL) { |
| 607 | return false; |
| 608 | } |
| 609 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 610 | int *pInts = (int *)calloc(countInts, sizeof(int)); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 611 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 612 | if (pInts == NULL) { |
| 613 | RLOGE("Memory allocation failed for request %s", requestToString(request)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 614 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 615 | return false; |
| 616 | } |
| 617 | va_list ap; |
| 618 | va_start(ap, countInts); |
| 619 | for (int i = 0; i < countInts; i++) { |
| 620 | pInts[i] = va_arg(ap, int); |
| 621 | } |
| 622 | va_end(ap); |
| 623 | |
| 624 | s_vendorFunctions->onRequest(request, pInts, countInts * sizeof(int), pRI); |
| 625 | |
| 626 | if (pInts != NULL) { |
| 627 | #ifdef MEMSET_FREED |
| 628 | memset(pInts, 0, countInts * sizeof(int)); |
| 629 | #endif |
| 630 | free(pInts); |
| 631 | } |
| 632 | return true; |
| 633 | } |
| 634 | |
| 635 | bool dispatchCallForwardStatus(int serial, int slotId, int request, |
| 636 | const CallForwardInfo& callInfo) { |
| 637 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 638 | if (pRI == NULL) { |
| 639 | return false; |
| 640 | } |
| 641 | |
| 642 | RIL_CallForwardInfo cf; |
| 643 | cf.status = (int) callInfo.status; |
| 644 | cf.reason = callInfo.reason; |
| 645 | cf.serviceClass = callInfo.serviceClass; |
| 646 | cf.toa = callInfo.toa; |
| 647 | cf.timeSeconds = callInfo.timeSeconds; |
| 648 | |
| 649 | if (!copyHidlStringToRil(&cf.number, callInfo.number, pRI)) { |
| 650 | return false; |
| 651 | } |
| 652 | |
| 653 | s_vendorFunctions->onRequest(request, &cf, sizeof(cf), pRI); |
| 654 | |
| 655 | memsetAndFreeStrings(1, cf.number); |
| 656 | |
| 657 | return true; |
| 658 | } |
| 659 | |
| 660 | bool dispatchRaw(int serial, int slotId, int request, const hidl_vec<uint8_t>& rawBytes) { |
| 661 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 662 | if (pRI == NULL) { |
| 663 | return false; |
| 664 | } |
| 665 | |
| 666 | const uint8_t *uData = rawBytes.data(); |
| 667 | |
| 668 | s_vendorFunctions->onRequest(request, (void *) uData, rawBytes.size(), pRI); |
| 669 | |
| 670 | return true; |
| 671 | } |
| 672 | |
| 673 | bool dispatchIccApdu(int serial, int slotId, int request, const SimApdu& message) { |
| 674 | RequestInfo *pRI = android::addRequestToList(serial, slotId, request); |
| 675 | if (pRI == NULL) { |
| 676 | return false; |
| 677 | } |
| 678 | |
| 679 | RIL_SIM_APDU apdu; |
| 680 | memset (&apdu, 0, sizeof(RIL_SIM_APDU)); |
| 681 | |
| 682 | apdu.sessionid = message.sessionId; |
| 683 | apdu.cla = message.cla; |
| 684 | apdu.instruction = message.instruction; |
| 685 | apdu.p1 = message.p1; |
| 686 | apdu.p2 = message.p2; |
| 687 | apdu.p3 = message.p3; |
| 688 | |
| 689 | if (!copyHidlStringToRil(&apdu.data, message.data, pRI)) { |
| 690 | return false; |
| 691 | } |
| 692 | |
| 693 | s_vendorFunctions->onRequest(request, &apdu, sizeof(apdu), pRI); |
| 694 | |
| 695 | memsetAndFreeStrings(1, apdu.data); |
| 696 | |
| 697 | return true; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 698 | } |
| 699 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 700 | void checkReturnStatus(int32_t slotId, Return<void>& ret) { |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 701 | if (ret.isOk() == false) { |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 702 | RLOGE("checkReturnStatus: unable to call response/indication callback"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 703 | // Remote process hosting the callbacks must be dead. Reset the callback objects; |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 704 | // there's no other recovery to be done here. When the client process is back up, it will |
| 705 | // call setResponseFunctions() |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 706 | |
| 707 | // Caller should already hold rdlock, release that first |
| 708 | // note the current counter to avoid overwriting updates made by another thread before |
| 709 | // write lock is acquired. |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 710 | int counter = mCounter[slotId]; |
| 711 | pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(slotId); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 712 | int ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 713 | assert(ret == 0); |
| 714 | |
| 715 | // acquire wrlock |
| 716 | ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 717 | assert(ret == 0); |
| 718 | |
| 719 | // make sure the counter value has not changed |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 720 | if (counter == mCounter[slotId]) { |
| 721 | radioService[slotId]->mRadioResponse = NULL; |
| 722 | radioService[slotId]->mRadioIndication = NULL; |
| 723 | oemHookService[slotId]->mOemHookResponse = NULL; |
| 724 | oemHookService[slotId]->mOemHookIndication = NULL; |
| 725 | mCounter[slotId]++; |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 726 | } else { |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 727 | RLOGE("checkReturnStatus: not resetting responseFunctions as they likely " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 728 | "got updated on another thread"); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 729 | } |
| 730 | |
| 731 | // release wrlock |
| 732 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 733 | assert(ret == 0); |
| 734 | |
| 735 | // Reacquire rdlock |
| 736 | ret = pthread_rwlock_rdlock(radioServiceRwlockPtr); |
| 737 | assert(ret == 0); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 738 | } |
| 739 | } |
| 740 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 741 | void RadioImpl::checkReturnStatus(Return<void>& ret) { |
| 742 | ::checkReturnStatus(mSlotId, ret); |
| 743 | } |
| 744 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 745 | Return<void> RadioImpl::setResponseFunctions( |
| 746 | const ::android::sp<IRadioResponse>& radioResponseParam, |
| 747 | const ::android::sp<IRadioIndication>& radioIndicationParam) { |
| 748 | RLOGD("RadioImpl::setResponseFunctions"); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 749 | |
| 750 | pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); |
| 751 | int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 752 | assert(ret == 0); |
| 753 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 754 | mRadioResponse = radioResponseParam; |
| 755 | mRadioIndication = radioIndicationParam; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 756 | mCounter[mSlotId]++; |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 757 | |
| 758 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 759 | assert(ret == 0); |
| 760 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 761 | return Void(); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | Return<void> RadioImpl::getIccCardStatus(int32_t serial) { |
| 765 | RLOGD("RadioImpl::getIccCardStatus: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 766 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_SIM_STATUS); |
| 767 | return Void(); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 768 | } |
| 769 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 770 | Return<void> RadioImpl::supplyIccPinForApp(int32_t serial, const hidl_string& pin, |
| 771 | const hidl_string& aid) { |
| 772 | RLOGD("RadioImpl::supplyIccPinForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 773 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN, |
| 774 | 2, (const char *)pin, (const char *)aid); |
| 775 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 776 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 777 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 778 | Return<void> RadioImpl::supplyIccPukForApp(int32_t serial, const hidl_string& puk, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 779 | const hidl_string& pin, const hidl_string& aid) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 780 | RLOGD("RadioImpl::supplyIccPukForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 781 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK, |
| 782 | 3, (const char *)puk, (const char *)pin, (const char *)aid); |
| 783 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 784 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 785 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 786 | Return<void> RadioImpl::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 787 | const hidl_string& aid) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 788 | RLOGD("RadioImpl::supplyIccPin2ForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 789 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN2, |
| 790 | 2, (const char *)pin2, (const char *)aid); |
| 791 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | Return<void> RadioImpl::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 795 | const hidl_string& pin2, const hidl_string& aid) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 796 | RLOGD("RadioImpl::supplyIccPuk2ForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 797 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK2, |
| 798 | 3, (const char *)puk2, (const char *)pin2, (const char *)aid); |
| 799 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 800 | } |
| 801 | |
| 802 | Return<void> RadioImpl::changeIccPinForApp(int32_t serial, const hidl_string& oldPin, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 803 | const hidl_string& newPin, const hidl_string& aid) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 804 | RLOGD("RadioImpl::changeIccPinForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 805 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN, |
| 806 | 3, (const char *)oldPin, (const char *)newPin, (const char *)aid); |
| 807 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 808 | } |
| 809 | |
| 810 | Return<void> RadioImpl::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 811 | const hidl_string& newPin2, const hidl_string& aid) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 812 | RLOGD("RadioImpl::changeIccPin2ForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 813 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN2, |
| 814 | 3, (const char *)oldPin2, (const char *)newPin2, (const char *)aid); |
| 815 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 816 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 817 | |
| 818 | Return<void> RadioImpl::supplyNetworkDepersonalization(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 819 | const hidl_string& netPin) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 820 | RLOGD("RadioImpl::supplyNetworkDepersonalization: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 821 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, |
| 822 | 1, (const char *)netPin); |
| 823 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 824 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 825 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 826 | Return<void> RadioImpl::getCurrentCalls(int32_t serial) { |
| 827 | RLOGD("RadioImpl::getCurrentCalls: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 828 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CURRENT_CALLS); |
| 829 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | Return<void> RadioImpl::dial(int32_t serial, const Dial& dialInfo) { |
| 833 | RLOGD("RadioImpl::dial: serial %d", serial); |
| 834 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_DIAL); |
| 835 | if (pRI == NULL) { |
| 836 | return Void(); |
| 837 | } |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 838 | RIL_Dial dial = {}; |
| 839 | RIL_UUS_Info uusInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 840 | int32_t sizeOfDial = sizeof(dial); |
| 841 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 842 | if (!copyHidlStringToRil(&dial.address, dialInfo.address, pRI)) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 843 | return Void(); |
| 844 | } |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 845 | dial.clir = (int) dialInfo.clir; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 846 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 847 | if (dialInfo.uusInfo.size() != 0) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 848 | uusInfo.uusType = (RIL_UUS_Type) dialInfo.uusInfo[0].uusType; |
| 849 | uusInfo.uusDcs = (RIL_UUS_DCS) dialInfo.uusInfo[0].uusDcs; |
| 850 | |
| 851 | if (dialInfo.uusInfo[0].uusData.size() == 0) { |
| 852 | uusInfo.uusData = NULL; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 853 | uusInfo.uusLength = 0; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 854 | } else { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 855 | if (!copyHidlStringToRil(&uusInfo.uusData, dialInfo.uusInfo[0].uusData, pRI)) { |
| 856 | memsetAndFreeStrings(1, dial.address); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 857 | return Void(); |
| 858 | } |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 859 | uusInfo.uusLength = dialInfo.uusInfo[0].uusData.size(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 860 | } |
| 861 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 862 | dial.uusInfo = &uusInfo; |
| 863 | } |
| 864 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 865 | s_vendorFunctions->onRequest(RIL_REQUEST_DIAL, &dial, sizeOfDial, pRI); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 866 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 867 | memsetAndFreeStrings(2, dial.address, uusInfo.uusData); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 868 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 869 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 870 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 871 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 872 | Return<void> RadioImpl::getImsiForApp(int32_t serial, const hidl_string& aid) { |
| 873 | RLOGD("RadioImpl::getImsiForApp: serial %d", serial); |
| 874 | dispatchStrings(serial, mSlotId, RIL_REQUEST_GET_IMSI, |
| 875 | 1, (const char *) aid); |
| 876 | return Void(); |
| 877 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 878 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 879 | Return<void> RadioImpl::hangup(int32_t serial, int32_t gsmIndex) { |
| 880 | RLOGD("RadioImpl::hangup: serial %d", serial); |
| 881 | dispatchInts(serial, mSlotId, RIL_REQUEST_HANGUP, 1, gsmIndex); |
| 882 | return Void(); |
| 883 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 884 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 885 | Return<void> RadioImpl::hangupWaitingOrBackground(int32_t serial) { |
| 886 | RLOGD("RadioImpl::hangupWaitingOrBackground: serial %d", serial); |
| 887 | dispatchVoid(serial, mSlotId, RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND); |
| 888 | return Void(); |
| 889 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 890 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 891 | Return<void> RadioImpl::hangupForegroundResumeBackground(int32_t serial) { |
| 892 | RLOGD("RadioImpl::hangupForegroundResumeBackground: serial %d", serial); |
| 893 | dispatchVoid(serial, mSlotId, RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND); |
| 894 | return Void(); |
| 895 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 896 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 897 | Return<void> RadioImpl::switchWaitingOrHoldingAndActive(int32_t serial) { |
| 898 | RLOGD("RadioImpl::switchWaitingOrHoldingAndActive: serial %d", serial); |
| 899 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE); |
| 900 | return Void(); |
| 901 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 902 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 903 | Return<void> RadioImpl::conference(int32_t serial) { |
| 904 | RLOGD("RadioImpl::conference: serial %d", serial); |
| 905 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CONFERENCE); |
| 906 | return Void(); |
| 907 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 908 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 909 | Return<void> RadioImpl::rejectCall(int32_t serial) { |
| 910 | RLOGD("RadioImpl::rejectCall: serial %d", serial); |
| 911 | dispatchVoid(serial, mSlotId, RIL_REQUEST_UDUB); |
| 912 | return Void(); |
| 913 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 914 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 915 | Return<void> RadioImpl::getLastCallFailCause(int32_t serial) { |
| 916 | RLOGD("RadioImpl::getLastCallFailCause: serial %d", serial); |
| 917 | dispatchVoid(serial, mSlotId, RIL_REQUEST_LAST_CALL_FAIL_CAUSE); |
| 918 | return Void(); |
| 919 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 920 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 921 | Return<void> RadioImpl::getSignalStrength(int32_t serial) { |
| 922 | RLOGD("RadioImpl::getSignalStrength: serial %d", serial); |
| 923 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SIGNAL_STRENGTH); |
| 924 | return Void(); |
| 925 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 926 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 927 | Return<void> RadioImpl::getVoiceRegistrationState(int32_t serial) { |
| 928 | RLOGD("RadioImpl::getVoiceRegistrationState: serial %d", serial); |
| 929 | dispatchVoid(serial, mSlotId, RIL_REQUEST_VOICE_REGISTRATION_STATE); |
| 930 | return Void(); |
| 931 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 932 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 933 | Return<void> RadioImpl::getDataRegistrationState(int32_t serial) { |
| 934 | RLOGD("RadioImpl::getDataRegistrationState: serial %d", serial); |
| 935 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DATA_REGISTRATION_STATE); |
| 936 | return Void(); |
| 937 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 938 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 939 | Return<void> RadioImpl::getOperator(int32_t serial) { |
| 940 | RLOGD("RadioImpl::getOperator: serial %d", serial); |
| 941 | dispatchVoid(serial, mSlotId, RIL_REQUEST_OPERATOR); |
| 942 | return Void(); |
| 943 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 944 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 945 | Return<void> RadioImpl::setRadioPower(int32_t serial, bool on) { |
| 946 | RLOGD("RadioImpl::setRadioPower: serial %d on %d", serial, on); |
| 947 | dispatchInts(serial, mSlotId, RIL_REQUEST_RADIO_POWER, 1, BOOL_TO_INT(on)); |
| 948 | return Void(); |
| 949 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 950 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 951 | Return<void> RadioImpl::sendDtmf(int32_t serial, const hidl_string& s) { |
| 952 | RLOGD("RadioImpl::sendDtmf: serial %d", serial); |
| 953 | dispatchString(serial, mSlotId, RIL_REQUEST_DTMF, (const char *) s); |
| 954 | return Void(); |
| 955 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 956 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 957 | Return<void> RadioImpl::sendSms(int32_t serial, const GsmSmsMessage& message) { |
| 958 | RLOGD("RadioImpl::sendSms: serial %d", serial); |
| 959 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SEND_SMS, |
| 960 | 2, (const char *) message.smscPdu, (const char *) message.pdu); |
| 961 | return Void(); |
| 962 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 963 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 964 | Return<void> RadioImpl::sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message) { |
| 965 | RLOGD("RadioImpl::sendSMSExpectMore: serial %d", serial); |
| 966 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SEND_SMS_EXPECT_MORE, |
| 967 | 2, (const char *) message.smscPdu, (const char *) message.pdu); |
| 968 | return Void(); |
| 969 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 970 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 971 | const char *convertMvnoTypeToString(MvnoType type) { |
| 972 | switch (type) { |
| 973 | case MvnoType::IMSI: return "imsi"; |
| 974 | case MvnoType::GID: return "gid"; |
| 975 | case MvnoType::SPN: return "spn"; |
| 976 | default: return NULL; |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | Return<void> RadioImpl::setupDataCall(int32_t serial, RadioTechnology radioTechnology, |
| 981 | const DataProfileInfo& dataProfileInfo, bool modemCognitive, |
| 982 | bool roamingAllowed, bool isRoaming) { |
| 983 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 984 | RLOGD("RadioImpl::setupDataCall: serial %d", serial); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 985 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 986 | if (s_vendorFunctions->version >= 4 && s_vendorFunctions->version <= 14) { |
| 987 | const hidl_string &protocol = |
| 988 | (isRoaming ? dataProfileInfo.roamingProtocol : dataProfileInfo.protocol); |
| 989 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 7, |
| 990 | std::to_string((int) radioTechnology + 2).c_str(), |
| 991 | std::to_string((int) dataProfileInfo.profileId).c_str(), |
| 992 | dataProfileInfo.apn.c_str(), |
| 993 | dataProfileInfo.user.c_str(), |
| 994 | dataProfileInfo.password.c_str(), |
| 995 | std::to_string((int) dataProfileInfo.authType).c_str(), |
| 996 | protocol.c_str()); |
| 997 | } else if (s_vendorFunctions->version >= 15) { |
| 998 | const char *mvnoTypeStr = convertMvnoTypeToString(dataProfileInfo.mvnoType); |
| 999 | if (mvnoTypeStr == NULL) { |
| 1000 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1001 | RIL_REQUEST_SETUP_DATA_CALL); |
| 1002 | if (pRI != NULL) { |
| 1003 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
| 1004 | } |
| 1005 | return Void(); |
| 1006 | } |
| 1007 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 15, |
| 1008 | std::to_string((int) radioTechnology + 2).c_str(), |
| 1009 | std::to_string((int) dataProfileInfo.profileId).c_str(), |
| 1010 | dataProfileInfo.apn.c_str(), |
| 1011 | dataProfileInfo.user.c_str(), |
| 1012 | dataProfileInfo.password.c_str(), |
| 1013 | std::to_string((int) dataProfileInfo.authType).c_str(), |
| 1014 | dataProfileInfo.protocol.c_str(), |
| 1015 | dataProfileInfo.roamingProtocol.c_str(), |
| 1016 | std::to_string(dataProfileInfo.supportedApnTypesBitmap).c_str(), |
| 1017 | std::to_string(dataProfileInfo.bearerBitmap).c_str(), |
| 1018 | BOOL_TO_INT(modemCognitive), |
| 1019 | std::to_string(dataProfileInfo.mtu).c_str(), |
| 1020 | mvnoTypeStr, |
| 1021 | dataProfileInfo.mvnoMatchData.c_str(), |
| 1022 | BOOL_TO_INT(roamingAllowed)); |
| 1023 | } else { |
| 1024 | RLOGE("Unsupported RIL version %d, min version expected 4", s_vendorFunctions->version); |
| 1025 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1026 | RIL_REQUEST_SETUP_DATA_CALL); |
| 1027 | if (pRI != NULL) { |
| 1028 | sendErrorResponse(pRI, RIL_E_REQUEST_NOT_SUPPORTED); |
| 1029 | } |
| 1030 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1031 | return Void(); |
| 1032 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1033 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1034 | Return<void> RadioImpl::iccIOForApp(int32_t serial, const IccIo& iccIo) { |
| 1035 | RLOGD("RadioImpl::iccIOForApp: serial %d", serial); |
| 1036 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SIM_IO); |
| 1037 | if (pRI == NULL) { |
| 1038 | return Void(); |
| 1039 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1040 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1041 | RIL_SIM_IO_v6 rilIccIo; |
| 1042 | rilIccIo.command = iccIo.command; |
| 1043 | rilIccIo.fileid = iccIo.fileId; |
| 1044 | if (!copyHidlStringToRil(&rilIccIo.path, iccIo.path, pRI)) { |
| 1045 | return Void(); |
| 1046 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1047 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1048 | rilIccIo.p1 = iccIo.p1; |
| 1049 | rilIccIo.p2 = iccIo.p2; |
| 1050 | rilIccIo.p3 = iccIo.p3; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1051 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1052 | if (!copyHidlStringToRil(&rilIccIo.data, iccIo.data, pRI)) { |
| 1053 | memsetAndFreeStrings(1, rilIccIo.path); |
| 1054 | return Void(); |
| 1055 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1056 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1057 | if (!copyHidlStringToRil(&rilIccIo.pin2, iccIo.pin2, pRI)) { |
| 1058 | memsetAndFreeStrings(2, rilIccIo.path, rilIccIo.data); |
| 1059 | return Void(); |
| 1060 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1061 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1062 | if (!copyHidlStringToRil(&rilIccIo.aidPtr, iccIo.aid, pRI)) { |
| 1063 | memsetAndFreeStrings(3, rilIccIo.path, rilIccIo.data, rilIccIo.pin2); |
| 1064 | return Void(); |
| 1065 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1066 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1067 | s_vendorFunctions->onRequest(RIL_REQUEST_SIM_IO, &rilIccIo, sizeof(rilIccIo), pRI); |
| 1068 | |
| 1069 | memsetAndFreeStrings(4, rilIccIo.path, rilIccIo.data, rilIccIo.pin2, rilIccIo.aidPtr); |
| 1070 | |
| 1071 | return Void(); |
| 1072 | } |
| 1073 | |
| 1074 | Return<void> RadioImpl::sendUssd(int32_t serial, const hidl_string& ussd) { |
| 1075 | RLOGD("RadioImpl::sendUssd: serial %d", serial); |
| 1076 | dispatchString(serial, mSlotId, RIL_REQUEST_SEND_USSD, (const char *) ussd); |
| 1077 | return Void(); |
| 1078 | } |
| 1079 | |
| 1080 | Return<void> RadioImpl::cancelPendingUssd(int32_t serial) { |
| 1081 | RLOGD("RadioImpl::cancelPendingUssd: serial %d", serial); |
| 1082 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CANCEL_USSD); |
| 1083 | return Void(); |
| 1084 | } |
| 1085 | |
| 1086 | Return<void> RadioImpl::getClir(int32_t serial) { |
| 1087 | RLOGD("RadioImpl::getClir: serial %d", serial); |
| 1088 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CLIR); |
| 1089 | return Void(); |
| 1090 | } |
| 1091 | |
| 1092 | Return<void> RadioImpl::setClir(int32_t serial, int32_t status) { |
| 1093 | RLOGD("RadioImpl::setClir: serial %d", serial); |
| 1094 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_CLIR, 1, status); |
| 1095 | return Void(); |
| 1096 | } |
| 1097 | |
| 1098 | Return<void> RadioImpl::getCallForwardStatus(int32_t serial, const CallForwardInfo& callInfo) { |
| 1099 | RLOGD("RadioImpl::getCallForwardStatus: serial %d", serial); |
| 1100 | dispatchCallForwardStatus(serial, mSlotId, RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, |
| 1101 | callInfo); |
| 1102 | return Void(); |
| 1103 | } |
| 1104 | |
| 1105 | Return<void> RadioImpl::setCallForward(int32_t serial, const CallForwardInfo& callInfo) { |
| 1106 | RLOGD("RadioImpl::setCallForward: serial %d", serial); |
| 1107 | dispatchCallForwardStatus(serial, mSlotId, RIL_REQUEST_SET_CALL_FORWARD, |
| 1108 | callInfo); |
| 1109 | return Void(); |
| 1110 | } |
| 1111 | |
| 1112 | Return<void> RadioImpl::getCallWaiting(int32_t serial, int32_t serviceClass) { |
| 1113 | RLOGD("RadioImpl::getCallWaiting: serial %d", serial); |
| 1114 | dispatchInts(serial, mSlotId, RIL_REQUEST_QUERY_CALL_WAITING, 1, serviceClass); |
| 1115 | return Void(); |
| 1116 | } |
| 1117 | |
| 1118 | Return<void> RadioImpl::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) { |
| 1119 | RLOGD("RadioImpl::setCallWaiting: serial %d", serial); |
| 1120 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_CALL_WAITING, 2, BOOL_TO_INT(enable), |
| 1121 | serviceClass); |
| 1122 | return Void(); |
| 1123 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1124 | |
| 1125 | Return<void> RadioImpl::acknowledgeLastIncomingGsmSms(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1126 | bool success, SmsAcknowledgeFailCause cause) { |
| 1127 | RLOGD("RadioImpl::acknowledgeLastIncomingGsmSms: serial %d", serial); |
| 1128 | dispatchInts(serial, mSlotId, RIL_REQUEST_SMS_ACKNOWLEDGE, 2, BOOL_TO_INT(success), |
| 1129 | cause); |
| 1130 | return Void(); |
| 1131 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1132 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1133 | Return<void> RadioImpl::acceptCall(int32_t serial) { |
| 1134 | RLOGD("RadioImpl::acceptCall: serial %d", serial); |
| 1135 | dispatchVoid(serial, mSlotId, RIL_REQUEST_ANSWER); |
| 1136 | return Void(); |
| 1137 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1138 | |
| 1139 | Return<void> RadioImpl::deactivateDataCall(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1140 | int32_t cid, bool reasonRadioShutDown) { |
| 1141 | RLOGD("RadioImpl::deactivateDataCall: serial %d", serial); |
| 1142 | dispatchStrings(serial, mSlotId, RIL_REQUEST_DEACTIVATE_DATA_CALL, |
| 1143 | 2, (const char *) (std::to_string(cid)).c_str(), reasonRadioShutDown ? "1" : "0"); |
| 1144 | return Void(); |
| 1145 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1146 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1147 | Return<void> RadioImpl::getFacilityLockForApp(int32_t serial, const hidl_string& facility, |
| 1148 | const hidl_string& password, int32_t serviceClass, |
| 1149 | const hidl_string& appId) { |
| 1150 | RLOGD("RadioImpl::getFacilityLockForApp: serial %d", serial); |
| 1151 | dispatchStrings(serial, mSlotId, RIL_REQUEST_QUERY_FACILITY_LOCK, |
| 1152 | 4, (const char *) facility, (const char *) password, |
| 1153 | (const char *) (std::to_string(serviceClass)).c_str(), (const char *) appId); |
| 1154 | return Void(); |
| 1155 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1156 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1157 | Return<void> RadioImpl::setFacilityLockForApp(int32_t serial, const hidl_string& facility, |
| 1158 | bool lockState, const hidl_string& password, |
| 1159 | int32_t serviceClass, const hidl_string& appId) { |
| 1160 | RLOGD("RadioImpl::setFacilityLockForApp: serial %d", serial); |
| 1161 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SET_FACILITY_LOCK, |
| 1162 | 5, (const char *) facility, lockState ? "1" : "0", (const char *) password, |
| 1163 | (const char *) (std::to_string(serviceClass)).c_str(), (const char *) appId); |
| 1164 | return Void(); |
| 1165 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1166 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1167 | Return<void> RadioImpl::setBarringPassword(int32_t serial, const hidl_string& facility, |
| 1168 | const hidl_string& oldPassword, |
| 1169 | const hidl_string& newPassword) { |
| 1170 | RLOGD("RadioImpl::setBarringPassword: serial %d", serial); |
| 1171 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_BARRING_PASSWORD, |
| 1172 | 2, (const char *) oldPassword, (const char *) newPassword); |
| 1173 | return Void(); |
| 1174 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1175 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1176 | Return<void> RadioImpl::getNetworkSelectionMode(int32_t serial) { |
| 1177 | RLOGD("RadioImpl::getNetworkSelectionMode: serial %d", serial); |
| 1178 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE); |
| 1179 | return Void(); |
| 1180 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1181 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1182 | Return<void> RadioImpl::setNetworkSelectionModeAutomatic(int32_t serial) { |
| 1183 | RLOGD("RadioImpl::setNetworkSelectionModeAutomatic: serial %d", serial); |
| 1184 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC); |
| 1185 | return Void(); |
| 1186 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1187 | |
| 1188 | Return<void> RadioImpl::setNetworkSelectionModeManual(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1189 | const hidl_string& operatorNumeric) { |
| 1190 | RLOGD("RadioImpl::setNetworkSelectionModeManual: serial %d", serial); |
| 1191 | dispatchString(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, |
| 1192 | (const char *) operatorNumeric); |
| 1193 | return Void(); |
| 1194 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1195 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1196 | Return<void> RadioImpl::getAvailableNetworks(int32_t serial) { |
| 1197 | RLOGD("RadioImpl::getAvailableNetworks: serial %d", serial); |
| 1198 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_AVAILABLE_NETWORKS); |
| 1199 | return Void(); |
| 1200 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1201 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1202 | Return<void> RadioImpl::startDtmf(int32_t serial, const hidl_string& s) { |
| 1203 | RLOGD("RadioImpl::startDtmf: serial %d", serial); |
| 1204 | dispatchString(serial, mSlotId, RIL_REQUEST_DTMF_START, |
| 1205 | (const char *) s); |
| 1206 | return Void(); |
| 1207 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1208 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1209 | Return<void> RadioImpl::stopDtmf(int32_t serial) { |
| 1210 | RLOGD("RadioImpl::stopDtmf: serial %d", serial); |
| 1211 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DTMF_STOP); |
| 1212 | return Void(); |
| 1213 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1214 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1215 | Return<void> RadioImpl::getBasebandVersion(int32_t serial) { |
| 1216 | RLOGD("RadioImpl::getBasebandVersion: serial %d", serial); |
| 1217 | dispatchVoid(serial, mSlotId, RIL_REQUEST_BASEBAND_VERSION); |
| 1218 | return Void(); |
| 1219 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1220 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1221 | Return<void> RadioImpl::separateConnection(int32_t serial, int32_t gsmIndex) { |
| 1222 | RLOGD("RadioImpl::separateConnection: serial %d", serial); |
| 1223 | dispatchInts(serial, mSlotId, RIL_REQUEST_SEPARATE_CONNECTION, 1, gsmIndex); |
| 1224 | return Void(); |
| 1225 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1226 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1227 | Return<void> RadioImpl::setMute(int32_t serial, bool enable) { |
| 1228 | RLOGD("RadioImpl::setMute: serial %d", serial); |
| 1229 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_MUTE, 1, BOOL_TO_INT(enable)); |
| 1230 | return Void(); |
| 1231 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1232 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1233 | Return<void> RadioImpl::getMute(int32_t serial) { |
| 1234 | RLOGD("RadioImpl::getMute: serial %d", serial); |
| 1235 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_MUTE); |
| 1236 | return Void(); |
| 1237 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1238 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1239 | Return<void> RadioImpl::getClip(int32_t serial) { |
| 1240 | RLOGD("RadioImpl::getClip: serial %d", serial); |
| 1241 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_CLIP); |
| 1242 | return Void(); |
| 1243 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1244 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1245 | Return<void> RadioImpl::getDataCallList(int32_t serial) { |
| 1246 | RLOGD("RadioImpl::getDataCallList: serial %d", serial); |
| 1247 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DATA_CALL_LIST); |
| 1248 | return Void(); |
| 1249 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1250 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1251 | Return<void> RadioImpl::sendScreenState(int32_t serial, bool enable) { |
| 1252 | RLOGD("RadioImpl::sendScreenState: serial %d", serial); |
| 1253 | dispatchInts(serial, mSlotId, RIL_REQUEST_SCREEN_STATE, 1, BOOL_TO_INT(enable)); |
| 1254 | return Void(); |
| 1255 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1256 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1257 | Return<void> RadioImpl::setSuppServiceNotifications(int32_t serial, bool enable) { |
| 1258 | RLOGD("RadioImpl::setSuppServiceNotifications: serial %d", serial); |
| 1259 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, 1, |
| 1260 | BOOL_TO_INT(enable)); |
| 1261 | return Void(); |
| 1262 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1263 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1264 | Return<void> RadioImpl::writeSmsToSim(int32_t serial, const SmsWriteArgs& smsWriteArgs) { |
| 1265 | RLOGD("RadioImpl::writeSmsToSim: serial %d", serial); |
| 1266 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_WRITE_SMS_TO_SIM); |
| 1267 | if (pRI == NULL) { |
| 1268 | return Void(); |
| 1269 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1270 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1271 | RIL_SMS_WriteArgs args; |
| 1272 | args.status = (int) smsWriteArgs.status; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1273 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1274 | int len; |
| 1275 | if (!copyHidlStringToRil(&args.pdu, smsWriteArgs.pdu, pRI)) { |
| 1276 | return Void(); |
| 1277 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1278 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1279 | if (!copyHidlStringToRil(&args.smsc, smsWriteArgs.smsc, pRI)) { |
| 1280 | memsetAndFreeStrings(1, args.pdu); |
| 1281 | return Void(); |
| 1282 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1283 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1284 | s_vendorFunctions->onRequest(RIL_REQUEST_WRITE_SMS_TO_SIM, &args, sizeof(args), pRI); |
| 1285 | |
| 1286 | memsetAndFreeStrings(2, args.smsc, args.pdu); |
| 1287 | |
| 1288 | return Void(); |
| 1289 | } |
| 1290 | |
| 1291 | Return<void> RadioImpl::deleteSmsOnSim(int32_t serial, int32_t index) { |
| 1292 | RLOGD("RadioImpl::deleteSmsOnSim: serial %d", serial); |
| 1293 | dispatchInts(serial, mSlotId, RIL_REQUEST_DELETE_SMS_ON_SIM, 1, index); |
| 1294 | return Void(); |
| 1295 | } |
| 1296 | |
| 1297 | Return<void> RadioImpl::setBandMode(int32_t serial, RadioBandMode mode) { |
| 1298 | RLOGD("RadioImpl::setBandMode: serial %d", serial); |
| 1299 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_BAND_MODE, 1, mode); |
| 1300 | return Void(); |
| 1301 | } |
| 1302 | |
| 1303 | Return<void> RadioImpl::getAvailableBandModes(int32_t serial) { |
| 1304 | RLOGD("RadioImpl::getAvailableBandModes: serial %d", serial); |
| 1305 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE); |
| 1306 | return Void(); |
| 1307 | } |
| 1308 | |
| 1309 | Return<void> RadioImpl::sendEnvelope(int32_t serial, const hidl_string& command) { |
| 1310 | RLOGD("RadioImpl::sendEnvelope: serial %d", serial); |
| 1311 | dispatchString(serial, mSlotId, RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, |
| 1312 | (const char *) command); |
| 1313 | return Void(); |
| 1314 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1315 | |
| 1316 | Return<void> RadioImpl::sendTerminalResponseToSim(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1317 | const hidl_string& commandResponse) { |
| 1318 | RLOGD("RadioImpl::sendTerminalResponseToSim: serial %d", serial); |
| 1319 | dispatchString(serial, mSlotId, RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, |
| 1320 | (const char *) commandResponse); |
| 1321 | return Void(); |
| 1322 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1323 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1324 | Return<void> RadioImpl::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) { |
| 1325 | RLOGD("RadioImpl::handleStkCallSetupRequestFromSim: serial %d", serial); |
| 1326 | dispatchInts(serial, mSlotId, RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, |
| 1327 | 1, BOOL_TO_INT(accept)); |
| 1328 | return Void(); |
| 1329 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1330 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1331 | Return<void> RadioImpl::explicitCallTransfer(int32_t serial) { |
| 1332 | RLOGD("RadioImpl::explicitCallTransfer: serial %d", serial); |
| 1333 | dispatchVoid(serial, mSlotId, RIL_REQUEST_EXPLICIT_CALL_TRANSFER); |
| 1334 | return Void(); |
| 1335 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1336 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1337 | Return<void> RadioImpl::setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType) { |
| 1338 | RLOGD("RadioImpl::setPreferredNetworkType: serial %d", serial); |
| 1339 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, 1, nwType); |
| 1340 | return Void(); |
| 1341 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1342 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1343 | Return<void> RadioImpl::getPreferredNetworkType(int32_t serial) { |
| 1344 | RLOGD("RadioImpl::getPreferredNetworkType: serial %d", serial); |
| 1345 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE); |
| 1346 | return Void(); |
| 1347 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1348 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1349 | Return<void> RadioImpl::getNeighboringCids(int32_t serial) { |
| 1350 | RLOGD("RadioImpl::getNeighboringCids: serial %d", serial); |
| 1351 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_NEIGHBORING_CELL_IDS); |
| 1352 | return Void(); |
| 1353 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1354 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1355 | Return<void> RadioImpl::setLocationUpdates(int32_t serial, bool enable) { |
| 1356 | RLOGD("RadioImpl::setLocationUpdates: serial %d", serial); |
| 1357 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_LOCATION_UPDATES, 1, BOOL_TO_INT(enable)); |
| 1358 | return Void(); |
| 1359 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1360 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1361 | Return<void> RadioImpl::setCdmaSubscriptionSource(int32_t serial, CdmaSubscriptionSource cdmaSub) { |
| 1362 | RLOGD("RadioImpl::setCdmaSubscriptionSource: serial %d", serial); |
| 1363 | dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, 1, cdmaSub); |
| 1364 | return Void(); |
| 1365 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1366 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1367 | Return<void> RadioImpl::setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type) { |
| 1368 | RLOGD("RadioImpl::setCdmaRoamingPreference: serial %d", serial); |
| 1369 | dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, 1, type); |
| 1370 | return Void(); |
| 1371 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1372 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1373 | Return<void> RadioImpl::getCdmaRoamingPreference(int32_t serial) { |
| 1374 | RLOGD("RadioImpl::getCdmaRoamingPreference: serial %d", serial); |
| 1375 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE); |
| 1376 | return Void(); |
| 1377 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1378 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1379 | Return<void> RadioImpl::setTTYMode(int32_t serial, TtyMode mode) { |
| 1380 | RLOGD("RadioImpl::setTTYMode: serial %d", serial); |
| 1381 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_TTY_MODE, 1, mode); |
| 1382 | return Void(); |
| 1383 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1384 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1385 | Return<void> RadioImpl::getTTYMode(int32_t serial) { |
| 1386 | RLOGD("RadioImpl::getTTYMode: serial %d", serial); |
| 1387 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_TTY_MODE); |
| 1388 | return Void(); |
| 1389 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1390 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1391 | Return<void> RadioImpl::setPreferredVoicePrivacy(int32_t serial, bool enable) { |
| 1392 | RLOGD("RadioImpl::setPreferredVoicePrivacy: serial %d", serial); |
| 1393 | dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, |
| 1394 | 1, BOOL_TO_INT(enable)); |
| 1395 | return Void(); |
| 1396 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1397 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1398 | Return<void> RadioImpl::getPreferredVoicePrivacy(int32_t serial) { |
| 1399 | RLOGD("RadioImpl::getPreferredVoicePrivacy: serial %d", serial); |
| 1400 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE); |
| 1401 | return Void(); |
| 1402 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1403 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1404 | Return<void> RadioImpl::sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) { |
| 1405 | RLOGD("RadioImpl::sendCDMAFeatureCode: serial %d", serial); |
| 1406 | dispatchString(serial, mSlotId, RIL_REQUEST_CDMA_FLASH, |
| 1407 | (const char *) featureCode); |
| 1408 | return Void(); |
| 1409 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1410 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1411 | Return<void> RadioImpl::sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on, |
| 1412 | int32_t off) { |
| 1413 | RLOGD("RadioImpl::sendBurstDtmf: serial %d", serial); |
| 1414 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CDMA_BURST_DTMF, |
| 1415 | 3, (const char *) dtmf, (const char *) (std::to_string(on)).c_str(), |
| 1416 | (const char *) (std::to_string(off)).c_str()); |
| 1417 | return Void(); |
| 1418 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1419 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1420 | void constructCdmaSms(RIL_CDMA_SMS_Message &rcsm, const CdmaSmsMessage& sms) { |
| 1421 | memset(&rcsm, 0, sizeof(rcsm)); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1422 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1423 | rcsm.uTeleserviceID = sms.teleserviceId; |
| 1424 | rcsm.bIsServicePresent = BOOL_TO_INT(sms.isServicePresent); |
| 1425 | rcsm.uServicecategory = sms.serviceCategory; |
| 1426 | rcsm.sAddress.digit_mode = (RIL_CDMA_SMS_DigitMode) sms.address.digitMode; |
| 1427 | rcsm.sAddress.number_mode = (RIL_CDMA_SMS_NumberMode) sms.address.numberMode; |
| 1428 | rcsm.sAddress.number_type = (RIL_CDMA_SMS_NumberType) sms.address.numberType; |
| 1429 | rcsm.sAddress.number_plan = (RIL_CDMA_SMS_NumberPlan) sms.address.numberPlan; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1430 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1431 | rcsm.sAddress.number_of_digits = sms.address.digits.size(); |
| 1432 | int digitLimit= MIN((rcsm.sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX); |
| 1433 | for (int i = 0; i < digitLimit; i++) { |
| 1434 | rcsm.sAddress.digits[i] = sms.address.digits[i]; |
| 1435 | } |
| 1436 | |
| 1437 | rcsm.sSubAddress.subaddressType = (RIL_CDMA_SMS_SubaddressType) sms.subAddress.subaddressType; |
| 1438 | rcsm.sSubAddress.odd = BOOL_TO_INT(sms.subAddress.odd); |
| 1439 | |
| 1440 | rcsm.sSubAddress.number_of_digits = sms.subAddress.digits.size(); |
| 1441 | digitLimit= MIN((rcsm.sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX); |
| 1442 | for (int i = 0; i < digitLimit; i++) { |
| 1443 | rcsm.sSubAddress.digits[i] = sms.subAddress.digits[i]; |
| 1444 | } |
| 1445 | |
| 1446 | rcsm.uBearerDataLen = sms.bearerData.size(); |
| 1447 | digitLimit= MIN((rcsm.uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX); |
| 1448 | for (int i = 0; i < digitLimit; i++) { |
| 1449 | rcsm.aBearerData[i] = sms.bearerData[i]; |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 | Return<void> RadioImpl::sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms) { |
| 1454 | RLOGD("RadioImpl::sendCdmaSms: serial %d", serial); |
| 1455 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_CDMA_SEND_SMS); |
| 1456 | if (pRI == NULL) { |
| 1457 | return Void(); |
| 1458 | } |
| 1459 | |
| 1460 | RIL_CDMA_SMS_Message rcsm; |
| 1461 | constructCdmaSms(rcsm, sms); |
| 1462 | |
| 1463 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm), pRI); |
| 1464 | return Void(); |
| 1465 | } |
| 1466 | |
| 1467 | Return<void> RadioImpl::acknowledgeLastIncomingCdmaSms(int32_t serial, const CdmaSmsAck& smsAck) { |
| 1468 | RLOGD("RadioImpl::acknowledgeLastIncomingCdmaSms: serial %d", serial); |
| 1469 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE); |
| 1470 | if (pRI == NULL) { |
| 1471 | return Void(); |
| 1472 | } |
| 1473 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 1474 | RIL_CDMA_SMS_Ack rcsa = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1475 | |
| 1476 | rcsa.uErrorClass = (RIL_CDMA_SMS_ErrorClass) smsAck.errorClass; |
| 1477 | rcsa.uSMSCauseCode = smsAck.smsCauseCode; |
| 1478 | |
| 1479 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa), pRI); |
| 1480 | return Void(); |
| 1481 | } |
| 1482 | |
| 1483 | Return<void> RadioImpl::getGsmBroadcastConfig(int32_t serial) { |
| 1484 | RLOGD("RadioImpl::getGsmBroadcastConfig: serial %d", serial); |
| 1485 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG); |
| 1486 | return Void(); |
| 1487 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1488 | |
| 1489 | Return<void> RadioImpl::setGsmBroadcastConfig(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1490 | const hidl_vec<GsmBroadcastSmsConfigInfo>& |
| 1491 | configInfo) { |
| 1492 | RLOGD("RadioImpl::setGsmBroadcastConfig: serial %d", serial); |
| 1493 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1494 | RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG); |
| 1495 | if (pRI == NULL) { |
| 1496 | return Void(); |
| 1497 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1498 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1499 | int num = configInfo.size(); |
| 1500 | RIL_GSM_BroadcastSmsConfigInfo gsmBci[num]; |
| 1501 | RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num]; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1502 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1503 | for (int i = 0 ; i < num ; i++ ) { |
| 1504 | gsmBciPtrs[i] = &gsmBci[i]; |
| 1505 | gsmBci[i].fromServiceId = configInfo[i].fromServiceId; |
| 1506 | gsmBci[i].toServiceId = configInfo[i].toServiceId; |
| 1507 | gsmBci[i].fromCodeScheme = configInfo[i].fromCodeScheme; |
| 1508 | gsmBci[i].toCodeScheme = configInfo[i].toCodeScheme; |
| 1509 | gsmBci[i].selected = BOOL_TO_INT(configInfo[i].selected); |
| 1510 | } |
| 1511 | |
| 1512 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, gsmBciPtrs, |
| 1513 | num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *), pRI); |
| 1514 | return Void(); |
| 1515 | } |
| 1516 | |
| 1517 | Return<void> RadioImpl::setGsmBroadcastActivation(int32_t serial, bool activate) { |
| 1518 | RLOGD("RadioImpl::setGsmBroadcastActivation: serial %d", serial); |
| 1519 | dispatchInts(serial, mSlotId, RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, |
Sanket Padawe | 0de29d1 | 2017-02-10 13:19:47 -0800 | [diff] [blame] | 1520 | 1, BOOL_TO_INT(!activate)); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1521 | return Void(); |
| 1522 | } |
| 1523 | |
| 1524 | Return<void> RadioImpl::getCdmaBroadcastConfig(int32_t serial) { |
| 1525 | RLOGD("RadioImpl::getCdmaBroadcastConfig: serial %d", serial); |
| 1526 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG); |
| 1527 | return Void(); |
| 1528 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1529 | |
| 1530 | Return<void> RadioImpl::setCdmaBroadcastConfig(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1531 | const hidl_vec<CdmaBroadcastSmsConfigInfo>& |
| 1532 | configInfo) { |
| 1533 | RLOGD("RadioImpl::setCdmaBroadcastConfig: serial %d", serial); |
| 1534 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1535 | RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG); |
| 1536 | if (pRI == NULL) { |
| 1537 | return Void(); |
| 1538 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1539 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1540 | int num = configInfo.size(); |
| 1541 | RIL_CDMA_BroadcastSmsConfigInfo cdmaBci[num]; |
| 1542 | RIL_CDMA_BroadcastSmsConfigInfo *cdmaBciPtrs[num]; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1543 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1544 | for (int i = 0 ; i < num ; i++ ) { |
| 1545 | cdmaBciPtrs[i] = &cdmaBci[i]; |
| 1546 | cdmaBci[i].service_category = configInfo[i].serviceCategory; |
| 1547 | cdmaBci[i].language = configInfo[i].language; |
| 1548 | cdmaBci[i].selected = BOOL_TO_INT(configInfo[i].selected); |
| 1549 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1550 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1551 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, cdmaBciPtrs, |
| 1552 | num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *), pRI); |
| 1553 | return Void(); |
| 1554 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1555 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1556 | Return<void> RadioImpl::setCdmaBroadcastActivation(int32_t serial, bool activate) { |
| 1557 | RLOGD("RadioImpl::setCdmaBroadcastActivation: serial %d", serial); |
| 1558 | dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, |
Sanket Padawe | 0de29d1 | 2017-02-10 13:19:47 -0800 | [diff] [blame] | 1559 | 1, BOOL_TO_INT(!activate)); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1560 | return Void(); |
| 1561 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1562 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1563 | Return<void> RadioImpl::getCDMASubscription(int32_t serial) { |
| 1564 | RLOGD("RadioImpl::getCDMASubscription: serial %d", serial); |
| 1565 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_SUBSCRIPTION); |
| 1566 | return Void(); |
| 1567 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1568 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1569 | Return<void> RadioImpl::writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms) { |
| 1570 | RLOGD("RadioImpl::writeSmsToRuim: serial %d", serial); |
| 1571 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1572 | RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM); |
| 1573 | if (pRI == NULL) { |
| 1574 | return Void(); |
| 1575 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1576 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 1577 | RIL_CDMA_SMS_WriteArgs rcsw = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1578 | rcsw.status = (int) cdmaSms.status; |
| 1579 | constructCdmaSms(rcsw.message, cdmaSms.message); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1580 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1581 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rcsw, sizeof(rcsw), pRI); |
| 1582 | return Void(); |
| 1583 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1584 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1585 | Return<void> RadioImpl::deleteSmsOnRuim(int32_t serial, int32_t index) { |
| 1586 | RLOGD("RadioImpl::deleteSmsOnRuim: serial %d", serial); |
| 1587 | dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, 1, index); |
| 1588 | return Void(); |
| 1589 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1590 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1591 | Return<void> RadioImpl::getDeviceIdentity(int32_t serial) { |
| 1592 | RLOGD("RadioImpl::getDeviceIdentity: serial %d", serial); |
| 1593 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DEVICE_IDENTITY); |
| 1594 | return Void(); |
| 1595 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1596 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1597 | Return<void> RadioImpl::exitEmergencyCallbackMode(int32_t serial) { |
| 1598 | RLOGD("RadioImpl::exitEmergencyCallbackMode: serial %d", serial); |
| 1599 | dispatchVoid(serial, mSlotId, RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE); |
| 1600 | return Void(); |
| 1601 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1602 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1603 | Return<void> RadioImpl::getSmscAddress(int32_t serial) { |
| 1604 | RLOGD("RadioImpl::getSmscAddress: serial %d", serial); |
| 1605 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_SMSC_ADDRESS); |
| 1606 | return Void(); |
| 1607 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1608 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1609 | Return<void> RadioImpl::setSmscAddress(int32_t serial, const hidl_string& smsc) { |
| 1610 | RLOGD("RadioImpl::setSmscAddress: serial %d", serial); |
| 1611 | dispatchString(serial, mSlotId, RIL_REQUEST_SET_SMSC_ADDRESS, |
| 1612 | (const char *) smsc); |
| 1613 | return Void(); |
| 1614 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1615 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1616 | Return<void> RadioImpl::reportSmsMemoryStatus(int32_t serial, bool available) { |
| 1617 | RLOGD("RadioImpl::reportSmsMemoryStatus: serial %d", serial); |
| 1618 | dispatchInts(serial, mSlotId, RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, 1, |
| 1619 | BOOL_TO_INT(available)); |
| 1620 | return Void(); |
| 1621 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1622 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1623 | Return<void> RadioImpl::reportStkServiceIsRunning(int32_t serial) { |
| 1624 | RLOGD("RadioImpl::reportStkServiceIsRunning: serial %d", serial); |
| 1625 | dispatchVoid(serial, mSlotId, RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING); |
| 1626 | return Void(); |
| 1627 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1628 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1629 | Return<void> RadioImpl::getCdmaSubscriptionSource(int32_t serial) { |
| 1630 | RLOGD("RadioImpl::getCdmaSubscriptionSource: serial %d", serial); |
| 1631 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE); |
| 1632 | return Void(); |
| 1633 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1634 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1635 | Return<void> RadioImpl::requestIsimAuthentication(int32_t serial, const hidl_string& challenge) { |
| 1636 | RLOGD("RadioImpl::requestIsimAuthentication: serial %d", serial); |
| 1637 | dispatchString(serial, mSlotId, RIL_REQUEST_ISIM_AUTHENTICATION, |
| 1638 | (const char *) challenge); |
| 1639 | return Void(); |
| 1640 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1641 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1642 | Return<void> RadioImpl::acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, |
| 1643 | const hidl_string& ackPdu) { |
| 1644 | RLOGD("RadioImpl::acknowledgeIncomingGsmSmsWithPdu: serial %d", serial); |
| 1645 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, |
| 1646 | 2, success ? "1" : "0", (const char *) ackPdu); |
| 1647 | return Void(); |
| 1648 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1649 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1650 | Return<void> RadioImpl::sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) { |
| 1651 | RLOGD("RadioImpl::sendEnvelopeWithStatus: serial %d", serial); |
| 1652 | dispatchString(serial, mSlotId, RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, |
| 1653 | (const char *) contents); |
| 1654 | return Void(); |
| 1655 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1656 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1657 | Return<void> RadioImpl::getVoiceRadioTechnology(int32_t serial) { |
| 1658 | RLOGD("RadioImpl::getVoiceRadioTechnology: serial %d", serial); |
| 1659 | dispatchVoid(serial, mSlotId, RIL_REQUEST_VOICE_RADIO_TECH); |
| 1660 | return Void(); |
| 1661 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1662 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1663 | Return<void> RadioImpl::getCellInfoList(int32_t serial) { |
| 1664 | RLOGD("RadioImpl::getCellInfoList: serial %d", serial); |
| 1665 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CELL_INFO_LIST); |
| 1666 | return Void(); |
| 1667 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1668 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1669 | Return<void> RadioImpl::setCellInfoListRate(int32_t serial, int32_t rate) { |
| 1670 | RLOGD("RadioImpl::setCellInfoListRate: serial %d", serial); |
| 1671 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, 1, rate); |
| 1672 | return Void(); |
| 1673 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1674 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1675 | Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1676 | bool modemCognitive, bool isRoaming) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1677 | RLOGD("RadioImpl::setInitialAttachApn: serial %d", serial); |
| 1678 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1679 | RIL_REQUEST_SET_INITIAL_ATTACH_APN); |
| 1680 | if (pRI == NULL) { |
| 1681 | return Void(); |
| 1682 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1683 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1684 | if (s_vendorFunctions->version <= 14) { |
| 1685 | RIL_InitialAttachApn iaa = {}; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1686 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1687 | if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) { |
| 1688 | return Void(); |
| 1689 | } |
| 1690 | |
| 1691 | const hidl_string &protocol = |
| 1692 | (isRoaming ? dataProfileInfo.roamingProtocol : dataProfileInfo.protocol); |
| 1693 | |
| 1694 | if (!copyHidlStringToRil(&iaa.protocol, protocol, pRI)) { |
| 1695 | return Void(); |
| 1696 | } |
| 1697 | iaa.authtype = (int) dataProfileInfo.authType; |
| 1698 | if (!copyHidlStringToRil(&iaa.username, dataProfileInfo.user, pRI)) { |
| 1699 | return Void(); |
| 1700 | } |
| 1701 | if (!copyHidlStringToRil(&iaa.password, dataProfileInfo.password, pRI)) { |
| 1702 | return Void(); |
| 1703 | } |
| 1704 | |
| 1705 | s_vendorFunctions->onRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI); |
| 1706 | |
| 1707 | memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.username, iaa.password); |
| 1708 | } else { |
| 1709 | RIL_InitialAttachApn_v15 iaa = {}; |
| 1710 | |
| 1711 | if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) { |
| 1712 | return Void(); |
| 1713 | } |
| 1714 | if (!copyHidlStringToRil(&iaa.protocol, dataProfileInfo.protocol, pRI)) { |
| 1715 | return Void(); |
| 1716 | } |
| 1717 | if (!copyHidlStringToRil(&iaa.roamingProtocol, dataProfileInfo.roamingProtocol, pRI)) { |
| 1718 | return Void(); |
| 1719 | } |
| 1720 | iaa.authtype = (int) dataProfileInfo.authType; |
| 1721 | if (!copyHidlStringToRil(&iaa.username, dataProfileInfo.user, pRI)) { |
| 1722 | return Void(); |
| 1723 | } |
| 1724 | if (!copyHidlStringToRil(&iaa.password, dataProfileInfo.password, pRI)) { |
| 1725 | return Void(); |
| 1726 | } |
| 1727 | iaa.supportedTypesBitmask = dataProfileInfo.supportedApnTypesBitmap; |
| 1728 | iaa.bearerBitmask = dataProfileInfo.bearerBitmap; |
| 1729 | iaa.modemCognitive = BOOL_TO_INT(modemCognitive); |
| 1730 | iaa.mtu = dataProfileInfo.mtu; |
| 1731 | |
| 1732 | // Note that there is no need for memory allocation/free. |
| 1733 | iaa.mvnoType = (char *) convertMvnoTypeToString(dataProfileInfo.mvnoType); |
| 1734 | if (iaa.mvnoType == NULL) { |
| 1735 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
| 1736 | return Void(); |
| 1737 | } |
| 1738 | |
| 1739 | if (!copyHidlStringToRil(&iaa.mvnoMatchData, dataProfileInfo.mvnoMatchData, pRI)) { |
| 1740 | return Void(); |
| 1741 | } |
| 1742 | |
| 1743 | s_vendorFunctions->onRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI); |
| 1744 | |
| 1745 | memsetAndFreeStrings(6, iaa.apn, iaa.protocol, iaa.roamingProtocol, iaa.username, |
| 1746 | iaa.password, iaa.mvnoMatchData); |
| 1747 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1748 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1749 | return Void(); |
| 1750 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1751 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1752 | Return<void> RadioImpl::getImsRegistrationState(int32_t serial) { |
| 1753 | RLOGD("RadioImpl::getImsRegistrationState: serial %d", serial); |
| 1754 | dispatchVoid(serial, mSlotId, RIL_REQUEST_IMS_REGISTRATION_STATE); |
| 1755 | return Void(); |
| 1756 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1757 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1758 | bool dispatchImsGsmSms(const ImsSmsMessage& message, RequestInfo *pRI) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 1759 | RIL_IMS_SMS_Message rism = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1760 | char **pStrings; |
| 1761 | int countStrings = 2; |
| 1762 | int dataLen = sizeof(char *) * countStrings; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1763 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1764 | rism.tech = RADIO_TECH_3GPP; |
| 1765 | rism.retry = BOOL_TO_INT(message.retry); |
| 1766 | rism.messageRef = message.messageRef; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1767 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1768 | if (message.gsmMessage.size() != 1) { |
| 1769 | RLOGE("dispatchImsGsmSms: Invalid len %s", requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1770 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1771 | return false; |
| 1772 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1773 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1774 | pStrings = (char **)calloc(countStrings, sizeof(char *)); |
| 1775 | if (pStrings == NULL) { |
| 1776 | RLOGE("dispatchImsGsmSms: Memory allocation failed for request %s", |
| 1777 | requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1778 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1779 | return false; |
| 1780 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1781 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1782 | if (!copyHidlStringToRil(&pStrings[0], message.gsmMessage[0].smscPdu, pRI)) { |
| 1783 | #ifdef MEMSET_FREED |
| 1784 | memset(pStrings, 0, datalen); |
| 1785 | #endif |
| 1786 | free(pStrings); |
| 1787 | return false; |
| 1788 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1789 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1790 | if (!copyHidlStringToRil(&pStrings[1], message.gsmMessage[0].pdu, pRI)) { |
| 1791 | memsetAndFreeStrings(1, pStrings[0]); |
| 1792 | #ifdef MEMSET_FREED |
| 1793 | memset(pStrings, 0, datalen); |
| 1794 | #endif |
| 1795 | free(pStrings); |
| 1796 | return false; |
| 1797 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1798 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1799 | rism.message.gsmMessage = pStrings; |
| 1800 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) + |
| 1801 | sizeof(uint8_t) + sizeof(int32_t) + dataLen, pRI); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1802 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1803 | for (int i = 0 ; i < countStrings ; i++) { |
| 1804 | memsetAndFreeStrings(1, pStrings[i]); |
| 1805 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1806 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1807 | #ifdef MEMSET_FREED |
| 1808 | memset(pStrings, 0, datalen); |
| 1809 | #endif |
| 1810 | free(pStrings); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1811 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1812 | return true; |
| 1813 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1814 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1815 | bool dispatchImsCdmaSms(const ImsSmsMessage& message, RequestInfo *pRI) { |
| 1816 | RIL_IMS_SMS_Message rism; |
| 1817 | RIL_CDMA_SMS_Message rcsm; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1818 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1819 | if (message.cdmaMessage.size() != 1) { |
| 1820 | RLOGE("dispatchImsCdmaSms: Invalid len %s", requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1821 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1822 | return false; |
| 1823 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1824 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1825 | rism.tech = RADIO_TECH_3GPP2; |
| 1826 | rism.retry = BOOL_TO_INT(message.retry); |
| 1827 | rism.messageRef = message.messageRef; |
| 1828 | rism.message.cdmaMessage = &rcsm; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1829 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1830 | constructCdmaSms(rcsm, message.cdmaMessage[0]); |
| 1831 | |
| 1832 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) + |
| 1833 | sizeof(uint8_t) + sizeof(int32_t) + sizeof(rcsm), pRI); |
| 1834 | |
| 1835 | return true; |
| 1836 | } |
| 1837 | |
| 1838 | Return<void> RadioImpl::sendImsSms(int32_t serial, const ImsSmsMessage& message) { |
| 1839 | RLOGD("RadioImpl::sendImsSms: serial %d", serial); |
| 1840 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_IMS_SEND_SMS); |
| 1841 | if (pRI == NULL) { |
| 1842 | return Void(); |
| 1843 | } |
| 1844 | |
| 1845 | RIL_RadioTechnologyFamily format = (RIL_RadioTechnologyFamily) message.tech; |
| 1846 | |
| 1847 | if (RADIO_TECH_3GPP == format) { |
| 1848 | dispatchImsGsmSms(message, pRI); |
| 1849 | } else if (RADIO_TECH_3GPP2 == format) { |
| 1850 | dispatchImsCdmaSms(message, pRI); |
| 1851 | } else { |
| 1852 | RLOGE("RadioImpl::sendImsSms: Invalid radio tech %s", |
| 1853 | requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1854 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1855 | } |
| 1856 | return Void(); |
| 1857 | } |
| 1858 | |
| 1859 | Return<void> RadioImpl::iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message) { |
| 1860 | RLOGD("RadioImpl::iccTransmitApduBasicChannel: serial %d", serial); |
| 1861 | dispatchIccApdu(serial, mSlotId, RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, message); |
| 1862 | return Void(); |
| 1863 | } |
| 1864 | |
| 1865 | Return<void> RadioImpl::iccOpenLogicalChannel(int32_t serial, const hidl_string& aid) { |
| 1866 | RLOGD("RadioImpl::iccOpenLogicalChannel: serial %d", serial); |
| 1867 | dispatchString(serial, mSlotId, RIL_REQUEST_SIM_OPEN_CHANNEL, |
| 1868 | (const char *) aid); |
| 1869 | return Void(); |
| 1870 | } |
| 1871 | |
| 1872 | Return<void> RadioImpl::iccCloseLogicalChannel(int32_t serial, int32_t channelId) { |
| 1873 | RLOGD("RadioImpl::iccCloseLogicalChannel: serial %d", serial); |
| 1874 | dispatchInts(serial, mSlotId, RIL_REQUEST_SIM_CLOSE_CHANNEL, 1, channelId); |
| 1875 | return Void(); |
| 1876 | } |
| 1877 | |
| 1878 | Return<void> RadioImpl::iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message) { |
| 1879 | RLOGD("RadioImpl::iccTransmitApduLogicalChannel: serial %d", serial); |
| 1880 | dispatchIccApdu(serial, mSlotId, RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, message); |
| 1881 | return Void(); |
| 1882 | } |
| 1883 | |
| 1884 | Return<void> RadioImpl::nvReadItem(int32_t serial, NvItem itemId) { |
| 1885 | RLOGD("RadioImpl::nvReadItem: serial %d", serial); |
| 1886 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_NV_READ_ITEM); |
| 1887 | if (pRI == NULL) { |
| 1888 | return Void(); |
| 1889 | } |
| 1890 | |
| 1891 | RIL_NV_ReadItem nvri; |
| 1892 | memset (&nvri, 0, sizeof(nvri)); |
| 1893 | nvri.itemID = (RIL_NV_Item) itemId; |
| 1894 | |
| 1895 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &nvri, sizeof(nvri), pRI); |
| 1896 | return Void(); |
| 1897 | } |
| 1898 | |
| 1899 | Return<void> RadioImpl::nvWriteItem(int32_t serial, const NvWriteItem& item) { |
| 1900 | RLOGD("RadioImpl::nvWriteItem: serial %d", serial); |
| 1901 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_NV_WRITE_ITEM); |
| 1902 | if (pRI == NULL) { |
| 1903 | return Void(); |
| 1904 | } |
| 1905 | |
| 1906 | RIL_NV_WriteItem nvwi; |
| 1907 | memset (&nvwi, 0, sizeof(nvwi)); |
| 1908 | |
| 1909 | nvwi.itemID = (RIL_NV_Item) item.itemId; |
| 1910 | |
| 1911 | if (!copyHidlStringToRil(&nvwi.value, item.value, pRI)) { |
| 1912 | return Void(); |
| 1913 | } |
| 1914 | |
| 1915 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI); |
| 1916 | |
| 1917 | memsetAndFreeStrings(1, nvwi.value); |
| 1918 | return Void(); |
| 1919 | } |
| 1920 | |
| 1921 | Return<void> RadioImpl::nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) { |
| 1922 | RLOGD("RadioImpl::nvWriteCdmaPrl: serial %d", serial); |
| 1923 | dispatchRaw(serial, mSlotId, RIL_REQUEST_NV_WRITE_CDMA_PRL, prl); |
| 1924 | return Void(); |
| 1925 | } |
| 1926 | |
| 1927 | Return<void> RadioImpl::nvResetConfig(int32_t serial, ResetNvType resetType) { |
| 1928 | RLOGD("RadioImpl::nvResetConfig: serial %d", serial); |
| 1929 | dispatchInts(serial, mSlotId, RIL_REQUEST_NV_RESET_CONFIG, 1, (int) resetType); |
| 1930 | return Void(); |
| 1931 | } |
| 1932 | |
| 1933 | Return<void> RadioImpl::setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub) { |
| 1934 | RLOGD("RadioImpl::setUiccSubscription: serial %d", serial); |
| 1935 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1936 | RIL_REQUEST_SET_UICC_SUBSCRIPTION); |
| 1937 | if (pRI == NULL) { |
| 1938 | return Void(); |
| 1939 | } |
| 1940 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 1941 | RIL_SelectUiccSub rilUiccSub = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1942 | |
| 1943 | rilUiccSub.slot = uiccSub.slot; |
| 1944 | rilUiccSub.app_index = uiccSub.appIndex; |
| 1945 | rilUiccSub.sub_type = (RIL_SubscriptionType) uiccSub.subType; |
| 1946 | rilUiccSub.act_status = (RIL_UiccSubActStatus) uiccSub.actStatus; |
| 1947 | |
| 1948 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rilUiccSub, sizeof(rilUiccSub), pRI); |
| 1949 | return Void(); |
| 1950 | } |
| 1951 | |
| 1952 | Return<void> RadioImpl::setDataAllowed(int32_t serial, bool allow) { |
| 1953 | RLOGD("RadioImpl::setDataAllowed: serial %d", serial); |
| 1954 | dispatchInts(serial, mSlotId, RIL_REQUEST_ALLOW_DATA, 1, BOOL_TO_INT(allow)); |
| 1955 | return Void(); |
| 1956 | } |
| 1957 | |
| 1958 | Return<void> RadioImpl::getHardwareConfig(int32_t serial) { |
| 1959 | RLOGD("RadioImpl::getHardwareConfig: serial %d", serial); |
| 1960 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_HARDWARE_CONFIG); |
| 1961 | return Void(); |
| 1962 | } |
| 1963 | |
| 1964 | Return<void> RadioImpl::requestIccSimAuthentication(int32_t serial, int32_t authContext, |
| 1965 | const hidl_string& authData, const hidl_string& aid) { |
| 1966 | RLOGD("RadioImpl::requestIccSimAuthentication: serial %d", serial); |
| 1967 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SIM_AUTHENTICATION); |
| 1968 | if (pRI == NULL) { |
| 1969 | return Void(); |
| 1970 | } |
| 1971 | |
| 1972 | RIL_SimAuthentication pf; |
| 1973 | memset (&pf, 0, sizeof(pf)); |
| 1974 | |
| 1975 | pf.authContext = authContext; |
| 1976 | |
| 1977 | int len; |
| 1978 | if (!copyHidlStringToRil(&pf.authData, authData, pRI)) { |
| 1979 | return Void(); |
| 1980 | } |
| 1981 | |
| 1982 | if (!copyHidlStringToRil(&pf.aid, aid, pRI)) { |
| 1983 | memsetAndFreeStrings(1, pf.authData); |
| 1984 | return Void(); |
| 1985 | } |
| 1986 | |
| 1987 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI); |
| 1988 | |
| 1989 | memsetAndFreeStrings(2, pf.authData, pf.aid); |
| 1990 | return Void(); |
| 1991 | } |
| 1992 | |
| 1993 | /** |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 1994 | * @param numProfiles number of data profile |
| 1995 | * @param dataProfiles the pointer to the actual data profiles. The acceptable type is |
| 1996 | RIL_DataProfileInfo or RIL_DataProfileInfo_v15. |
| 1997 | * @param dataProfilePtrs the pointer to the pointers that point to each data profile structure |
| 1998 | * @param numfields number of string-type member in the data profile structure |
| 1999 | * @param ... the variadic parameters are pointers to each string-type member |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2000 | **/ |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2001 | template <typename T> |
| 2002 | void freeSetDataProfileData(int numProfiles, T *dataProfiles, T **dataProfilePtrs, |
| 2003 | int numfields, ...) { |
| 2004 | va_list args; |
| 2005 | va_start(args, numfields); |
| 2006 | |
| 2007 | // Iterate through each string-type field that need to be free. |
| 2008 | for (int i = 0; i < numfields; i++) { |
| 2009 | // Iterate through each data profile and free that specific string-type field. |
| 2010 | // The type 'char *T::*' is a type of pointer to a 'char *' member inside T structure. |
| 2011 | char *T::*ptr = va_arg(args, char *T::*); |
| 2012 | for (int j = 0; j < numProfiles; j++) { |
| 2013 | memsetAndFreeStrings(1, dataProfiles[j].*ptr); |
| 2014 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2015 | } |
| 2016 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2017 | va_end(args); |
| 2018 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2019 | #ifdef MEMSET_FREED |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2020 | memset(dataProfiles, 0, numProfiles * sizeof(T)); |
| 2021 | memset(dataProfilePtrs, 0, numProfiles * sizeof(T *)); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2022 | #endif |
| 2023 | free(dataProfiles); |
| 2024 | free(dataProfilePtrs); |
| 2025 | } |
| 2026 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2027 | Return<void> RadioImpl::setDataProfile(int32_t serial, const hidl_vec<DataProfileInfo>& profiles, |
| 2028 | bool isRoaming) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2029 | RLOGD("RadioImpl::setDataProfile: serial %d", serial); |
| 2030 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SET_DATA_PROFILE); |
| 2031 | if (pRI == NULL) { |
| 2032 | return Void(); |
| 2033 | } |
| 2034 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2035 | size_t num = profiles.size(); |
| 2036 | bool success = false; |
| 2037 | |
| 2038 | if (s_vendorFunctions->version <= 14) { |
| 2039 | |
| 2040 | RIL_DataProfileInfo *dataProfiles = |
| 2041 | (RIL_DataProfileInfo *) calloc(num, sizeof(RIL_DataProfileInfo)); |
| 2042 | |
| 2043 | if (dataProfiles == NULL) { |
| 2044 | RLOGE("Memory allocation failed for request %s", |
| 2045 | requestToString(pRI->pCI->requestNumber)); |
| 2046 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
| 2047 | return Void(); |
| 2048 | } |
| 2049 | |
| 2050 | RIL_DataProfileInfo **dataProfilePtrs = |
| 2051 | (RIL_DataProfileInfo **) calloc(num, sizeof(RIL_DataProfileInfo *)); |
| 2052 | if (dataProfilePtrs == NULL) { |
| 2053 | RLOGE("Memory allocation failed for request %s", |
| 2054 | requestToString(pRI->pCI->requestNumber)); |
| 2055 | free(dataProfiles); |
| 2056 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
| 2057 | return Void(); |
| 2058 | } |
| 2059 | |
| 2060 | for (size_t i = 0; i < num; i++) { |
| 2061 | dataProfilePtrs[i] = &dataProfiles[i]; |
| 2062 | |
| 2063 | success = copyHidlStringToRil(&dataProfiles[i].apn, profiles[i].apn, pRI); |
| 2064 | |
| 2065 | const hidl_string &protocol = |
| 2066 | (isRoaming ? profiles[i].roamingProtocol : profiles[i].protocol); |
| 2067 | |
| 2068 | if (success && !copyHidlStringToRil(&dataProfiles[i].protocol, protocol, pRI)) { |
| 2069 | success = false; |
| 2070 | } |
| 2071 | |
| 2072 | if (success && !copyHidlStringToRil(&dataProfiles[i].user, profiles[i].user, pRI)) { |
| 2073 | success = false; |
| 2074 | } |
| 2075 | if (success && !copyHidlStringToRil(&dataProfiles[i].password, profiles[i].password, |
| 2076 | pRI)) { |
| 2077 | success = false; |
| 2078 | } |
| 2079 | |
| 2080 | if (!success) { |
| 2081 | freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 4, |
| 2082 | &RIL_DataProfileInfo::apn, &RIL_DataProfileInfo::protocol, |
| 2083 | &RIL_DataProfileInfo::user, &RIL_DataProfileInfo::password); |
| 2084 | return Void(); |
| 2085 | } |
| 2086 | |
| 2087 | dataProfiles[i].profileId = (RIL_DataProfile) profiles[i].profileId; |
| 2088 | dataProfiles[i].authType = (int) profiles[i].authType; |
| 2089 | dataProfiles[i].type = (int) profiles[i].type; |
| 2090 | dataProfiles[i].maxConnsTime = profiles[i].maxConnsTime; |
| 2091 | dataProfiles[i].maxConns = profiles[i].maxConns; |
| 2092 | dataProfiles[i].waitTime = profiles[i].waitTime; |
| 2093 | dataProfiles[i].enabled = BOOL_TO_INT(profiles[i].enabled); |
| 2094 | } |
| 2095 | |
| 2096 | s_vendorFunctions->onRequest(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs, |
| 2097 | num * sizeof(RIL_DataProfileInfo *), pRI); |
| 2098 | |
| 2099 | freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 4, |
| 2100 | &RIL_DataProfileInfo::apn, &RIL_DataProfileInfo::protocol, |
| 2101 | &RIL_DataProfileInfo::user, &RIL_DataProfileInfo::password); |
| 2102 | } else { |
| 2103 | RIL_DataProfileInfo_v15 *dataProfiles = |
| 2104 | (RIL_DataProfileInfo_v15 *) calloc(num, sizeof(RIL_DataProfileInfo_v15)); |
| 2105 | |
| 2106 | if (dataProfiles == NULL) { |
| 2107 | RLOGE("Memory allocation failed for request %s", |
| 2108 | requestToString(pRI->pCI->requestNumber)); |
| 2109 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
| 2110 | return Void(); |
| 2111 | } |
| 2112 | |
| 2113 | RIL_DataProfileInfo_v15 **dataProfilePtrs = |
| 2114 | (RIL_DataProfileInfo_v15 **) calloc(num, sizeof(RIL_DataProfileInfo_v15 *)); |
| 2115 | if (dataProfilePtrs == NULL) { |
| 2116 | RLOGE("Memory allocation failed for request %s", |
| 2117 | requestToString(pRI->pCI->requestNumber)); |
| 2118 | free(dataProfiles); |
| 2119 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
| 2120 | return Void(); |
| 2121 | } |
| 2122 | |
| 2123 | for (size_t i = 0; i < num; i++) { |
| 2124 | dataProfilePtrs[i] = &dataProfiles[i]; |
| 2125 | |
| 2126 | success = copyHidlStringToRil(&dataProfiles[i].apn, profiles[i].apn, pRI); |
| 2127 | if (success && !copyHidlStringToRil(&dataProfiles[i].protocol, profiles[i].protocol, |
| 2128 | pRI)) { |
| 2129 | success = false; |
| 2130 | } |
| 2131 | if (success && !copyHidlStringToRil(&dataProfiles[i].roamingProtocol, |
| 2132 | profiles[i].roamingProtocol, pRI)) { |
| 2133 | success = false; |
| 2134 | } |
| 2135 | if (success && !copyHidlStringToRil(&dataProfiles[i].user, profiles[i].user, pRI)) { |
| 2136 | success = false; |
| 2137 | } |
| 2138 | if (success && !copyHidlStringToRil(&dataProfiles[i].password, profiles[i].password, |
| 2139 | pRI)) { |
| 2140 | success = false; |
| 2141 | } |
| 2142 | |
| 2143 | if (success && !copyHidlStringToRil(&dataProfiles[i].mvnoMatchData, |
| 2144 | profiles[i].mvnoMatchData, pRI)) { |
| 2145 | success = false; |
| 2146 | } |
| 2147 | |
| 2148 | if (success) { |
| 2149 | dataProfiles[i].mvnoType = (char *) convertMvnoTypeToString(profiles[i].mvnoType); |
| 2150 | if (dataProfiles[i].mvnoType == NULL) { |
| 2151 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
| 2152 | success = false; |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | if (!success) { |
| 2157 | freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 6, |
| 2158 | &RIL_DataProfileInfo_v15::apn, &RIL_DataProfileInfo_v15::protocol, |
| 2159 | &RIL_DataProfileInfo_v15::roamingProtocol, &RIL_DataProfileInfo_v15::user, |
| 2160 | &RIL_DataProfileInfo_v15::password, &RIL_DataProfileInfo_v15::mvnoMatchData); |
| 2161 | return Void(); |
| 2162 | } |
| 2163 | |
| 2164 | dataProfiles[i].profileId = (RIL_DataProfile) profiles[i].profileId; |
| 2165 | dataProfiles[i].authType = (int) profiles[i].authType; |
| 2166 | dataProfiles[i].type = (int) profiles[i].type; |
| 2167 | dataProfiles[i].maxConnsTime = profiles[i].maxConnsTime; |
| 2168 | dataProfiles[i].maxConns = profiles[i].maxConns; |
| 2169 | dataProfiles[i].waitTime = profiles[i].waitTime; |
| 2170 | dataProfiles[i].enabled = BOOL_TO_INT(profiles[i].enabled); |
| 2171 | dataProfiles[i].supportedTypesBitmask = profiles[i].supportedApnTypesBitmap; |
| 2172 | dataProfiles[i].bearerBitmask = profiles[i].bearerBitmap; |
| 2173 | dataProfiles[i].mtu = profiles[i].mtu; |
| 2174 | } |
| 2175 | |
| 2176 | s_vendorFunctions->onRequest(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs, |
| 2177 | num * sizeof(RIL_DataProfileInfo_v15 *), pRI); |
| 2178 | |
| 2179 | freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 6, |
| 2180 | &RIL_DataProfileInfo_v15::apn, &RIL_DataProfileInfo_v15::protocol, |
| 2181 | &RIL_DataProfileInfo_v15::roamingProtocol, &RIL_DataProfileInfo_v15::user, |
| 2182 | &RIL_DataProfileInfo_v15::password, &RIL_DataProfileInfo_v15::mvnoMatchData); |
| 2183 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2184 | |
| 2185 | return Void(); |
| 2186 | } |
| 2187 | |
| 2188 | Return<void> RadioImpl::requestShutdown(int32_t serial) { |
| 2189 | RLOGD("RadioImpl::requestShutdown: serial %d", serial); |
| 2190 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SHUTDOWN); |
| 2191 | return Void(); |
| 2192 | } |
| 2193 | |
| 2194 | Return<void> RadioImpl::getRadioCapability(int32_t serial) { |
| 2195 | RLOGD("RadioImpl::getRadioCapability: serial %d", serial); |
| 2196 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_RADIO_CAPABILITY); |
| 2197 | return Void(); |
| 2198 | } |
| 2199 | |
| 2200 | Return<void> RadioImpl::setRadioCapability(int32_t serial, const RadioCapability& rc) { |
| 2201 | RLOGD("RadioImpl::setRadioCapability: serial %d", serial); |
| 2202 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SET_RADIO_CAPABILITY); |
| 2203 | if (pRI == NULL) { |
| 2204 | return Void(); |
| 2205 | } |
| 2206 | |
| 2207 | RIL_RadioCapability rilRc; |
| 2208 | memset (&rilRc, 0, sizeof(rilRc)); |
| 2209 | |
| 2210 | // TODO : set rilRc.version using HIDL version ? |
| 2211 | rilRc.session = rc.session; |
| 2212 | rilRc.phase = (int) rc.phase; |
| 2213 | rilRc.rat = (int) rc.raf; |
| 2214 | rilRc.status = (int) rc.status; |
| 2215 | strncpy(rilRc.logicalModemUuid, (const char *) rc.logicalModemUuid, MAX_UUID_LENGTH); |
| 2216 | |
| 2217 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rilRc, sizeof(rilRc), pRI); |
| 2218 | |
| 2219 | return Void(); |
| 2220 | } |
| 2221 | |
| 2222 | Return<void> RadioImpl::startLceService(int32_t serial, int32_t reportInterval, bool pullMode) { |
| 2223 | RLOGD("RadioImpl::startLceService: serial %d", serial); |
| 2224 | dispatchInts(serial, mSlotId, RIL_REQUEST_START_LCE, 2, reportInterval, |
| 2225 | BOOL_TO_INT(pullMode)); |
| 2226 | return Void(); |
| 2227 | } |
| 2228 | |
| 2229 | Return<void> RadioImpl::stopLceService(int32_t serial) { |
| 2230 | RLOGD("RadioImpl::stopLceService: serial %d", serial); |
| 2231 | dispatchVoid(serial, mSlotId, RIL_REQUEST_STOP_LCE); |
| 2232 | return Void(); |
| 2233 | } |
| 2234 | |
| 2235 | Return<void> RadioImpl::pullLceData(int32_t serial) { |
| 2236 | RLOGD("RadioImpl::pullLceData: serial %d", serial); |
| 2237 | dispatchVoid(serial, mSlotId, RIL_REQUEST_PULL_LCEDATA); |
| 2238 | return Void(); |
| 2239 | } |
| 2240 | |
| 2241 | Return<void> RadioImpl::getModemActivityInfo(int32_t serial) { |
| 2242 | RLOGD("RadioImpl::getModemActivityInfo: serial %d", serial); |
| 2243 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_ACTIVITY_INFO); |
| 2244 | return Void(); |
| 2245 | } |
| 2246 | |
| 2247 | Return<void> RadioImpl::setAllowedCarriers(int32_t serial, bool allAllowed, |
| 2248 | const CarrierRestrictions& carriers) { |
| 2249 | RLOGD("RadioImpl::setAllowedCarriers: serial %d", serial); |
| 2250 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 2251 | RIL_REQUEST_SET_CARRIER_RESTRICTIONS); |
| 2252 | if (pRI == NULL) { |
| 2253 | return Void(); |
| 2254 | } |
| 2255 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2256 | RIL_CarrierRestrictions cr = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2257 | RIL_Carrier * allowedCarriers = NULL; |
| 2258 | RIL_Carrier * excludedCarriers = NULL; |
| 2259 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2260 | cr.len_allowed_carriers = carriers.allowedCarriers.size(); |
| 2261 | allowedCarriers = (RIL_Carrier *)calloc(cr.len_allowed_carriers, sizeof(RIL_Carrier)); |
| 2262 | if (allowedCarriers == NULL) { |
| 2263 | RLOGE("RadioImpl::setAllowedCarriers: Memory allocation failed for request %s", |
| 2264 | requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2265 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2266 | return Void(); |
| 2267 | } |
| 2268 | cr.allowed_carriers = allowedCarriers; |
| 2269 | |
| 2270 | cr.len_excluded_carriers = carriers.excludedCarriers.size(); |
| 2271 | excludedCarriers = (RIL_Carrier *)calloc(cr.len_excluded_carriers, sizeof(RIL_Carrier)); |
| 2272 | if (excludedCarriers == NULL) { |
| 2273 | RLOGE("RadioImpl::setAllowedCarriers: Memory allocation failed for request %s", |
| 2274 | requestToString(pRI->pCI->requestNumber)); |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 2275 | sendErrorResponse(pRI, RIL_E_NO_MEMORY); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2276 | #ifdef MEMSET_FREED |
| 2277 | memset(allowedCarriers, 0, cr.len_allowed_carriers * sizeof(RIL_Carrier)); |
| 2278 | #endif |
| 2279 | free(allowedCarriers); |
| 2280 | return Void(); |
| 2281 | } |
| 2282 | cr.excluded_carriers = excludedCarriers; |
| 2283 | |
| 2284 | for (int i = 0; i < cr.len_allowed_carriers; i++) { |
| 2285 | allowedCarriers[i].mcc = (const char *) carriers.allowedCarriers[i].mcc; |
| 2286 | allowedCarriers[i].mnc = (const char *) carriers.allowedCarriers[i].mnc; |
| 2287 | allowedCarriers[i].match_type = (RIL_CarrierMatchType) carriers.allowedCarriers[i].matchType; |
| 2288 | allowedCarriers[i].match_data = (const char *) carriers.allowedCarriers[i].matchData; |
| 2289 | } |
| 2290 | |
| 2291 | for (int i = 0; i < cr.len_allowed_carriers; i++) { |
| 2292 | excludedCarriers[i].mcc = (const char *) carriers.excludedCarriers[i].mcc; |
| 2293 | excludedCarriers[i].mnc = (const char *) carriers.excludedCarriers[i].mnc; |
| 2294 | excludedCarriers[i].match_type = |
| 2295 | (RIL_CarrierMatchType) carriers.excludedCarriers[i].matchType; |
| 2296 | excludedCarriers[i].match_data = (const char *) carriers.excludedCarriers[i].matchData; |
| 2297 | } |
| 2298 | |
| 2299 | s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &cr, sizeof(RIL_CarrierRestrictions), pRI); |
| 2300 | |
| 2301 | #ifdef MEMSET_FREED |
| 2302 | memset(allowedCarriers, 0, cr.len_allowed_carriers * sizeof(RIL_Carrier)); |
| 2303 | memset(excludedCarriers, 0, cr.len_excluded_carriers * sizeof(RIL_Carrier)); |
| 2304 | #endif |
| 2305 | free(allowedCarriers); |
| 2306 | free(excludedCarriers); |
| 2307 | return Void(); |
| 2308 | } |
| 2309 | |
| 2310 | Return<void> RadioImpl::getAllowedCarriers(int32_t serial) { |
| 2311 | RLOGD("RadioImpl::getAllowedCarriers: serial %d", serial); |
| 2312 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CARRIER_RESTRICTIONS); |
| 2313 | return Void(); |
| 2314 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2315 | |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 2316 | Return<void> RadioImpl::setSimCardPower(int32_t serial, bool powerUp) { |
| 2317 | RLOGD("RadioImpl::setSimCardPower: serial %d", serial); |
| 2318 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_SIM_CARD_POWER, 1, BOOL_TO_INT(powerUp)); |
| 2319 | return Void(); |
| 2320 | } |
| 2321 | |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 2322 | Return<void> RadioImpl::sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state) {return Status::ok();} |
| 2323 | |
| 2324 | Return<void> RadioImpl::setIndicationFilter(int32_t serial, int32_t indicationFilter) {return Status::ok();} |
| 2325 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2326 | Return<void> RadioImpl::responseAcknowledgement() { |
| 2327 | android::releaseWakeLock(); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2328 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2329 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2330 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 2331 | Return<void> OemHookImpl::setResponseFunctions( |
| 2332 | const ::android::sp<IOemHookResponse>& oemHookResponseParam, |
| 2333 | const ::android::sp<IOemHookIndication>& oemHookIndicationParam) { |
| 2334 | RLOGD("OemHookImpl::setResponseFunctions"); |
| 2335 | |
| 2336 | pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); |
| 2337 | int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 2338 | assert(ret == 0); |
| 2339 | |
| 2340 | mOemHookResponse = oemHookResponseParam; |
| 2341 | mOemHookIndication = oemHookIndicationParam; |
| 2342 | mCounter[mSlotId]++; |
| 2343 | |
| 2344 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 2345 | assert(ret == 0); |
| 2346 | |
| 2347 | return Void(); |
| 2348 | } |
| 2349 | |
| 2350 | Return<void> OemHookImpl::sendRequestRaw(int32_t serial, const hidl_vec<uint8_t>& data) { |
| 2351 | RLOGD("OemHookImpl::sendRequestRaw: serial %d", serial); |
| 2352 | dispatchRaw(serial, mSlotId, RIL_REQUEST_OEM_HOOK_RAW, data); |
| 2353 | return Void(); |
| 2354 | } |
| 2355 | |
| 2356 | Return<void> OemHookImpl::sendRequestStrings(int32_t serial, |
| 2357 | const hidl_vec<hidl_string>& data) { |
| 2358 | RLOGD("OemHookImpl::sendRequestStrings: serial %d", serial); |
| 2359 | dispatchStrings(serial, mSlotId, RIL_REQUEST_OEM_HOOK_STRINGS, data); |
| 2360 | return Void(); |
| 2361 | } |
| 2362 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2363 | /*************************************************************************************************** |
| 2364 | * RESPONSE FUNCTIONS |
| 2365 | * Functions above are used for requests going from framework to vendor code. The ones below are |
| 2366 | * responses for those requests coming back from the vendor code. |
| 2367 | **************************************************************************************************/ |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2368 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2369 | void radio::acknowledgeRequest(int slotId, int serial) { |
| 2370 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2371 | Return<void> retStatus = radioService[slotId]->mRadioResponse->acknowledgeRequest(serial); |
| 2372 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2373 | } else { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 2374 | RLOGE("radio::acknowledgeRequest: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2375 | } |
| 2376 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2377 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2378 | void populateResponseInfo(RadioResponseInfo& responseInfo, int serial, int responseType, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2379 | RIL_Errno e) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2380 | responseInfo.serial = serial; |
| 2381 | switch (responseType) { |
| 2382 | case RESPONSE_SOLICITED: |
| 2383 | responseInfo.type = RadioResponseType::SOLICITED; |
| 2384 | break; |
| 2385 | case RESPONSE_SOLICITED_ACK_EXP: |
| 2386 | responseInfo.type = RadioResponseType::SOLICITED_ACK_EXP; |
| 2387 | break; |
| 2388 | } |
| 2389 | responseInfo.error = (RadioError) e; |
| 2390 | } |
| 2391 | |
| 2392 | int responseInt(RadioResponseInfo& responseInfo, int serial, int responseType, RIL_Errno e, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2393 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2394 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2395 | int ret = -1; |
| 2396 | |
| 2397 | if (response == NULL || responseLen != sizeof(int)) { |
| 2398 | RLOGE("responseInt: Invalid response"); |
| 2399 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2400 | } else { |
| 2401 | int *p_int = (int *) response; |
| 2402 | ret = p_int[0]; |
| 2403 | } |
| 2404 | return ret; |
| 2405 | } |
| 2406 | |
| 2407 | int radio::getIccCardStatusResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2408 | int responseType, int serial, RIL_Errno e, |
| 2409 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2410 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2411 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2412 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2413 | CardStatus cardStatus = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2414 | if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)) { |
| 2415 | RLOGE("radio::getIccCardStatusResponse: Invalid response"); |
| 2416 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2417 | } else { |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2418 | RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response); |
| 2419 | cardStatus.cardState = (CardState) p_cur->card_state; |
| 2420 | cardStatus.universalPinState = (PinState) p_cur->universal_pin_state; |
| 2421 | cardStatus.gsmUmtsSubscriptionAppIndex = p_cur->gsm_umts_subscription_app_index; |
| 2422 | cardStatus.cdmaSubscriptionAppIndex = p_cur->cdma_subscription_app_index; |
| 2423 | cardStatus.imsSubscriptionAppIndex = p_cur->ims_subscription_app_index; |
| 2424 | |
| 2425 | RIL_AppStatus *rilAppStatus = p_cur->applications; |
| 2426 | cardStatus.applications.resize(p_cur->num_applications); |
| 2427 | AppStatus *appStatus = cardStatus.applications.data(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2428 | RLOGD("radio::getIccCardStatusResponse: num_applications %d", p_cur->num_applications); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2429 | for (int i = 0; i < p_cur->num_applications; i++) { |
| 2430 | appStatus[i].appType = (AppType) rilAppStatus[i].app_type; |
| 2431 | appStatus[i].appState = (AppState) rilAppStatus[i].app_state; |
| 2432 | appStatus[i].persoSubstate = (PersoSubstate) rilAppStatus[i].perso_substate; |
| 2433 | appStatus[i].aidPtr = convertCharPtrToHidlString(rilAppStatus[i].aid_ptr); |
| 2434 | appStatus[i].appLabelPtr = convertCharPtrToHidlString( |
| 2435 | rilAppStatus[i].app_label_ptr); |
| 2436 | appStatus[i].pin1Replaced = rilAppStatus[i].pin1_replaced; |
| 2437 | appStatus[i].pin1 = (PinState) rilAppStatus[i].pin1; |
| 2438 | appStatus[i].pin2 = (PinState) rilAppStatus[i].pin2; |
| 2439 | } |
| 2440 | } |
| 2441 | |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2442 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2443 | getIccCardStatusResponse(responseInfo, cardStatus); |
| 2444 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2445 | } else { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2446 | RLOGE("radio::getIccCardStatusResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 2447 | } |
| 2448 | |
| 2449 | return 0; |
| 2450 | } |
| 2451 | |
| 2452 | int radio::supplyIccPinForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2453 | int responseType, int serial, RIL_Errno e, |
| 2454 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2455 | RLOGD("radio::supplyIccPinForAppResponse: serial %d", serial); |
| 2456 | |
| 2457 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2458 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2459 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2460 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2461 | supplyIccPinForAppResponse(responseInfo, ret); |
| 2462 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2463 | } else { |
| 2464 | RLOGE("radio::supplyIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2465 | slotId); |
| 2466 | } |
| 2467 | |
| 2468 | return 0; |
| 2469 | } |
| 2470 | |
| 2471 | int radio::supplyIccPukForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2472 | int responseType, int serial, RIL_Errno e, |
| 2473 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2474 | RLOGD("radio::supplyIccPukForAppResponse: serial %d", serial); |
| 2475 | |
| 2476 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2477 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2478 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2479 | Return<void> retStatus = radioService[slotId]->mRadioResponse->supplyIccPukForAppResponse( |
| 2480 | responseInfo, ret); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2481 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2482 | } else { |
| 2483 | RLOGE("radio::supplyIccPukForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2484 | slotId); |
| 2485 | } |
| 2486 | |
| 2487 | return 0; |
| 2488 | } |
| 2489 | |
| 2490 | int radio::supplyIccPin2ForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2491 | int responseType, int serial, RIL_Errno e, |
| 2492 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2493 | RLOGD("radio::supplyIccPin2ForAppResponse: serial %d", serial); |
| 2494 | |
| 2495 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2496 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2497 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2498 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2499 | supplyIccPin2ForAppResponse(responseInfo, ret); |
| 2500 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2501 | } else { |
| 2502 | RLOGE("radio::supplyIccPin2ForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2503 | slotId); |
| 2504 | } |
| 2505 | |
| 2506 | return 0; |
| 2507 | } |
| 2508 | |
| 2509 | int radio::supplyIccPuk2ForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2510 | int responseType, int serial, RIL_Errno e, |
| 2511 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2512 | RLOGD("radio::supplyIccPuk2ForAppResponse: serial %d", serial); |
| 2513 | |
| 2514 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2515 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2516 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2517 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2518 | supplyIccPuk2ForAppResponse(responseInfo, ret); |
| 2519 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2520 | } else { |
| 2521 | RLOGE("radio::supplyIccPuk2ForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2522 | slotId); |
| 2523 | } |
| 2524 | |
| 2525 | return 0; |
| 2526 | } |
| 2527 | |
| 2528 | int radio::changeIccPinForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2529 | int responseType, int serial, RIL_Errno e, |
| 2530 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2531 | RLOGD("radio::changeIccPinForAppResponse: serial %d", serial); |
| 2532 | |
| 2533 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2534 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2535 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2536 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2537 | changeIccPinForAppResponse(responseInfo, ret); |
| 2538 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2539 | } else { |
| 2540 | RLOGE("radio::changeIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2541 | slotId); |
| 2542 | } |
| 2543 | |
| 2544 | return 0; |
| 2545 | } |
| 2546 | |
| 2547 | int radio::changeIccPin2ForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2548 | int responseType, int serial, RIL_Errno e, |
| 2549 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2550 | RLOGD("radio::changeIccPin2ForAppResponse: serial %d", serial); |
| 2551 | |
| 2552 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2553 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2554 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2555 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2556 | changeIccPin2ForAppResponse(responseInfo, ret); |
| 2557 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2558 | } else { |
| 2559 | RLOGE("radio::changeIccPin2ForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2560 | slotId); |
| 2561 | } |
| 2562 | |
| 2563 | return 0; |
| 2564 | } |
| 2565 | |
| 2566 | int radio::supplyNetworkDepersonalizationResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2567 | int responseType, int serial, RIL_Errno e, |
| 2568 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2569 | RLOGD("radio::supplyNetworkDepersonalizationResponse: serial %d", serial); |
| 2570 | |
| 2571 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2572 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2573 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2574 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2575 | supplyNetworkDepersonalizationResponse(responseInfo, ret); |
| 2576 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2577 | } else { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2578 | RLOGE("radio::supplyNetworkDepersonalizationResponse: radioService[%d]->mRadioResponse == " |
| 2579 | "NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2580 | } |
| 2581 | |
| 2582 | return 0; |
| 2583 | } |
| 2584 | |
| 2585 | int radio::getCurrentCallsResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2586 | int responseType, int serial, RIL_Errno e, |
| 2587 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2588 | RLOGD("radio::getCurrentCallsResponse: serial %d", serial); |
| 2589 | |
| 2590 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2591 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2592 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2593 | |
| 2594 | hidl_vec<Call> calls; |
| 2595 | if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) { |
| 2596 | RLOGE("radio::getCurrentCallsResponse: Invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 2597 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2598 | } else { |
| 2599 | int num = responseLen / sizeof(RIL_Call *); |
| 2600 | calls.resize(num); |
| 2601 | |
| 2602 | for (int i = 0 ; i < num ; i++) { |
| 2603 | RIL_Call *p_cur = ((RIL_Call **) response)[i]; |
| 2604 | /* each call info */ |
| 2605 | calls[i].state = (CallState) p_cur->state; |
| 2606 | calls[i].index = p_cur->index; |
| 2607 | calls[i].toa = p_cur->toa; |
| 2608 | calls[i].isMpty = p_cur->isMpty; |
| 2609 | calls[i].isMT = p_cur->isMT; |
| 2610 | calls[i].als = p_cur->als; |
| 2611 | calls[i].isVoice = p_cur->isVoice; |
| 2612 | calls[i].isVoicePrivacy = p_cur->isVoicePrivacy; |
| 2613 | calls[i].number = convertCharPtrToHidlString(p_cur->number); |
| 2614 | calls[i].numberPresentation = (CallPresentation) p_cur->numberPresentation; |
| 2615 | calls[i].name = convertCharPtrToHidlString(p_cur->name); |
| 2616 | calls[i].namePresentation = (CallPresentation) p_cur->namePresentation; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2617 | if (p_cur->uusInfo != NULL && p_cur->uusInfo->uusData != NULL) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2618 | RIL_UUS_Info *uusInfo = p_cur->uusInfo; |
| 2619 | calls[i].uusInfo[0].uusType = (UusType) uusInfo->uusType; |
| 2620 | calls[i].uusInfo[0].uusDcs = (UusDcs) uusInfo->uusDcs; |
| 2621 | // convert uusInfo->uusData to a null-terminated string |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2622 | char *nullTermStr = strndup(uusInfo->uusData, uusInfo->uusLength); |
| 2623 | calls[i].uusInfo[0].uusData = nullTermStr; |
| 2624 | free(nullTermStr); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2625 | } |
| 2626 | } |
| 2627 | } |
| 2628 | |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2629 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2630 | getCurrentCallsResponse(responseInfo, calls); |
| 2631 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2632 | } else { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 2633 | RLOGE("radio::getCurrentCallsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2634 | } |
| 2635 | |
| 2636 | return 0; |
| 2637 | } |
| 2638 | |
| 2639 | int radio::dialResponse(android::Parcel &p, int slotId, int requestNumber, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2640 | int responseType, int serial, RIL_Errno e, void *response, |
| 2641 | size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2642 | RLOGD("radio::dialResponse: serial %d", serial); |
| 2643 | |
| 2644 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2645 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2646 | populateResponseInfo(responseInfo, serial, responseType, e); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2647 | Return<void> retStatus = radioService[slotId]->mRadioResponse->dialResponse(responseInfo); |
| 2648 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2649 | } else { |
| 2650 | RLOGE("radio::dialResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2651 | } |
| 2652 | |
| 2653 | return 0; |
| 2654 | } |
| 2655 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2656 | int radio::getIMSIForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2657 | int responseType, int serial, RIL_Errno e, void *response, |
| 2658 | size_t responseLen) { |
| 2659 | RLOGD("radio::getIMSIForAppResponse: serial %d", serial); |
| 2660 | |
| 2661 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2662 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2663 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2664 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getIMSIForAppResponse( |
| 2665 | responseInfo, convertCharPtrToHidlString((char *) response)); |
| 2666 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2667 | } else { |
| 2668 | RLOGE("radio::getIMSIForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 2669 | slotId); |
| 2670 | } |
| 2671 | |
| 2672 | return 0; |
| 2673 | } |
| 2674 | |
| 2675 | int radio::hangupConnectionResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2676 | int responseType, int serial, RIL_Errno e, |
| 2677 | void *response, size_t responseLen) { |
| 2678 | RLOGD("radio::hangupConnectionResponse: serial %d", serial); |
| 2679 | |
| 2680 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2681 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2682 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2683 | Return<void> retStatus = radioService[slotId]->mRadioResponse->hangupConnectionResponse( |
| 2684 | responseInfo); |
| 2685 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2686 | } else { |
| 2687 | RLOGE("radio::hangupConnectionResponse: radioService[%d]->mRadioResponse == NULL", |
| 2688 | slotId); |
| 2689 | } |
| 2690 | |
| 2691 | return 0; |
| 2692 | } |
| 2693 | |
| 2694 | int radio::hangupWaitingOrBackgroundResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2695 | int responseType, int serial, RIL_Errno e, |
| 2696 | void *response, size_t responseLen) { |
| 2697 | RLOGD("radio::hangupWaitingOrBackgroundResponse: serial %d", serial); |
| 2698 | |
| 2699 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2700 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2701 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2702 | Return<void> retStatus = |
| 2703 | radioService[slotId]->mRadioResponse->hangupWaitingOrBackgroundResponse( |
| 2704 | responseInfo); |
| 2705 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2706 | } else { |
| 2707 | RLOGE("radio::hangupWaitingOrBackgroundResponse: radioService[%d]->mRadioResponse == NULL", |
| 2708 | slotId); |
| 2709 | } |
| 2710 | |
| 2711 | return 0; |
| 2712 | } |
| 2713 | |
| 2714 | int radio::hangupForegroundResumeBackgroundResponse(android::Parcel &p, int slotId, |
| 2715 | int requestNumber, |
| 2716 | int responseType, int serial, RIL_Errno e, |
| 2717 | void *response, size_t responseLen) { |
| 2718 | RLOGD("radio::hangupWaitingOrBackgroundResponse: serial %d", serial); |
| 2719 | |
| 2720 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2721 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2722 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2723 | Return<void> retStatus = |
| 2724 | radioService[slotId]->mRadioResponse->hangupWaitingOrBackgroundResponse( |
| 2725 | responseInfo); |
| 2726 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2727 | } else { |
| 2728 | RLOGE("radio::hangupWaitingOrBackgroundResponse: radioService[%d]->mRadioResponse == NULL", |
| 2729 | slotId); |
| 2730 | } |
| 2731 | |
| 2732 | return 0; |
| 2733 | } |
| 2734 | |
| 2735 | int radio::switchWaitingOrHoldingAndActiveResponse(android::Parcel &p, int slotId, |
| 2736 | int requestNumber, |
| 2737 | int responseType, int serial, RIL_Errno e, |
| 2738 | void *response, size_t responseLen) { |
| 2739 | RLOGD("radio::switchWaitingOrHoldingAndActiveResponse: serial %d", serial); |
| 2740 | |
| 2741 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2742 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2743 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2744 | Return<void> retStatus = |
| 2745 | radioService[slotId]->mRadioResponse->switchWaitingOrHoldingAndActiveResponse( |
| 2746 | responseInfo); |
| 2747 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2748 | } else { |
| 2749 | RLOGE("radio::switchWaitingOrHoldingAndActiveResponse: radioService[%d]->mRadioResponse " |
| 2750 | "== NULL", slotId); |
| 2751 | } |
| 2752 | |
| 2753 | return 0; |
| 2754 | } |
| 2755 | |
| 2756 | int radio::conferenceResponse(android::Parcel &p, int slotId, int requestNumber, int responseType, |
| 2757 | int serial, RIL_Errno e, void *response, size_t responseLen) { |
| 2758 | RLOGD("radio::conferenceResponse: serial %d", serial); |
| 2759 | |
| 2760 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2761 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2762 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2763 | Return<void> retStatus = radioService[slotId]->mRadioResponse->conferenceResponse( |
| 2764 | responseInfo); |
| 2765 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2766 | } else { |
| 2767 | RLOGE("radio::conferenceResponse: radioService[%d]->mRadioResponse == NULL", |
| 2768 | slotId); |
| 2769 | } |
| 2770 | |
| 2771 | return 0; |
| 2772 | } |
| 2773 | |
| 2774 | int radio::rejectCallResponse(android::Parcel &p, int slotId, int requestNumber, int responseType, |
| 2775 | int serial, RIL_Errno e, void *response, size_t responseLen) { |
| 2776 | RLOGD("radio::rejectCallResponse: serial %d", serial); |
| 2777 | |
| 2778 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2779 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2780 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2781 | Return<void> retStatus = radioService[slotId]->mRadioResponse->rejectCallResponse( |
| 2782 | responseInfo); |
| 2783 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2784 | } else { |
| 2785 | RLOGE("radio::rejectCallResponse: radioService[%d]->mRadioResponse == NULL", |
| 2786 | slotId); |
| 2787 | } |
| 2788 | |
| 2789 | return 0; |
| 2790 | } |
| 2791 | |
| 2792 | int radio::getLastCallFailCauseResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2793 | int responseType, int serial, RIL_Errno e, void *response, |
| 2794 | size_t responseLen) { |
| 2795 | RLOGD("radio::getLastCallFailCauseResponse: serial %d", serial); |
| 2796 | |
| 2797 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2798 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2799 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2800 | |
| 2801 | LastCallFailCauseInfo info = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2802 | info.vendorCause = hidl_string(); |
| 2803 | if (response == NULL) { |
| 2804 | RLOGE("radio::getCurrentCallsResponse Invalid response: NULL"); |
| 2805 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2806 | } else if (responseLen == sizeof(int)) { |
| 2807 | int *pInt = (int *) response; |
| 2808 | info.causeCode = (LastCallFailCause) pInt[0]; |
| 2809 | } else if (responseLen == sizeof(RIL_LastCallFailCauseInfo)) { |
| 2810 | RIL_LastCallFailCauseInfo *pFailCauseInfo = (RIL_LastCallFailCauseInfo *) response; |
| 2811 | info.causeCode = (LastCallFailCause) pFailCauseInfo->cause_code; |
| 2812 | info.vendorCause = convertCharPtrToHidlString(pFailCauseInfo->vendor_cause); |
| 2813 | } else { |
| 2814 | RLOGE("radio::getCurrentCallsResponse Invalid response: NULL"); |
| 2815 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2816 | } |
| 2817 | |
| 2818 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getLastCallFailCauseResponse( |
| 2819 | responseInfo, info); |
| 2820 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2821 | } else { |
| 2822 | RLOGE("radio::getLastCallFailCauseResponse: radioService[%d]->mRadioResponse == NULL", |
| 2823 | slotId); |
| 2824 | } |
| 2825 | |
| 2826 | return 0; |
| 2827 | } |
| 2828 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2829 | int radio::getSignalStrengthResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2830 | int responseType, int serial, RIL_Errno e, |
| 2831 | void *response, size_t responseLen) { |
| 2832 | RLOGD("radio::getSignalStrengthResponse: serial %d", serial); |
| 2833 | |
| 2834 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 2835 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2836 | populateResponseInfo(responseInfo, serial, responseType, e); |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 2837 | SignalStrength signalStrength = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2838 | if (response == NULL || responseLen != sizeof(RIL_SignalStrength_v10)) { |
| 2839 | RLOGE("radio::getSignalStrengthResponse: Invalid response"); |
| 2840 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2841 | } else { |
| 2842 | convertRilSignalStrengthToHal(response, responseLen, signalStrength); |
| 2843 | } |
| 2844 | |
| 2845 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getSignalStrengthResponse( |
| 2846 | responseInfo, signalStrength); |
| 2847 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2848 | } else { |
| 2849 | RLOGE("radio::getSignalStrengthResponse: radioService[%d]->mRadioResponse == NULL", |
| 2850 | slotId); |
| 2851 | } |
| 2852 | |
| 2853 | return 0; |
| 2854 | } |
| 2855 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2856 | int radio::getVoiceRegistrationStateResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2857 | int responseType, int serial, RIL_Errno e, |
| 2858 | void *response, size_t responseLen) { |
| 2859 | RLOGD("radio::getVoiceRegistrationStateResponse: serial %d", serial); |
| 2860 | |
| 2861 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2862 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2863 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2864 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2865 | VoiceRegStateResult voiceRegResponse = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2866 | |
| 2867 | int numStrings = responseLen / sizeof(char *); |
| 2868 | |
| 2869 | if (response == NULL || numStrings != 15) { |
| 2870 | RLOGE("radio::getVoiceRegistrationStateResponse Invalid response: NULL"); |
| 2871 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2872 | } else { |
| 2873 | char **resp = (char **) response; |
| 2874 | voiceRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4); |
| 2875 | voiceRegResponse.lac = ATOI_NULL_HANDLED(resp[1]); |
| 2876 | voiceRegResponse.cid = ATOI_NULL_HANDLED(resp[2]); |
| 2877 | voiceRegResponse.rat = ATOI_NULL_HANDLED(resp[3]); |
| 2878 | voiceRegResponse.baseStationId = ATOI_NULL_HANDLED(resp[4]); |
| 2879 | voiceRegResponse.baseStationLatitude = ATOI_NULL_HANDLED_DEF(resp[5], INT_MAX); |
| 2880 | voiceRegResponse.baseStationLongitude = ATOI_NULL_HANDLED_DEF(resp[6], INT_MAX); |
| 2881 | voiceRegResponse.cssSupported = ATOI_NULL_HANDLED_DEF(resp[7], 0); |
| 2882 | voiceRegResponse.systemId = ATOI_NULL_HANDLED_DEF(resp[8], 0); |
| 2883 | voiceRegResponse.networkId = ATOI_NULL_HANDLED_DEF(resp[9], 0); |
| 2884 | voiceRegResponse.roamingIndicator = ATOI_NULL_HANDLED(resp[10]); |
| 2885 | voiceRegResponse.systemIsInPrl = ATOI_NULL_HANDLED_DEF(resp[11], 0); |
| 2886 | voiceRegResponse.defaultRoamingIndicator = ATOI_NULL_HANDLED_DEF(resp[12], 0); |
| 2887 | voiceRegResponse.reasonForDenial = ATOI_NULL_HANDLED_DEF(resp[13], 0); |
| 2888 | voiceRegResponse.psc = ATOI_NULL_HANDLED(resp[14]); |
| 2889 | } |
| 2890 | |
| 2891 | Return<void> retStatus = |
| 2892 | radioService[slotId]->mRadioResponse->getVoiceRegistrationStateResponse( |
| 2893 | responseInfo, voiceRegResponse); |
| 2894 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2895 | } else { |
| 2896 | RLOGE("radio::getVoiceRegistrationStateResponse: radioService[%d]->mRadioResponse == NULL", |
| 2897 | slotId); |
| 2898 | } |
| 2899 | |
| 2900 | return 0; |
| 2901 | } |
| 2902 | |
| 2903 | int radio::getDataRegistrationStateResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2904 | int responseType, int serial, RIL_Errno e, |
| 2905 | void *response, size_t responseLen) { |
| 2906 | RLOGD("radio::getDataRegistrationStateResponse: serial %d", serial); |
| 2907 | |
| 2908 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2909 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2910 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2911 | DataRegStateResult dataRegResponse = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2912 | int numStrings = responseLen / sizeof(char *); |
| 2913 | if (response == NULL || (numStrings != 6 && numStrings != 11)) { |
| 2914 | RLOGE("radio::getDataRegistrationStateResponse Invalid response: NULL"); |
| 2915 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2916 | } else { |
| 2917 | char **resp = (char **) response; |
| 2918 | dataRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4); |
| 2919 | dataRegResponse.lac = ATOI_NULL_HANDLED(resp[1]); |
| 2920 | dataRegResponse.cid = ATOI_NULL_HANDLED(resp[2]); |
| 2921 | dataRegResponse.rat = ATOI_NULL_HANDLED_DEF(resp[3], 0); |
| 2922 | dataRegResponse.reasonDataDenied = ATOI_NULL_HANDLED(resp[4]); |
| 2923 | dataRegResponse.maxDataCalls = ATOI_NULL_HANDLED_DEF(resp[5], 1); |
| 2924 | if (numStrings == 11) { |
| 2925 | dataRegResponse.tac = ATOI_NULL_HANDLED(resp[6]); |
| 2926 | dataRegResponse.phyCid = ATOI_NULL_HANDLED(resp[7]); |
| 2927 | dataRegResponse.eci = ATOI_NULL_HANDLED(resp[8]); |
| 2928 | dataRegResponse.csgid = ATOI_NULL_HANDLED(resp[9]); |
| 2929 | dataRegResponse.tadv = ATOI_NULL_HANDLED(resp[10]); |
| 2930 | } |
| 2931 | } |
| 2932 | |
| 2933 | Return<void> retStatus = |
| 2934 | radioService[slotId]->mRadioResponse->getDataRegistrationStateResponse(responseInfo, |
| 2935 | dataRegResponse); |
| 2936 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2937 | } else { |
| 2938 | RLOGE("radio::getDataRegistrationStateResponse: radioService[%d]->mRadioResponse == NULL", |
| 2939 | slotId); |
| 2940 | } |
| 2941 | |
| 2942 | return 0; |
| 2943 | } |
| 2944 | |
| 2945 | int radio::getOperatorResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2946 | int responseType, int serial, RIL_Errno e, void *response, |
| 2947 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2948 | RLOGD("radio::getOperatorResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2949 | |
| 2950 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2951 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2952 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2953 | hidl_string longName; |
| 2954 | hidl_string shortName; |
| 2955 | hidl_string numeric; |
| 2956 | int numStrings = responseLen / sizeof(char *); |
| 2957 | if (response == NULL || numStrings != 3) { |
| 2958 | RLOGE("radio::getOperatorResponse Invalid response: NULL"); |
| 2959 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2960 | |
| 2961 | } else { |
| 2962 | char **resp = (char **) response; |
| 2963 | longName = convertCharPtrToHidlString(resp[0]); |
| 2964 | shortName = convertCharPtrToHidlString(resp[1]); |
| 2965 | numeric = convertCharPtrToHidlString(resp[2]); |
| 2966 | } |
| 2967 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getOperatorResponse( |
| 2968 | responseInfo, longName, shortName, numeric); |
| 2969 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2970 | } else { |
| 2971 | RLOGE("radio::getOperatorResponse: radioService[%d]->mRadioResponse == NULL", |
| 2972 | slotId); |
| 2973 | } |
| 2974 | |
| 2975 | return 0; |
| 2976 | } |
| 2977 | |
| 2978 | int radio::setRadioPowerResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2979 | int responseType, int serial, RIL_Errno e, void *response, |
| 2980 | size_t responseLen) { |
| 2981 | RLOGD("radio::setRadioPowerResponse: serial %d", serial); |
| 2982 | |
| 2983 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2984 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2985 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2986 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setRadioPowerResponse( |
| 2987 | responseInfo); |
| 2988 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2989 | } else { |
| 2990 | RLOGE("radio::setRadioPowerResponse: radioService[%d]->mRadioResponse == NULL", |
| 2991 | slotId); |
| 2992 | } |
| 2993 | |
| 2994 | return 0; |
| 2995 | } |
| 2996 | |
| 2997 | int radio::sendDtmfResponse(android::Parcel &p, int slotId, int requestNumber, |
| 2998 | int responseType, int serial, RIL_Errno e, void *response, |
| 2999 | size_t responseLen) { |
| 3000 | RLOGD("radio::sendDtmfResponse: serial %d", serial); |
| 3001 | |
| 3002 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3003 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3004 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3005 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendDtmfResponse( |
| 3006 | responseInfo); |
| 3007 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3008 | } else { |
| 3009 | RLOGE("radio::sendDtmfResponse: radioService[%d]->mRadioResponse == NULL", |
| 3010 | slotId); |
| 3011 | } |
| 3012 | |
| 3013 | return 0; |
| 3014 | } |
| 3015 | |
| 3016 | SendSmsResult makeSendSmsResult(RadioResponseInfo& responseInfo, int serial, int responseType, |
| 3017 | RIL_Errno e, void *response, size_t responseLen) { |
| 3018 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3019 | SendSmsResult result = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3020 | |
| 3021 | if (response == NULL || responseLen != sizeof(RIL_SMS_Response)) { |
| 3022 | RLOGE("Invalid response: NULL"); |
| 3023 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3024 | result.ackPDU = hidl_string(); |
| 3025 | } else { |
| 3026 | RIL_SMS_Response *resp = (RIL_SMS_Response *) response; |
| 3027 | result.messageRef = resp->messageRef; |
| 3028 | result.ackPDU = convertCharPtrToHidlString(resp->ackPDU); |
| 3029 | result.errorCode = resp->errorCode; |
| 3030 | } |
| 3031 | return result; |
| 3032 | } |
| 3033 | |
| 3034 | int radio::sendSmsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3035 | int responseType, int serial, RIL_Errno e, void *response, |
| 3036 | size_t responseLen) { |
| 3037 | RLOGD("radio::sendSmsResponse: serial %d", serial); |
| 3038 | |
| 3039 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3040 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3041 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 3042 | responseLen); |
| 3043 | |
| 3044 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendSmsResponse(responseInfo, |
| 3045 | result); |
| 3046 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3047 | } else { |
| 3048 | RLOGE("radio::sendSmsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3049 | } |
| 3050 | |
| 3051 | return 0; |
| 3052 | } |
| 3053 | |
| 3054 | int radio::sendSMSExpectMoreResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3055 | int responseType, int serial, RIL_Errno e, void *response, |
| 3056 | size_t responseLen) { |
| 3057 | RLOGD("radio::sendSMSExpectMoreResponse: serial %d", serial); |
| 3058 | |
| 3059 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3060 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3061 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 3062 | responseLen); |
| 3063 | |
| 3064 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendSMSExpectMoreResponse( |
| 3065 | responseInfo, result); |
| 3066 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3067 | } else { |
| 3068 | RLOGE("radio::sendSMSExpectMoreResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3069 | } |
| 3070 | |
| 3071 | return 0; |
| 3072 | } |
| 3073 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3074 | int radio::setupDataCallResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3075 | int responseType, int serial, RIL_Errno e, void *response, |
| 3076 | size_t responseLen) { |
| 3077 | RLOGD("radio::setupDataCallResponse: serial %d", serial); |
| 3078 | |
| 3079 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3080 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3081 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3082 | |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3083 | SetupDataCallResult result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3084 | if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) { |
| 3085 | RLOGE("radio::setupDataCallResponse: Invalid response"); |
| 3086 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Jack Yu | 5079e18 | 2017-02-28 15:21:18 -0800 | [diff] [blame^] | 3087 | result.status = DataCallFailCause::ERROR_UNSPECIFIED; |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3088 | result.type = hidl_string(); |
| 3089 | result.ifname = hidl_string(); |
| 3090 | result.addresses = hidl_string(); |
| 3091 | result.dnses = hidl_string(); |
| 3092 | result.gateways = hidl_string(); |
| 3093 | result.pcscf = hidl_string(); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3094 | } else { |
| 3095 | convertRilDataCallToHal((RIL_Data_Call_Response_v11 *) response, result); |
| 3096 | } |
| 3097 | |
| 3098 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setupDataCallResponse( |
| 3099 | responseInfo, result); |
| 3100 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3101 | } else { |
| 3102 | RLOGE("radio::setupDataCallResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3103 | } |
| 3104 | |
| 3105 | return 0; |
| 3106 | } |
| 3107 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3108 | IccIoResult responseIccIo(RadioResponseInfo& responseInfo, int serial, int responseType, |
| 3109 | RIL_Errno e, void *response, size_t responseLen) { |
| 3110 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3111 | IccIoResult result = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3112 | |
| 3113 | if (response == NULL || responseLen != sizeof(RIL_SIM_IO_Response)) { |
| 3114 | RLOGE("Invalid response: NULL"); |
| 3115 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3116 | result.simResponse = hidl_string(); |
| 3117 | } else { |
| 3118 | RIL_SIM_IO_Response *resp = (RIL_SIM_IO_Response *) response; |
| 3119 | result.sw1 = resp->sw1; |
| 3120 | result.sw2 = resp->sw2; |
| 3121 | result.simResponse = convertCharPtrToHidlString(resp->simResponse); |
| 3122 | } |
| 3123 | return result; |
| 3124 | } |
| 3125 | |
| 3126 | int radio::iccIOForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3127 | int responseType, int serial, RIL_Errno e, void *response, |
| 3128 | size_t responseLen) { |
| 3129 | RLOGD("radio::radio::iccIOForAppResponse: serial %d", serial); |
| 3130 | |
| 3131 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3132 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3133 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 3134 | responseLen); |
| 3135 | |
| 3136 | Return<void> retStatus = radioService[slotId]->mRadioResponse->iccIOForAppResponse( |
| 3137 | responseInfo, result); |
| 3138 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3139 | } else { |
| 3140 | RLOGE("radio::iccIOForAppResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3141 | } |
| 3142 | |
| 3143 | return 0; |
| 3144 | } |
| 3145 | |
| 3146 | int radio::sendUssdResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3147 | int responseType, int serial, RIL_Errno e, void *response, |
| 3148 | size_t responseLen) { |
| 3149 | RLOGD("radio::sendUssdResponse: serial %d", serial); |
| 3150 | |
| 3151 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3152 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3153 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3154 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendUssdResponse( |
| 3155 | responseInfo); |
| 3156 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3157 | } else { |
| 3158 | RLOGE("radio::sendUssdResponse: radioService[%d]->mRadioResponse == NULL", |
| 3159 | slotId); |
| 3160 | } |
| 3161 | |
| 3162 | return 0; |
| 3163 | } |
| 3164 | |
| 3165 | int radio::cancelPendingUssdResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3166 | int responseType, int serial, RIL_Errno e, void *response, |
| 3167 | size_t responseLen) { |
| 3168 | RLOGD("radio::cancelPendingUssdResponse: serial %d", serial); |
| 3169 | |
| 3170 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3171 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3172 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3173 | Return<void> retStatus = radioService[slotId]->mRadioResponse->cancelPendingUssdResponse( |
| 3174 | responseInfo); |
| 3175 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3176 | } else { |
| 3177 | RLOGE("radio::cancelPendingUssdResponse: radioService[%d]->mRadioResponse == NULL", |
| 3178 | slotId); |
| 3179 | } |
| 3180 | |
| 3181 | return 0; |
| 3182 | } |
| 3183 | |
| 3184 | int radio::getClirResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3185 | int responseType, int serial, RIL_Errno e, void *response, |
| 3186 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3187 | RLOGD("radio::getClirResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3188 | |
| 3189 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3190 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3191 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3192 | int n = -1, m = -1; |
| 3193 | int numInts = responseLen / sizeof(int); |
| 3194 | if (response == NULL || numInts != 2) { |
| 3195 | RLOGE("radio::getClirResponse Invalid response: NULL"); |
| 3196 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3197 | } else { |
| 3198 | int *pInt = (int *) response; |
| 3199 | n = pInt[0]; |
| 3200 | m = pInt[1]; |
| 3201 | } |
| 3202 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getClirResponse(responseInfo, |
| 3203 | n, m); |
| 3204 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3205 | } else { |
| 3206 | RLOGE("radio::getClirResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3207 | } |
| 3208 | |
| 3209 | return 0; |
| 3210 | } |
| 3211 | |
| 3212 | int radio::setClirResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3213 | int responseType, int serial, RIL_Errno e, void *response, |
| 3214 | size_t responseLen) { |
| 3215 | RLOGD("radio::setClirResponse: serial %d", serial); |
| 3216 | |
| 3217 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3218 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3219 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3220 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setClirResponse( |
| 3221 | responseInfo); |
| 3222 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3223 | } else { |
| 3224 | RLOGE("radio::setClirResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3225 | } |
| 3226 | |
| 3227 | return 0; |
| 3228 | } |
| 3229 | |
| 3230 | int radio::getCallForwardStatusResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3231 | int responseType, int serial, RIL_Errno e, |
| 3232 | void *response, size_t responseLen) { |
| 3233 | RLOGD("radio::getCallForwardStatusResponse: serial %d", serial); |
| 3234 | |
| 3235 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3236 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3237 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3238 | hidl_vec<CallForwardInfo> callForwardInfos; |
| 3239 | |
| 3240 | if (response == NULL || responseLen % sizeof(RIL_CallForwardInfo *) != 0) { |
| 3241 | RLOGE("radio::getCallForwardStatusResponse Invalid response: NULL"); |
| 3242 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3243 | } else { |
| 3244 | int num = responseLen / sizeof(RIL_CallForwardInfo *); |
| 3245 | callForwardInfos.resize(num); |
| 3246 | for (int i = 0 ; i < num; i++) { |
| 3247 | RIL_CallForwardInfo *resp = ((RIL_CallForwardInfo **) response)[i]; |
| 3248 | callForwardInfos[i].status = (CallForwardInfoStatus) resp->status; |
| 3249 | callForwardInfos[i].reason = resp->reason; |
| 3250 | callForwardInfos[i].serviceClass = resp->serviceClass; |
| 3251 | callForwardInfos[i].toa = resp->toa; |
| 3252 | callForwardInfos[i].number = convertCharPtrToHidlString(resp->number); |
| 3253 | callForwardInfos[i].timeSeconds = resp->timeSeconds; |
| 3254 | } |
| 3255 | } |
| 3256 | |
| 3257 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getCallForwardStatusResponse( |
| 3258 | responseInfo, callForwardInfos); |
| 3259 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3260 | } else { |
| 3261 | RLOGE("radio::getCallForwardStatusResponse: radioService[%d]->mRadioResponse == NULL", |
| 3262 | slotId); |
| 3263 | } |
| 3264 | |
| 3265 | return 0; |
| 3266 | } |
| 3267 | |
| 3268 | int radio::setCallForwardResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3269 | int responseType, int serial, RIL_Errno e, void *response, |
| 3270 | size_t responseLen) { |
| 3271 | RLOGD("radio::setCallForwardResponse: serial %d", serial); |
| 3272 | |
| 3273 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3274 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3275 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3276 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setCallForwardResponse( |
| 3277 | responseInfo); |
| 3278 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3279 | } else { |
| 3280 | RLOGE("radio::setCallForwardResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3281 | } |
| 3282 | |
| 3283 | return 0; |
| 3284 | } |
| 3285 | |
| 3286 | int radio::getCallWaitingResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3287 | int responseType, int serial, RIL_Errno e, void *response, |
| 3288 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3289 | RLOGD("radio::getCallWaitingResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3290 | |
| 3291 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3292 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3293 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3294 | bool enable = false; |
| 3295 | int serviceClass = -1; |
| 3296 | int numInts = responseLen / sizeof(int); |
| 3297 | if (response == NULL || numInts != 2) { |
| 3298 | RLOGE("radio::getCallWaitingResponse Invalid response: NULL"); |
| 3299 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3300 | } else { |
| 3301 | int *pInt = (int *) response; |
| 3302 | enable = pInt[0] == 1 ? true : false; |
| 3303 | serviceClass = pInt[1]; |
| 3304 | } |
| 3305 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getClirResponse(responseInfo, |
| 3306 | enable, serviceClass); |
| 3307 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3308 | } else { |
| 3309 | RLOGE("radio::getCallWaitingResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3310 | } |
| 3311 | |
| 3312 | return 0; |
| 3313 | } |
| 3314 | |
| 3315 | int radio::setCallWaitingResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3316 | int responseType, int serial, RIL_Errno e, void *response, |
| 3317 | size_t responseLen) { |
| 3318 | RLOGD("radio::setCallWaitingResponse: serial %d", serial); |
| 3319 | |
| 3320 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3321 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3322 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3323 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setCallWaitingResponse( |
| 3324 | responseInfo); |
| 3325 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3326 | } else { |
| 3327 | RLOGE("radio::setCallWaitingResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3328 | } |
| 3329 | |
| 3330 | return 0; |
| 3331 | } |
| 3332 | |
| 3333 | int radio::acknowledgeLastIncomingGsmSmsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3334 | int responseType, int serial, RIL_Errno e, |
| 3335 | void *response, size_t responseLen) { |
| 3336 | RLOGD("radio::acknowledgeLastIncomingGsmSmsResponse: serial %d", serial); |
| 3337 | |
| 3338 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3339 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3340 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3341 | Return<void> retStatus = |
| 3342 | radioService[slotId]->mRadioResponse->acknowledgeLastIncomingGsmSmsResponse( |
| 3343 | responseInfo); |
| 3344 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3345 | } else { |
| 3346 | RLOGE("radio::acknowledgeLastIncomingGsmSmsResponse: radioService[%d]->mRadioResponse " |
| 3347 | "== NULL", slotId); |
| 3348 | } |
| 3349 | |
| 3350 | return 0; |
| 3351 | } |
| 3352 | |
| 3353 | int radio::acceptCallResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3354 | int responseType, int serial, RIL_Errno e, |
| 3355 | void *response, size_t responseLen) { |
| 3356 | RLOGD("radio::acceptCallResponse: serial %d", serial); |
| 3357 | |
| 3358 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3359 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3360 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3361 | Return<void> retStatus = radioService[slotId]->mRadioResponse->acceptCallResponse( |
| 3362 | responseInfo); |
| 3363 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3364 | } else { |
| 3365 | RLOGE("radio::acceptCallResponse: radioService[%d]->mRadioResponse == NULL", |
| 3366 | slotId); |
| 3367 | } |
| 3368 | |
| 3369 | return 0; |
| 3370 | } |
| 3371 | |
| 3372 | int radio::deactivateDataCallResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3373 | int responseType, int serial, RIL_Errno e, |
| 3374 | void *response, size_t responseLen) { |
| 3375 | RLOGD("radio::deactivateDataCallResponse: serial %d", serial); |
| 3376 | |
| 3377 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3378 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3379 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3380 | Return<void> retStatus = radioService[slotId]->mRadioResponse->deactivateDataCallResponse( |
| 3381 | responseInfo); |
| 3382 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3383 | } else { |
| 3384 | RLOGE("radio::deactivateDataCallResponse: radioService[%d]->mRadioResponse == NULL", |
| 3385 | slotId); |
| 3386 | } |
| 3387 | |
| 3388 | return 0; |
| 3389 | } |
| 3390 | |
| 3391 | int radio::getFacilityLockForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3392 | int responseType, int serial, RIL_Errno e, |
| 3393 | void *response, size_t responseLen) { |
| 3394 | RLOGD("radio::getFacilityLockForAppResponse: serial %d", serial); |
| 3395 | |
| 3396 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3397 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3398 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 3399 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 3400 | getFacilityLockForAppResponse(responseInfo, ret); |
| 3401 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3402 | } else { |
| 3403 | RLOGE("radio::getFacilityLockForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 3404 | slotId); |
| 3405 | } |
| 3406 | |
| 3407 | return 0; |
| 3408 | } |
| 3409 | |
| 3410 | int radio::setFacilityLockForAppResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3411 | int responseType, int serial, RIL_Errno e, |
| 3412 | void *response, size_t responseLen) { |
| 3413 | RLOGD("radio::setFacilityLockForAppResponse: serial %d", serial); |
| 3414 | |
| 3415 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3416 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3417 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 3418 | Return<void> retStatus |
| 3419 | = radioService[slotId]->mRadioResponse->setFacilityLockForAppResponse(responseInfo, |
| 3420 | ret); |
| 3421 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3422 | } else { |
| 3423 | RLOGE("radio::setFacilityLockForAppResponse: radioService[%d]->mRadioResponse == NULL", |
| 3424 | slotId); |
| 3425 | } |
| 3426 | |
| 3427 | return 0; |
| 3428 | } |
| 3429 | |
| 3430 | int radio::setBarringPasswordResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3431 | int responseType, int serial, RIL_Errno e, |
| 3432 | void *response, size_t responseLen) { |
| 3433 | RLOGD("radio::acceptCallResponse: serial %d", serial); |
| 3434 | |
| 3435 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3436 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3437 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3438 | Return<void> retStatus |
| 3439 | = radioService[slotId]->mRadioResponse->setBarringPasswordResponse(responseInfo); |
| 3440 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3441 | } else { |
| 3442 | RLOGE("radio::setBarringPasswordResponse: radioService[%d]->mRadioResponse == NULL", |
| 3443 | slotId); |
| 3444 | } |
| 3445 | |
| 3446 | return 0; |
| 3447 | } |
| 3448 | |
| 3449 | int radio::getNetworkSelectionModeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3450 | int responseType, int serial, RIL_Errno e, void *response, |
| 3451 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3452 | RLOGD("radio::getNetworkSelectionModeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3453 | |
| 3454 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3455 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3456 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3457 | bool manual = false; |
| 3458 | int serviceClass; |
| 3459 | if (response == NULL || responseLen != sizeof(int)) { |
| 3460 | RLOGE("radio::getNetworkSelectionModeResponse Invalid response: NULL"); |
| 3461 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3462 | } else { |
| 3463 | int *pInt = (int *) response; |
| 3464 | manual = pInt[0] == 1 ? true : false; |
| 3465 | } |
| 3466 | Return<void> retStatus |
| 3467 | = radioService[slotId]->mRadioResponse->getNetworkSelectionModeResponse( |
| 3468 | responseInfo, |
| 3469 | manual); |
| 3470 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3471 | } else { |
| 3472 | RLOGE("radio::getNetworkSelectionModeResponse: radioService[%d]->mRadioResponse == NULL", |
| 3473 | slotId); |
| 3474 | } |
| 3475 | |
| 3476 | return 0; |
| 3477 | } |
| 3478 | |
| 3479 | int radio::setNetworkSelectionModeAutomaticResponse(android::Parcel &p, int slotId, |
| 3480 | int requestNumber, |
| 3481 | int responseType, int serial, RIL_Errno e, |
| 3482 | void *response, size_t responseLen) { |
| 3483 | RLOGD("radio::setNetworkSelectionModeAutomaticResponse: serial %d", serial); |
| 3484 | |
| 3485 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3486 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3487 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3488 | Return<void> retStatus |
| 3489 | = radioService[slotId]->mRadioResponse->setNetworkSelectionModeAutomaticResponse( |
| 3490 | responseInfo); |
| 3491 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3492 | } else { |
| 3493 | RLOGE("radio::setNetworkSelectionModeAutomaticResponse: radioService[%d]->mRadioResponse " |
| 3494 | "== NULL", slotId); |
| 3495 | } |
| 3496 | |
| 3497 | return 0; |
| 3498 | } |
| 3499 | |
| 3500 | int radio::setNetworkSelectionModeManualResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3501 | int responseType, int serial, RIL_Errno e, |
| 3502 | void *response, size_t responseLen) { |
| 3503 | RLOGD("radio::setNetworkSelectionModeManualResponse: serial %d", serial); |
| 3504 | |
| 3505 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3506 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3507 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3508 | Return<void> retStatus |
| 3509 | = radioService[slotId]->mRadioResponse->setNetworkSelectionModeManualResponse( |
| 3510 | responseInfo); |
| 3511 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3512 | } else { |
| 3513 | RLOGE("radio::acceptCallResponse: radioService[%d]->setNetworkSelectionModeManualResponse " |
| 3514 | "== NULL", slotId); |
| 3515 | } |
| 3516 | |
| 3517 | return 0; |
| 3518 | } |
| 3519 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3520 | int convertOperatorStatusToInt(const char *str) { |
| 3521 | if (strncmp("unknown", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3522 | return (int) OperatorStatus::UNKNOWN; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3523 | } else if (strncmp("available", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3524 | return (int) OperatorStatus::AVAILABLE; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3525 | } else if (strncmp("current", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3526 | return (int) OperatorStatus::CURRENT; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3527 | } else if (strncmp("forbidden", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3528 | return (int) OperatorStatus::FORBIDDEN; |
| 3529 | } else { |
| 3530 | return -1; |
| 3531 | } |
| 3532 | } |
| 3533 | |
| 3534 | int radio::getAvailableNetworksResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3535 | int responseType, int serial, RIL_Errno e, void *response, |
| 3536 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3537 | RLOGD("radio::getAvailableNetworksResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3538 | |
| 3539 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3540 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3541 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3542 | hidl_vec<OperatorInfo> networks; |
| 3543 | if (response == NULL || responseLen % (4 * sizeof(char *))!= 0) { |
| 3544 | RLOGE("radio::getAvailableNetworksResponse Invalid response: NULL"); |
| 3545 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3546 | } else { |
| 3547 | char **resp = (char **) response; |
| 3548 | int numStrings = responseLen / sizeof(char *); |
| 3549 | networks.resize(numStrings/4); |
| 3550 | for (int i = 0; i < numStrings; i = i + 4) { |
| 3551 | networks[i].alphaLong = convertCharPtrToHidlString(resp[i]); |
| 3552 | networks[i].alphaShort = convertCharPtrToHidlString(resp[i + 1]); |
| 3553 | networks[i].operatorNumeric = convertCharPtrToHidlString(resp[i + 2]); |
| 3554 | int status = convertOperatorStatusToInt(resp[i + 3]); |
| 3555 | if (status == -1) { |
| 3556 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3557 | } else { |
| 3558 | networks[i].status = (OperatorStatus) status; |
| 3559 | } |
| 3560 | } |
| 3561 | } |
| 3562 | Return<void> retStatus |
| 3563 | = radioService[slotId]->mRadioResponse->getAvailableNetworksResponse(responseInfo, |
| 3564 | networks); |
| 3565 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3566 | } else { |
| 3567 | RLOGE("radio::getAvailableNetworksResponse: radioService[%d]->mRadioResponse == NULL", |
| 3568 | slotId); |
| 3569 | } |
| 3570 | |
| 3571 | return 0; |
| 3572 | } |
| 3573 | |
| 3574 | int radio::startDtmfResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3575 | int responseType, int serial, RIL_Errno e, |
| 3576 | void *response, size_t responseLen) { |
| 3577 | RLOGD("radio::startDtmfResponse: serial %d", serial); |
| 3578 | |
| 3579 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3580 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3581 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3582 | Return<void> retStatus |
| 3583 | = radioService[slotId]->mRadioResponse->startDtmfResponse(responseInfo); |
| 3584 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3585 | } else { |
| 3586 | RLOGE("radio::startDtmfResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3587 | } |
| 3588 | |
| 3589 | return 0; |
| 3590 | } |
| 3591 | |
| 3592 | int radio::stopDtmfResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3593 | int responseType, int serial, RIL_Errno e, |
| 3594 | void *response, size_t responseLen) { |
| 3595 | RLOGD("radio::stopDtmfResponse: serial %d", serial); |
| 3596 | |
| 3597 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3598 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3599 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3600 | Return<void> retStatus |
| 3601 | = radioService[slotId]->mRadioResponse->stopDtmfResponse(responseInfo); |
| 3602 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3603 | } else { |
| 3604 | RLOGE("radio::stopDtmfResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3605 | } |
| 3606 | |
| 3607 | return 0; |
| 3608 | } |
| 3609 | |
| 3610 | int radio::getBasebandVersionResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3611 | int responseType, int serial, RIL_Errno e, |
| 3612 | void *response, size_t responseLen) { |
| 3613 | RLOGD("radio::getBasebandVersionResponse: serial %d", serial); |
| 3614 | |
| 3615 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3616 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3617 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3618 | Return<void> retStatus |
| 3619 | = radioService[slotId]->mRadioResponse->getBasebandVersionResponse(responseInfo, |
| 3620 | convertCharPtrToHidlString((char *) response)); |
| 3621 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3622 | } else { |
| 3623 | RLOGE("radio::getBasebandVersionResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3624 | } |
| 3625 | |
| 3626 | return 0; |
| 3627 | } |
| 3628 | |
| 3629 | int radio::separateConnectionResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3630 | int responseType, int serial, RIL_Errno e, |
| 3631 | void *response, size_t responseLen) { |
| 3632 | RLOGD("radio::separateConnectionResponse: serial %d", serial); |
| 3633 | |
| 3634 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3635 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3636 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3637 | Return<void> retStatus |
| 3638 | = radioService[slotId]->mRadioResponse->separateConnectionResponse(responseInfo); |
| 3639 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3640 | } else { |
| 3641 | RLOGE("radio::separateConnectionResponse: radioService[%d]->mRadioResponse == NULL", |
| 3642 | slotId); |
| 3643 | } |
| 3644 | |
| 3645 | return 0; |
| 3646 | } |
| 3647 | |
| 3648 | int radio::setMuteResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3649 | int responseType, int serial, RIL_Errno e, |
| 3650 | void *response, size_t responseLen) { |
| 3651 | RLOGD("radio::setMuteResponse: serial %d", serial); |
| 3652 | |
| 3653 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3654 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3655 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3656 | Return<void> retStatus |
| 3657 | = radioService[slotId]->mRadioResponse->setMuteResponse(responseInfo); |
| 3658 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3659 | } else { |
| 3660 | RLOGE("radio::setMuteResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3661 | } |
| 3662 | |
| 3663 | return 0; |
| 3664 | } |
| 3665 | |
| 3666 | int radio::getMuteResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3667 | int responseType, int serial, RIL_Errno e, void *response, |
| 3668 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3669 | RLOGD("radio::getMuteResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3670 | |
| 3671 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3672 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3673 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3674 | bool enable = false; |
| 3675 | int serviceClass; |
| 3676 | if (response == NULL || responseLen != sizeof(int)) { |
| 3677 | RLOGE("radio::getMuteResponse Invalid response: NULL"); |
| 3678 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3679 | } else { |
| 3680 | int *pInt = (int *) response; |
| 3681 | enable = pInt[0] == 1 ? true : false; |
| 3682 | } |
| 3683 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getMuteResponse(responseInfo, |
| 3684 | enable); |
| 3685 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3686 | } else { |
| 3687 | RLOGE("radio::getMuteResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3688 | } |
| 3689 | |
| 3690 | return 0; |
| 3691 | } |
| 3692 | |
| 3693 | int radio::getClipResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3694 | int responseType, int serial, RIL_Errno e, |
| 3695 | void *response, size_t responseLen) { |
| 3696 | RLOGD("radio::getClipResponse: serial %d", serial); |
| 3697 | |
| 3698 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3699 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3700 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 3701 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getClipResponse(responseInfo, |
| 3702 | (ClipStatus) ret); |
| 3703 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3704 | } else { |
| 3705 | RLOGE("radio::getClipResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3706 | } |
| 3707 | |
| 3708 | return 0; |
| 3709 | } |
| 3710 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3711 | int radio::getDataCallListResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3712 | int responseType, int serial, RIL_Errno e, |
| 3713 | void *response, size_t responseLen) { |
| 3714 | RLOGD("radio::getDataCallListResponse: serial %d", serial); |
| 3715 | |
| 3716 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3717 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3718 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3719 | |
| 3720 | hidl_vec<SetupDataCallResult> ret; |
| 3721 | if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { |
| 3722 | RLOGE("radio::getDataCallListResponse: invalid response"); |
| 3723 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3724 | } else { |
| 3725 | convertRilDataCallListToHal(response, responseLen, ret); |
| 3726 | } |
| 3727 | |
| 3728 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getDataCallListResponse( |
| 3729 | responseInfo, ret); |
| 3730 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3731 | } else { |
| 3732 | RLOGE("radio::getDataCallListResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3733 | } |
| 3734 | |
| 3735 | return 0; |
| 3736 | } |
| 3737 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3738 | int radio::sendScreenStateResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3739 | int responseType, int serial, RIL_Errno e, |
| 3740 | void *response, size_t responseLen) { |
| 3741 | RLOGD("radio::sendScreenStateResponse: serial %d", serial); |
| 3742 | |
| 3743 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3744 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3745 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3746 | Return<void> retStatus |
| 3747 | = radioService[slotId]->mRadioResponse->sendScreenStateResponse(responseInfo); |
| 3748 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3749 | } else { |
| 3750 | RLOGE("radio::sendScreenStateResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3751 | } |
| 3752 | |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
| 3756 | int radio::setSuppServiceNotificationsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3757 | int responseType, int serial, RIL_Errno e, |
| 3758 | void *response, size_t responseLen) { |
| 3759 | RLOGD("radio::setSuppServiceNotificationsResponse: serial %d", serial); |
| 3760 | |
| 3761 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3762 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3763 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3764 | Return<void> retStatus |
| 3765 | = radioService[slotId]->mRadioResponse->setSuppServiceNotificationsResponse( |
| 3766 | responseInfo); |
| 3767 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3768 | } else { |
| 3769 | RLOGE("radio::setSuppServiceNotificationsResponse: radioService[%d]->mRadioResponse " |
| 3770 | "== NULL", slotId); |
| 3771 | } |
| 3772 | |
| 3773 | return 0; |
| 3774 | } |
| 3775 | |
| 3776 | int radio::deleteSmsOnSimResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3777 | int responseType, int serial, RIL_Errno e, |
| 3778 | void *response, size_t responseLen) { |
| 3779 | RLOGD("radio::deleteSmsOnSimResponse: serial %d", serial); |
| 3780 | |
| 3781 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3782 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3783 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3784 | Return<void> retStatus |
| 3785 | = radioService[slotId]->mRadioResponse->deleteSmsOnSimResponse(responseInfo); |
| 3786 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3787 | } else { |
| 3788 | RLOGE("radio::deleteSmsOnSimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3789 | } |
| 3790 | |
| 3791 | return 0; |
| 3792 | } |
| 3793 | |
| 3794 | int radio::setBandModeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3795 | int responseType, int serial, RIL_Errno e, |
| 3796 | void *response, size_t responseLen) { |
| 3797 | RLOGD("radio::setBandModeResponse: serial %d", serial); |
| 3798 | |
| 3799 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3800 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3801 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3802 | Return<void> retStatus |
| 3803 | = radioService[slotId]->mRadioResponse->setBandModeResponse(responseInfo); |
| 3804 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3805 | } else { |
| 3806 | RLOGE("radio::setBandModeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3807 | } |
| 3808 | |
| 3809 | return 0; |
| 3810 | } |
| 3811 | |
| 3812 | int radio::writeSmsToSimResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3813 | int responseType, int serial, RIL_Errno e, |
| 3814 | void *response, size_t responseLen) { |
| 3815 | RLOGD("radio::writeSmsToSimResponse: serial %d", serial); |
| 3816 | |
| 3817 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3818 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3819 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 3820 | Return<void> retStatus |
| 3821 | = radioService[slotId]->mRadioResponse->writeSmsToSimResponse(responseInfo, ret); |
| 3822 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3823 | } else { |
| 3824 | RLOGE("radio::writeSmsToSimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3825 | } |
| 3826 | |
| 3827 | return 0; |
| 3828 | } |
| 3829 | |
| 3830 | int radio::getAvailableBandModesResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3831 | int responseType, int serial, RIL_Errno e, void *response, |
| 3832 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3833 | RLOGD("radio::getAvailableBandModesResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3834 | |
| 3835 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3836 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3837 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3838 | hidl_vec<RadioBandMode> modes; |
| 3839 | if (response == NULL || responseLen % sizeof(int) != 0) { |
| 3840 | RLOGE("radio::getAvailableBandModesResponse Invalid response: NULL"); |
| 3841 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3842 | } else { |
| 3843 | int *pInt = (int *) response; |
| 3844 | int numInts = responseLen / sizeof(int); |
| 3845 | modes.resize(numInts); |
| 3846 | for (int i = 0; i < numInts; i++) { |
| 3847 | modes[i] = (RadioBandMode) pInt[i]; |
| 3848 | } |
| 3849 | } |
| 3850 | Return<void> retStatus |
| 3851 | = radioService[slotId]->mRadioResponse->getAvailableBandModesResponse(responseInfo, |
| 3852 | modes); |
| 3853 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3854 | } else { |
| 3855 | RLOGE("radio::getAvailableBandModesResponse: radioService[%d]->mRadioResponse == NULL", |
| 3856 | slotId); |
| 3857 | } |
| 3858 | |
| 3859 | return 0; |
| 3860 | } |
| 3861 | |
| 3862 | int radio::sendEnvelopeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3863 | int responseType, int serial, RIL_Errno e, |
| 3864 | void *response, size_t responseLen) { |
| 3865 | RLOGD("radio::sendEnvelopeResponse: serial %d", serial); |
| 3866 | |
| 3867 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3868 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3869 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3870 | Return<void> retStatus |
| 3871 | = radioService[slotId]->mRadioResponse->sendEnvelopeResponse(responseInfo, |
| 3872 | convertCharPtrToHidlString((char *) response)); |
| 3873 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3874 | } else { |
| 3875 | RLOGE("radio::sendEnvelopeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 3876 | } |
| 3877 | |
| 3878 | return 0; |
| 3879 | } |
| 3880 | |
| 3881 | int radio::sendTerminalResponseToSimResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3882 | int responseType, int serial, RIL_Errno e, |
| 3883 | void *response, size_t responseLen) { |
| 3884 | RLOGD("radio::sendTerminalResponseToSimResponse: serial %d", serial); |
| 3885 | |
| 3886 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3887 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3888 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3889 | Return<void> retStatus |
| 3890 | = radioService[slotId]->mRadioResponse->sendTerminalResponseToSimResponse( |
| 3891 | responseInfo); |
| 3892 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3893 | } else { |
| 3894 | RLOGE("radio::sendTerminalResponseToSimResponse: radioService[%d]->mRadioResponse == NULL", |
| 3895 | slotId); |
| 3896 | } |
| 3897 | |
| 3898 | return 0; |
| 3899 | } |
| 3900 | |
| 3901 | int radio::handleStkCallSetupRequestFromSimResponse(android::Parcel &p, int slotId, |
| 3902 | int requestNumber, int responseType, int serial, |
| 3903 | RIL_Errno e, void *response, |
| 3904 | size_t responseLen) { |
| 3905 | RLOGD("radio::handleStkCallSetupRequestFromSimResponse: serial %d", serial); |
| 3906 | |
| 3907 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3908 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3909 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3910 | Return<void> retStatus |
| 3911 | = radioService[slotId]->mRadioResponse->handleStkCallSetupRequestFromSimResponse( |
| 3912 | responseInfo); |
| 3913 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3914 | } else { |
| 3915 | RLOGE("radio::handleStkCallSetupRequestFromSimResponse: radioService[%d]->mRadioResponse " |
| 3916 | "== NULL", slotId); |
| 3917 | } |
| 3918 | |
| 3919 | return 0; |
| 3920 | } |
| 3921 | |
| 3922 | int radio::explicitCallTransferResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3923 | int responseType, int serial, RIL_Errno e, |
| 3924 | void *response, size_t responseLen) { |
| 3925 | RLOGD("radio::explicitCallTransferResponse: serial %d", serial); |
| 3926 | |
| 3927 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3928 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3929 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3930 | Return<void> retStatus |
| 3931 | = radioService[slotId]->mRadioResponse->explicitCallTransferResponse(responseInfo); |
| 3932 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3933 | } else { |
| 3934 | RLOGE("radio::explicitCallTransferResponse: radioService[%d]->mRadioResponse == NULL", |
| 3935 | slotId); |
| 3936 | } |
| 3937 | |
| 3938 | return 0; |
| 3939 | } |
| 3940 | |
| 3941 | int radio::setPreferredNetworkTypeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3942 | int responseType, int serial, RIL_Errno e, |
| 3943 | void *response, size_t responseLen) { |
| 3944 | RLOGD("radio::setPreferredNetworkTypeResponse: serial %d", serial); |
| 3945 | |
| 3946 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3947 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3948 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3949 | Return<void> retStatus |
| 3950 | = radioService[slotId]->mRadioResponse->setPreferredNetworkTypeResponse( |
| 3951 | responseInfo); |
| 3952 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3953 | } else { |
| 3954 | RLOGE("radio::setPreferredNetworkTypeResponse: radioService[%d]->mRadioResponse == NULL", |
| 3955 | slotId); |
| 3956 | } |
| 3957 | |
| 3958 | return 0; |
| 3959 | } |
| 3960 | |
| 3961 | |
| 3962 | int radio::getPreferredNetworkTypeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3963 | int responseType, int serial, RIL_Errno e, |
| 3964 | void *response, size_t responseLen) { |
| 3965 | RLOGD("radio::getPreferredNetworkTypeResponse: serial %d", serial); |
| 3966 | |
| 3967 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3968 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3969 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 3970 | Return<void> retStatus |
| 3971 | = radioService[slotId]->mRadioResponse->getPreferredNetworkTypeResponse( |
| 3972 | responseInfo, (PreferredNetworkType) ret); |
| 3973 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3974 | } else { |
| 3975 | RLOGE("radio::getPreferredNetworkTypeResponse: radioService[%d]->mRadioResponse == NULL", |
| 3976 | slotId); |
| 3977 | } |
| 3978 | |
| 3979 | return 0; |
| 3980 | } |
| 3981 | |
| 3982 | int radio::getNeighboringCidsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 3983 | int responseType, int serial, RIL_Errno e, |
| 3984 | void *response, size_t responseLen) { |
| 3985 | RLOGD("radio::getNeighboringCidsResponse: serial %d", serial); |
| 3986 | |
| 3987 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3988 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3989 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3990 | hidl_vec<NeighboringCell> cells; |
| 3991 | |
| 3992 | if (response == NULL || responseLen % sizeof(RIL_NeighboringCell *) != 0) { |
| 3993 | RLOGE("radio::getNeighboringCidsResponse Invalid response: NULL"); |
| 3994 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3995 | } else { |
| 3996 | int num = responseLen / sizeof(RIL_NeighboringCell *); |
| 3997 | cells.resize(num); |
| 3998 | for (int i = 0 ; i < num; i++) { |
| 3999 | RIL_NeighboringCell *resp = ((RIL_NeighboringCell **) response)[i]; |
| 4000 | cells[i].cid = convertCharPtrToHidlString(resp->cid); |
| 4001 | cells[i].rssi = resp->rssi; |
| 4002 | } |
| 4003 | } |
| 4004 | |
| 4005 | Return<void> retStatus |
| 4006 | = radioService[slotId]->mRadioResponse->getNeighboringCidsResponse(responseInfo, |
| 4007 | cells); |
| 4008 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4009 | } else { |
| 4010 | RLOGE("radio::getNeighboringCidsResponse: radioService[%d]->mRadioResponse == NULL", |
| 4011 | slotId); |
| 4012 | } |
| 4013 | |
| 4014 | return 0; |
| 4015 | } |
| 4016 | |
| 4017 | int radio::setLocationUpdatesResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4018 | int responseType, int serial, RIL_Errno e, |
| 4019 | void *response, size_t responseLen) { |
| 4020 | RLOGD("radio::setLocationUpdatesResponse: serial %d", serial); |
| 4021 | |
| 4022 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4023 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4024 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4025 | Return<void> retStatus |
| 4026 | = radioService[slotId]->mRadioResponse->setLocationUpdatesResponse(responseInfo); |
| 4027 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4028 | } else { |
| 4029 | RLOGE("radio::setLocationUpdatesResponse: radioService[%d]->mRadioResponse == NULL", |
| 4030 | slotId); |
| 4031 | } |
| 4032 | |
| 4033 | return 0; |
| 4034 | } |
| 4035 | |
| 4036 | int radio::setCdmaSubscriptionSourceResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4037 | int responseType, int serial, RIL_Errno e, |
| 4038 | void *response, size_t responseLen) { |
| 4039 | RLOGD("radio::setCdmaSubscriptionSourceResponse: serial %d", serial); |
| 4040 | |
| 4041 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4042 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4043 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4044 | Return<void> retStatus |
| 4045 | = radioService[slotId]->mRadioResponse->setCdmaSubscriptionSourceResponse( |
| 4046 | responseInfo); |
| 4047 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4048 | } else { |
| 4049 | RLOGE("radio::setCdmaSubscriptionSourceResponse: radioService[%d]->mRadioResponse == NULL", |
| 4050 | slotId); |
| 4051 | } |
| 4052 | |
| 4053 | return 0; |
| 4054 | } |
| 4055 | |
| 4056 | int radio::setCdmaRoamingPreferenceResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4057 | int responseType, int serial, RIL_Errno e, |
| 4058 | void *response, size_t responseLen) { |
| 4059 | RLOGD("radio::setCdmaRoamingPreferenceResponse: serial %d", serial); |
| 4060 | |
| 4061 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4062 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4063 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4064 | Return<void> retStatus |
| 4065 | = radioService[slotId]->mRadioResponse->setCdmaRoamingPreferenceResponse( |
| 4066 | responseInfo); |
| 4067 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4068 | } else { |
| 4069 | RLOGE("radio::setCdmaRoamingPreferenceResponse: radioService[%d]->mRadioResponse == NULL", |
| 4070 | slotId); |
| 4071 | } |
| 4072 | |
| 4073 | return 0; |
| 4074 | } |
| 4075 | |
| 4076 | int radio::getCdmaRoamingPreferenceResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4077 | int responseType, int serial, RIL_Errno e, |
| 4078 | void *response, size_t responseLen) { |
| 4079 | RLOGD("radio::getCdmaRoamingPreferenceResponse: serial %d", serial); |
| 4080 | |
| 4081 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4082 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4083 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4084 | Return<void> retStatus |
| 4085 | = radioService[slotId]->mRadioResponse->getCdmaRoamingPreferenceResponse( |
| 4086 | responseInfo, (CdmaRoamingType) ret); |
| 4087 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4088 | } else { |
| 4089 | RLOGE("radio::getCdmaRoamingPreferenceResponse: radioService[%d]->mRadioResponse == NULL", |
| 4090 | slotId); |
| 4091 | } |
| 4092 | |
| 4093 | return 0; |
| 4094 | } |
| 4095 | |
| 4096 | int radio::setTTYModeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4097 | int responseType, int serial, RIL_Errno e, |
| 4098 | void *response, size_t responseLen) { |
| 4099 | RLOGD("radio::setTTYModeResponse: serial %d", serial); |
| 4100 | |
| 4101 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4102 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4103 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4104 | Return<void> retStatus |
| 4105 | = radioService[slotId]->mRadioResponse->setTTYModeResponse(responseInfo); |
| 4106 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4107 | } else { |
| 4108 | RLOGE("radio::setTTYModeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4109 | } |
| 4110 | |
| 4111 | return 0; |
| 4112 | } |
| 4113 | |
| 4114 | int radio::getTTYModeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4115 | int responseType, int serial, RIL_Errno e, |
| 4116 | void *response, size_t responseLen) { |
| 4117 | RLOGD("radio::getTTYModeResponse: serial %d", serial); |
| 4118 | |
| 4119 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4120 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4121 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4122 | Return<void> retStatus |
| 4123 | = radioService[slotId]->mRadioResponse->getTTYModeResponse(responseInfo, |
| 4124 | (TtyMode) ret); |
| 4125 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4126 | } else { |
| 4127 | RLOGE("radio::getTTYModeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4128 | } |
| 4129 | |
| 4130 | return 0; |
| 4131 | } |
| 4132 | |
| 4133 | int radio::setPreferredVoicePrivacyResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4134 | int responseType, int serial, RIL_Errno e, |
| 4135 | void *response, size_t responseLen) { |
| 4136 | RLOGD("radio::setPreferredVoicePrivacyResponse: serial %d", serial); |
| 4137 | |
| 4138 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4139 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4140 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4141 | Return<void> retStatus |
| 4142 | = radioService[slotId]->mRadioResponse->setPreferredVoicePrivacyResponse( |
| 4143 | responseInfo); |
| 4144 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4145 | } else { |
| 4146 | RLOGE("radio::setPreferredVoicePrivacyResponse: radioService[%d]->mRadioResponse == NULL", |
| 4147 | slotId); |
| 4148 | } |
| 4149 | |
| 4150 | return 0; |
| 4151 | } |
| 4152 | |
| 4153 | int radio::getPreferredVoicePrivacyResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4154 | int responseType, int serial, RIL_Errno e, |
| 4155 | void *response, size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4156 | RLOGD("radio::getPreferredVoicePrivacyResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4157 | |
| 4158 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4159 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4160 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4161 | bool enable = false; |
| 4162 | int numInts = responseLen / sizeof(int); |
| 4163 | if (response == NULL || numInts != 1) { |
| 4164 | RLOGE("radio::getPreferredVoicePrivacyResponse Invalid response: NULL"); |
| 4165 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4166 | } else { |
| 4167 | int *pInt = (int *) response; |
| 4168 | enable = pInt[0] == 1 ? true : false; |
| 4169 | } |
| 4170 | Return<void> retStatus |
| 4171 | = radioService[slotId]->mRadioResponse->getPreferredVoicePrivacyResponse( |
| 4172 | responseInfo, enable); |
| 4173 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4174 | } else { |
| 4175 | RLOGE("radio::getPreferredVoicePrivacyResponse: radioService[%d]->mRadioResponse == NULL", |
| 4176 | slotId); |
| 4177 | } |
| 4178 | |
| 4179 | return 0; |
| 4180 | } |
| 4181 | |
| 4182 | int radio::sendCDMAFeatureCodeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4183 | int responseType, int serial, RIL_Errno e, |
| 4184 | void *response, size_t responseLen) { |
| 4185 | RLOGD("radio::sendCDMAFeatureCodeResponse: serial %d", serial); |
| 4186 | |
| 4187 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4188 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4189 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4190 | Return<void> retStatus |
| 4191 | = radioService[slotId]->mRadioResponse->sendCDMAFeatureCodeResponse(responseInfo); |
| 4192 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4193 | } else { |
| 4194 | RLOGE("radio::sendCDMAFeatureCodeResponse: radioService[%d]->mRadioResponse == NULL", |
| 4195 | slotId); |
| 4196 | } |
| 4197 | |
| 4198 | return 0; |
| 4199 | } |
| 4200 | |
| 4201 | int radio::sendBurstDtmfResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4202 | int responseType, int serial, RIL_Errno e, |
| 4203 | void *response, size_t responseLen) { |
| 4204 | RLOGD("radio::sendBurstDtmfResponse: serial %d", serial); |
| 4205 | |
| 4206 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4207 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4208 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4209 | Return<void> retStatus |
| 4210 | = radioService[slotId]->mRadioResponse->sendBurstDtmfResponse(responseInfo); |
| 4211 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4212 | } else { |
| 4213 | RLOGE("radio::sendBurstDtmfResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4214 | } |
| 4215 | |
| 4216 | return 0; |
| 4217 | } |
| 4218 | |
| 4219 | int radio::sendCdmaSmsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4220 | int responseType, int serial, RIL_Errno e, void *response, |
| 4221 | size_t responseLen) { |
| 4222 | RLOGD("radio::sendCdmaSmsResponse: serial %d", serial); |
| 4223 | |
| 4224 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4225 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4226 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 4227 | responseLen); |
| 4228 | |
| 4229 | Return<void> retStatus |
| 4230 | = radioService[slotId]->mRadioResponse->sendCdmaSmsResponse(responseInfo, result); |
| 4231 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4232 | } else { |
| 4233 | RLOGE("radio::sendCdmaSmsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4234 | } |
| 4235 | |
| 4236 | return 0; |
| 4237 | } |
| 4238 | |
| 4239 | int radio::acknowledgeLastIncomingCdmaSmsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4240 | int responseType, int serial, RIL_Errno e, |
| 4241 | void *response, size_t responseLen) { |
| 4242 | RLOGD("radio::acknowledgeLastIncomingCdmaSmsResponse: serial %d", serial); |
| 4243 | |
| 4244 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4245 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4246 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4247 | Return<void> retStatus |
| 4248 | = radioService[slotId]->mRadioResponse->acknowledgeLastIncomingCdmaSmsResponse( |
| 4249 | responseInfo); |
| 4250 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4251 | } else { |
| 4252 | RLOGE("radio::acknowledgeLastIncomingCdmaSmsResponse: radioService[%d]->mRadioResponse " |
| 4253 | "== NULL", slotId); |
| 4254 | } |
| 4255 | |
| 4256 | return 0; |
| 4257 | } |
| 4258 | |
| 4259 | int radio::getGsmBroadcastConfigResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4260 | int responseType, int serial, RIL_Errno e, |
| 4261 | void *response, size_t responseLen) { |
| 4262 | RLOGD("radio::getGsmBroadcastConfigResponse: serial %d", serial); |
| 4263 | |
| 4264 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4265 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4266 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4267 | hidl_vec<GsmBroadcastSmsConfigInfo> configs; |
| 4268 | |
| 4269 | if (response == NULL || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) { |
| 4270 | RLOGE("radio::getGsmBroadcastConfigResponse Invalid response: NULL"); |
| 4271 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4272 | } else { |
| 4273 | int num = responseLen / sizeof(RIL_GSM_BroadcastSmsConfigInfo *); |
| 4274 | configs.resize(num); |
| 4275 | for (int i = 0 ; i < num; i++) { |
| 4276 | RIL_GSM_BroadcastSmsConfigInfo *resp = |
| 4277 | ((RIL_GSM_BroadcastSmsConfigInfo **) response)[i]; |
| 4278 | configs[i].fromServiceId = resp->fromServiceId; |
| 4279 | configs[i].toServiceId = resp->toServiceId; |
| 4280 | configs[i].fromCodeScheme = resp->fromCodeScheme; |
| 4281 | configs[i].toCodeScheme = resp->toCodeScheme; |
| 4282 | configs[i].selected = resp->selected == 1 ? true : false; |
| 4283 | } |
| 4284 | } |
| 4285 | |
| 4286 | Return<void> retStatus |
| 4287 | = radioService[slotId]->mRadioResponse->getGsmBroadcastConfigResponse(responseInfo, |
| 4288 | configs); |
| 4289 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4290 | } else { |
| 4291 | RLOGE("radio::getGsmBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
| 4292 | slotId); |
| 4293 | } |
| 4294 | |
| 4295 | return 0; |
| 4296 | } |
| 4297 | |
| 4298 | int radio::setGsmBroadcastConfigResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4299 | int responseType, int serial, RIL_Errno e, |
| 4300 | void *response, size_t responseLen) { |
| 4301 | RLOGD("radio::setGsmBroadcastConfigResponse: serial %d", serial); |
| 4302 | |
| 4303 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4304 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4305 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4306 | Return<void> retStatus |
| 4307 | = radioService[slotId]->mRadioResponse->setGsmBroadcastConfigResponse(responseInfo); |
| 4308 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4309 | } else { |
| 4310 | RLOGE("radio::setGsmBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
| 4311 | slotId); |
| 4312 | } |
| 4313 | |
| 4314 | return 0; |
| 4315 | } |
| 4316 | |
| 4317 | int radio::setGsmBroadcastActivationResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4318 | int responseType, int serial, RIL_Errno e, |
| 4319 | void *response, size_t responseLen) { |
| 4320 | RLOGD("radio::setGsmBroadcastActivationResponse: serial %d", serial); |
| 4321 | |
| 4322 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4323 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4324 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4325 | Return<void> retStatus |
| 4326 | = radioService[slotId]->mRadioResponse->setGsmBroadcastActivationResponse( |
| 4327 | responseInfo); |
| 4328 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4329 | } else { |
| 4330 | RLOGE("radio::setGsmBroadcastActivationResponse: radioService[%d]->mRadioResponse == NULL", |
| 4331 | slotId); |
| 4332 | } |
| 4333 | |
| 4334 | return 0; |
| 4335 | } |
| 4336 | |
| 4337 | int radio::getCdmaBroadcastConfigResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4338 | int responseType, int serial, RIL_Errno e, |
| 4339 | void *response, size_t responseLen) { |
| 4340 | RLOGD("radio::getCdmaBroadcastConfigResponse: serial %d", serial); |
| 4341 | |
| 4342 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4343 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4344 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4345 | hidl_vec<CdmaBroadcastSmsConfigInfo> configs; |
| 4346 | |
| 4347 | if (response == NULL || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) { |
| 4348 | RLOGE("radio::getCdmaBroadcastConfigResponse Invalid response: NULL"); |
| 4349 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4350 | } else { |
| 4351 | int num = responseLen / sizeof(RIL_CDMA_BroadcastSmsConfigInfo *); |
| 4352 | configs.resize(num); |
| 4353 | for (int i = 0 ; i < num; i++) { |
| 4354 | RIL_CDMA_BroadcastSmsConfigInfo *resp = |
| 4355 | ((RIL_CDMA_BroadcastSmsConfigInfo **) response)[i]; |
| 4356 | configs[i].serviceCategory = resp->service_category; |
| 4357 | configs[i].language = resp->language; |
| 4358 | configs[i].selected = resp->selected == 1 ? true : false; |
| 4359 | } |
| 4360 | } |
| 4361 | |
| 4362 | Return<void> retStatus |
| 4363 | = radioService[slotId]->mRadioResponse->getCdmaBroadcastConfigResponse(responseInfo, |
| 4364 | configs); |
| 4365 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4366 | } else { |
| 4367 | RLOGE("radio::getCdmaBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
| 4368 | slotId); |
| 4369 | } |
| 4370 | |
| 4371 | return 0; |
| 4372 | } |
| 4373 | |
| 4374 | int radio::setCdmaBroadcastConfigResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4375 | int responseType, int serial, RIL_Errno e, |
| 4376 | void *response, size_t responseLen) { |
| 4377 | RLOGD("radio::setCdmaBroadcastConfigResponse: serial %d", serial); |
| 4378 | |
| 4379 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4380 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4381 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4382 | Return<void> retStatus |
| 4383 | = radioService[slotId]->mRadioResponse->setCdmaBroadcastConfigResponse( |
| 4384 | responseInfo); |
| 4385 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4386 | } else { |
| 4387 | RLOGE("radio::setCdmaBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
| 4388 | slotId); |
| 4389 | } |
| 4390 | |
| 4391 | return 0; |
| 4392 | } |
| 4393 | |
| 4394 | int radio::setCdmaBroadcastActivationResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4395 | int responseType, int serial, RIL_Errno e, |
| 4396 | void *response, size_t responseLen) { |
| 4397 | RLOGD("radio::setCdmaBroadcastActivationResponse: serial %d", serial); |
| 4398 | |
| 4399 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4400 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4401 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4402 | Return<void> retStatus |
| 4403 | = radioService[slotId]->mRadioResponse->setCdmaBroadcastActivationResponse( |
| 4404 | responseInfo); |
| 4405 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4406 | } else { |
| 4407 | RLOGE("radio::setCdmaBroadcastActivationResponse: radioService[%d]->mRadioResponse == NULL", |
| 4408 | slotId); |
| 4409 | } |
| 4410 | |
| 4411 | return 0; |
| 4412 | } |
| 4413 | |
| 4414 | int radio::getCDMASubscriptionResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4415 | int responseType, int serial, RIL_Errno e, void *response, |
| 4416 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4417 | RLOGD("radio::getCDMASubscriptionResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4418 | |
| 4419 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4420 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4421 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4422 | |
| 4423 | int numStrings = responseLen / sizeof(char *); |
| 4424 | hidl_string emptyString; |
| 4425 | if (response == NULL || numStrings != 5) { |
| 4426 | RLOGE("radio::getOperatorResponse Invalid response: NULL"); |
| 4427 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4428 | Return<void> retStatus |
| 4429 | = radioService[slotId]->mRadioResponse->getCDMASubscriptionResponse( |
| 4430 | responseInfo, emptyString, emptyString, emptyString, emptyString, emptyString); |
| 4431 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4432 | } else { |
| 4433 | char **resp = (char **) response; |
| 4434 | Return<void> retStatus |
| 4435 | = radioService[slotId]->mRadioResponse->getCDMASubscriptionResponse( |
| 4436 | responseInfo, |
| 4437 | convertCharPtrToHidlString(resp[0]), |
| 4438 | convertCharPtrToHidlString(resp[1]), |
| 4439 | convertCharPtrToHidlString(resp[2]), |
| 4440 | convertCharPtrToHidlString(resp[3]), |
| 4441 | convertCharPtrToHidlString(resp[4])); |
| 4442 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4443 | } |
| 4444 | } else { |
| 4445 | RLOGE("radio::getCDMASubscriptionResponse: radioService[%d]->mRadioResponse == NULL", |
| 4446 | slotId); |
| 4447 | } |
| 4448 | |
| 4449 | return 0; |
| 4450 | } |
| 4451 | |
| 4452 | int radio::writeSmsToRuimResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4453 | int responseType, int serial, RIL_Errno e, |
| 4454 | void *response, size_t responseLen) { |
| 4455 | RLOGD("radio::writeSmsToRuimResponse: serial %d", serial); |
| 4456 | |
| 4457 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4458 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4459 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4460 | Return<void> retStatus |
| 4461 | = radioService[slotId]->mRadioResponse->writeSmsToRuimResponse(responseInfo, ret); |
| 4462 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4463 | } else { |
| 4464 | RLOGE("radio::writeSmsToRuimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4465 | } |
| 4466 | |
| 4467 | return 0; |
| 4468 | } |
| 4469 | |
| 4470 | int radio::deleteSmsOnRuimResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4471 | int responseType, int serial, RIL_Errno e, |
| 4472 | void *response, size_t responseLen) { |
| 4473 | RLOGD("radio::deleteSmsOnRuimResponse: serial %d", serial); |
| 4474 | |
| 4475 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4476 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4477 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4478 | Return<void> retStatus |
| 4479 | = radioService[slotId]->mRadioResponse->deleteSmsOnRuimResponse(responseInfo); |
| 4480 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4481 | } else { |
| 4482 | RLOGE("radio::deleteSmsOnRuimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4483 | } |
| 4484 | |
| 4485 | return 0; |
| 4486 | } |
| 4487 | |
| 4488 | int radio::getDeviceIdentityResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4489 | int responseType, int serial, RIL_Errno e, void *response, |
| 4490 | size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4491 | RLOGD("radio::getDeviceIdentityResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4492 | |
| 4493 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4494 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4495 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4496 | |
| 4497 | int numStrings = responseLen / sizeof(char *); |
| 4498 | hidl_string emptyString; |
| 4499 | if (response == NULL || numStrings != 4) { |
| 4500 | RLOGE("radio::getDeviceIdentityResponse Invalid response: NULL"); |
| 4501 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4502 | Return<void> retStatus |
| 4503 | = radioService[slotId]->mRadioResponse->getDeviceIdentityResponse(responseInfo, |
| 4504 | emptyString, emptyString, emptyString, emptyString); |
| 4505 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4506 | } else { |
| 4507 | char **resp = (char **) response; |
| 4508 | Return<void> retStatus |
| 4509 | = radioService[slotId]->mRadioResponse->getDeviceIdentityResponse(responseInfo, |
| 4510 | convertCharPtrToHidlString(resp[0]), |
| 4511 | convertCharPtrToHidlString(resp[1]), |
| 4512 | convertCharPtrToHidlString(resp[2]), |
| 4513 | convertCharPtrToHidlString(resp[3])); |
| 4514 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4515 | } |
| 4516 | } else { |
| 4517 | RLOGE("radio::getDeviceIdentityResponse: radioService[%d]->mRadioResponse == NULL", |
| 4518 | slotId); |
| 4519 | } |
| 4520 | |
| 4521 | return 0; |
| 4522 | } |
| 4523 | |
| 4524 | int radio::exitEmergencyCallbackModeResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4525 | int responseType, int serial, RIL_Errno e, |
| 4526 | void *response, size_t responseLen) { |
| 4527 | RLOGD("radio::exitEmergencyCallbackModeResponse: serial %d", serial); |
| 4528 | |
| 4529 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4530 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4531 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4532 | Return<void> retStatus |
| 4533 | = radioService[slotId]->mRadioResponse->exitEmergencyCallbackModeResponse( |
| 4534 | responseInfo); |
| 4535 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4536 | } else { |
| 4537 | RLOGE("radio::exitEmergencyCallbackModeResponse: radioService[%d]->mRadioResponse == NULL", |
| 4538 | slotId); |
| 4539 | } |
| 4540 | |
| 4541 | return 0; |
| 4542 | } |
| 4543 | |
| 4544 | int radio::getSmscAddressResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4545 | int responseType, int serial, RIL_Errno e, |
| 4546 | void *response, size_t responseLen) { |
| 4547 | RLOGD("radio::getSmscAddressResponse: serial %d", serial); |
| 4548 | |
| 4549 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4550 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4551 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4552 | Return<void> retStatus |
| 4553 | = radioService[slotId]->mRadioResponse->getSmscAddressResponse(responseInfo, |
| 4554 | convertCharPtrToHidlString((char *) response)); |
| 4555 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4556 | } else { |
| 4557 | RLOGE("radio::getSmscAddressResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4558 | } |
| 4559 | |
| 4560 | return 0; |
| 4561 | } |
| 4562 | |
| 4563 | int radio::setSmscAddressResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4564 | int responseType, int serial, RIL_Errno e, |
| 4565 | void *response, size_t responseLen) { |
| 4566 | RLOGD("radio::setSmscAddressResponse: serial %d", serial); |
| 4567 | |
| 4568 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4569 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4570 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4571 | Return<void> retStatus |
| 4572 | = radioService[slotId]->mRadioResponse->setSmscAddressResponse(responseInfo); |
| 4573 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4574 | } else { |
| 4575 | RLOGE("radio::setSmscAddressResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4576 | } |
| 4577 | |
| 4578 | return 0; |
| 4579 | } |
| 4580 | |
| 4581 | int radio::reportSmsMemoryStatusResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4582 | int responseType, int serial, RIL_Errno e, |
| 4583 | void *response, size_t responseLen) { |
| 4584 | RLOGD("radio::reportSmsMemoryStatusResponse: serial %d", serial); |
| 4585 | |
| 4586 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4587 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4588 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4589 | Return<void> retStatus |
| 4590 | = radioService[slotId]->mRadioResponse->reportSmsMemoryStatusResponse(responseInfo); |
| 4591 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4592 | } else { |
| 4593 | RLOGE("radio::reportSmsMemoryStatusResponse: radioService[%d]->mRadioResponse == NULL", |
| 4594 | slotId); |
| 4595 | } |
| 4596 | |
| 4597 | return 0; |
| 4598 | } |
| 4599 | |
Amit Mahajan | 5007ffa | 2017-01-31 17:14:42 -0800 | [diff] [blame] | 4600 | int radio::reportStkServiceIsRunningResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4601 | int responseType, int serial, RIL_Errno e, |
| 4602 | void *response, size_t responseLen) { |
| 4603 | RLOGD("radio::reportStkServiceIsRunningResponse: serial %d", serial); |
| 4604 | |
| 4605 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 4606 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 5007ffa | 2017-01-31 17:14:42 -0800 | [diff] [blame] | 4607 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4608 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 4609 | reportStkServiceIsRunningResponse(responseInfo); |
| 4610 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4611 | } else { |
| 4612 | RLOGE("radio::reportStkServiceIsRunningResponse: radioService[%d]->mRadioResponse == NULL", |
| 4613 | slotId); |
| 4614 | } |
| 4615 | |
| 4616 | return 0; |
| 4617 | } |
| 4618 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4619 | int radio::getCdmaSubscriptionSourceResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4620 | int responseType, int serial, RIL_Errno e, |
| 4621 | void *response, size_t responseLen) { |
| 4622 | RLOGD("radio::getCdmaSubscriptionSourceResponse: serial %d", serial); |
| 4623 | |
| 4624 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4625 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4626 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4627 | Return<void> retStatus |
| 4628 | = radioService[slotId]->mRadioResponse->getCdmaSubscriptionSourceResponse( |
| 4629 | responseInfo, (CdmaSubscriptionSource) ret); |
| 4630 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4631 | } else { |
| 4632 | RLOGE("radio::getCdmaSubscriptionSourceResponse: radioService[%d]->mRadioResponse == NULL", |
| 4633 | slotId); |
| 4634 | } |
| 4635 | |
| 4636 | return 0; |
| 4637 | } |
| 4638 | |
| 4639 | int radio::requestIsimAuthenticationResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4640 | int responseType, int serial, RIL_Errno e, |
| 4641 | void *response, size_t responseLen) { |
| 4642 | RLOGD("radio::requestIsimAuthenticationResponse: serial %d", serial); |
| 4643 | |
| 4644 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4645 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4646 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4647 | Return<void> retStatus |
| 4648 | = radioService[slotId]->mRadioResponse->requestIsimAuthenticationResponse( |
| 4649 | responseInfo, |
| 4650 | convertCharPtrToHidlString((char *) response)); |
| 4651 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4652 | } else { |
| 4653 | RLOGE("radio::requestIsimAuthenticationResponse: radioService[%d]->mRadioResponse == NULL", |
| 4654 | slotId); |
| 4655 | } |
| 4656 | |
| 4657 | return 0; |
| 4658 | } |
| 4659 | |
| 4660 | int radio::acknowledgeIncomingGsmSmsWithPduResponse(android::Parcel &p, int slotId, |
| 4661 | int requestNumber, int responseType, |
| 4662 | int serial, RIL_Errno e, void *response, |
| 4663 | size_t responseLen) { |
| 4664 | RLOGD("radio::acknowledgeIncomingGsmSmsWithPduResponse: serial %d", serial); |
| 4665 | |
| 4666 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4667 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4668 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4669 | Return<void> retStatus |
| 4670 | = radioService[slotId]->mRadioResponse->acknowledgeIncomingGsmSmsWithPduResponse( |
| 4671 | responseInfo); |
| 4672 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4673 | } else { |
| 4674 | RLOGE("radio::acknowledgeIncomingGsmSmsWithPduResponse: radioService[%d]->mRadioResponse " |
| 4675 | "== NULL", slotId); |
| 4676 | } |
| 4677 | |
| 4678 | return 0; |
| 4679 | } |
| 4680 | |
| 4681 | int radio::sendEnvelopeWithStatusResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4682 | int responseType, int serial, RIL_Errno e, void *response, |
| 4683 | size_t responseLen) { |
| 4684 | RLOGD("radio::sendEnvelopeWithStatusResponse: serial %d", serial); |
| 4685 | |
| 4686 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4687 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4688 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, |
| 4689 | response, responseLen); |
| 4690 | |
| 4691 | Return<void> retStatus |
| 4692 | = radioService[slotId]->mRadioResponse->sendEnvelopeWithStatusResponse(responseInfo, |
| 4693 | result); |
| 4694 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4695 | } else { |
| 4696 | RLOGE("radio::sendEnvelopeWithStatusResponse: radioService[%d]->mRadioResponse == NULL", |
| 4697 | slotId); |
| 4698 | } |
| 4699 | |
| 4700 | return 0; |
| 4701 | } |
| 4702 | |
| 4703 | int radio::getVoiceRadioTechnologyResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4704 | int responseType, int serial, RIL_Errno e, |
| 4705 | void *response, size_t responseLen) { |
| 4706 | RLOGD("radio::getVoiceRadioTechnologyResponse: serial %d", serial); |
| 4707 | |
| 4708 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4709 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4710 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4711 | Return<void> retStatus |
| 4712 | = radioService[slotId]->mRadioResponse->getVoiceRadioTechnologyResponse( |
| 4713 | responseInfo, (RadioTechnology) ret); |
| 4714 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4715 | } else { |
| 4716 | RLOGE("radio::getVoiceRadioTechnologyResponse: radioService[%d]->mRadioResponse == NULL", |
| 4717 | slotId); |
| 4718 | } |
| 4719 | |
| 4720 | return 0; |
| 4721 | } |
| 4722 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4723 | int radio::getCellInfoListResponse(android::Parcel &p, int slotId, |
| 4724 | int requestNumber, int responseType, |
| 4725 | int serial, RIL_Errno e, void *response, |
| 4726 | size_t responseLen) { |
| 4727 | RLOGD("radio::getCellInfoListResponse: serial %d", serial); |
| 4728 | |
| 4729 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 4730 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4731 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4732 | |
| 4733 | hidl_vec<CellInfo> ret; |
| 4734 | if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { |
| 4735 | RLOGE("radio::getCellInfoListResponse: Invalid response"); |
| 4736 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4737 | } else { |
| 4738 | convertRilCellInfoListToHal(response, responseLen, ret); |
| 4739 | } |
| 4740 | |
| 4741 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getCellInfoListResponse( |
| 4742 | responseInfo, ret); |
| 4743 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4744 | } else { |
| 4745 | RLOGE("radio::getCellInfoListResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4746 | } |
| 4747 | |
| 4748 | return 0; |
| 4749 | } |
| 4750 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4751 | int radio::setCellInfoListRateResponse(android::Parcel &p, int slotId, |
| 4752 | int requestNumber, int responseType, |
| 4753 | int serial, RIL_Errno e, void *response, |
| 4754 | size_t responseLen) { |
| 4755 | RLOGD("radio::setCellInfoListRateResponse: serial %d", serial); |
| 4756 | |
| 4757 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4758 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4759 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4760 | Return<void> retStatus |
| 4761 | = radioService[slotId]->mRadioResponse->setCellInfoListRateResponse(responseInfo); |
| 4762 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4763 | } else { |
| 4764 | RLOGE("radio::setCellInfoListRateResponse: radioService[%d]->mRadioResponse == NULL", |
| 4765 | slotId); |
| 4766 | } |
| 4767 | |
| 4768 | return 0; |
| 4769 | } |
| 4770 | |
| 4771 | int radio::setInitialAttachApnResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4772 | int responseType, int serial, RIL_Errno e, |
| 4773 | void *response, size_t responseLen) { |
| 4774 | RLOGD("radio::setInitialAttachApnResponse: serial %d", serial); |
| 4775 | |
| 4776 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4777 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4778 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4779 | Return<void> retStatus |
| 4780 | = radioService[slotId]->mRadioResponse->setInitialAttachApnResponse(responseInfo); |
| 4781 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4782 | } else { |
| 4783 | RLOGE("radio::setInitialAttachApnResponse: radioService[%d]->mRadioResponse == NULL", |
| 4784 | slotId); |
| 4785 | } |
| 4786 | |
| 4787 | return 0; |
| 4788 | } |
| 4789 | |
| 4790 | int radio::getImsRegistrationStateResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4791 | int responseType, int serial, RIL_Errno e, |
| 4792 | void *response, size_t responseLen) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4793 | RLOGD("radio::getImsRegistrationStateResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4794 | |
| 4795 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4796 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4797 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4798 | bool isRegistered = false; |
| 4799 | int ratFamily = 0; |
| 4800 | int numInts = responseLen / sizeof(int); |
| 4801 | if (response == NULL || numInts != 2) { |
| 4802 | RLOGE("radio::getImsRegistrationStateResponse Invalid response: NULL"); |
| 4803 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4804 | } else { |
| 4805 | int *pInt = (int *) response; |
| 4806 | isRegistered = pInt[0] == 1 ? true : false; |
| 4807 | ratFamily = pInt[1]; |
| 4808 | } |
| 4809 | Return<void> retStatus |
| 4810 | = radioService[slotId]->mRadioResponse->getImsRegistrationStateResponse( |
| 4811 | responseInfo, isRegistered, (RadioTechnologyFamily) ratFamily); |
| 4812 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4813 | } else { |
| 4814 | RLOGE("radio::getImsRegistrationStateResponse: radioService[%d]->mRadioResponse == NULL", |
| 4815 | slotId); |
| 4816 | } |
| 4817 | |
| 4818 | return 0; |
| 4819 | } |
| 4820 | |
| 4821 | int radio::sendImsSmsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4822 | int responseType, int serial, RIL_Errno e, void *response, |
| 4823 | size_t responseLen) { |
| 4824 | RLOGD("radio::sendImsSmsResponse: serial %d", serial); |
| 4825 | |
| 4826 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4827 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4828 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 4829 | responseLen); |
| 4830 | |
| 4831 | Return<void> retStatus |
| 4832 | = radioService[slotId]->mRadioResponse->sendImsSmsResponse(responseInfo, result); |
| 4833 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4834 | } else { |
| 4835 | RLOGE("radio::sendSmsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4836 | } |
| 4837 | |
| 4838 | return 0; |
| 4839 | } |
| 4840 | |
| 4841 | int radio::iccTransmitApduBasicChannelResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4842 | int responseType, int serial, RIL_Errno e, |
| 4843 | void *response, size_t responseLen) { |
| 4844 | RLOGD("radio::iccTransmitApduBasicChannelResponse: serial %d", serial); |
| 4845 | |
| 4846 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4847 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4848 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 4849 | responseLen); |
| 4850 | |
| 4851 | Return<void> retStatus |
| 4852 | = radioService[slotId]->mRadioResponse->iccTransmitApduBasicChannelResponse( |
| 4853 | responseInfo, result); |
| 4854 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4855 | } else { |
| 4856 | RLOGE("radio::iccTransmitApduBasicChannelResponse: radioService[%d]->mRadioResponse " |
| 4857 | "== NULL", slotId); |
| 4858 | } |
| 4859 | |
| 4860 | return 0; |
| 4861 | } |
| 4862 | |
| 4863 | int radio::iccOpenLogicalChannelResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4864 | int responseType, int serial, RIL_Errno e, void *response, |
| 4865 | size_t responseLen) { |
| 4866 | RLOGD("radio::iccOpenLogicalChannelResponse: serial %d", serial); |
| 4867 | |
| 4868 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4869 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4870 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4871 | int channelId = -1; |
| 4872 | hidl_vec<int8_t> selectResponse; |
| 4873 | int numInts = responseLen / sizeof(int); |
| 4874 | if (response == NULL || responseLen % sizeof(int) != 0) { |
| 4875 | RLOGE("radio::iccOpenLogicalChannelResponse Invalid response: NULL"); |
| 4876 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4877 | } else { |
| 4878 | int *pInt = (int *) response; |
| 4879 | channelId = pInt[0]; |
| 4880 | selectResponse.resize(numInts - 1); |
| 4881 | for (int i = 1; i < numInts; i++) { |
| 4882 | selectResponse[i - 1] = (int8_t) pInt[i]; |
| 4883 | } |
| 4884 | } |
| 4885 | Return<void> retStatus |
| 4886 | = radioService[slotId]->mRadioResponse->iccOpenLogicalChannelResponse(responseInfo, |
| 4887 | channelId, selectResponse); |
| 4888 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4889 | } else { |
| 4890 | RLOGE("radio::iccOpenLogicalChannelResponse: radioService[%d]->mRadioResponse == NULL", |
| 4891 | slotId); |
| 4892 | } |
| 4893 | |
| 4894 | return 0; |
| 4895 | } |
| 4896 | |
| 4897 | int radio::iccCloseLogicalChannelResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4898 | int responseType, int serial, RIL_Errno e, |
| 4899 | void *response, size_t responseLen) { |
| 4900 | RLOGD("radio::iccCloseLogicalChannelResponse: serial %d", serial); |
| 4901 | |
| 4902 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4903 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4904 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4905 | Return<void> retStatus |
| 4906 | = radioService[slotId]->mRadioResponse->iccCloseLogicalChannelResponse( |
| 4907 | responseInfo); |
| 4908 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4909 | } else { |
| 4910 | RLOGE("radio::iccCloseLogicalChannelResponse: radioService[%d]->mRadioResponse == NULL", |
| 4911 | slotId); |
| 4912 | } |
| 4913 | |
| 4914 | return 0; |
| 4915 | } |
| 4916 | |
| 4917 | int radio::iccTransmitApduLogicalChannelResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4918 | int responseType, int serial, RIL_Errno e, |
| 4919 | void *response, size_t responseLen) { |
| 4920 | RLOGD("radio::iccTransmitApduLogicalChannelResponse: serial %d", serial); |
| 4921 | |
| 4922 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4923 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4924 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 4925 | responseLen); |
| 4926 | |
| 4927 | Return<void> retStatus |
| 4928 | = radioService[slotId]->mRadioResponse->iccTransmitApduLogicalChannelResponse( |
| 4929 | responseInfo, result); |
| 4930 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4931 | } else { |
| 4932 | RLOGE("radio::iccTransmitApduLogicalChannelResponse: radioService[%d]->mRadioResponse " |
| 4933 | "== NULL", slotId); |
| 4934 | } |
| 4935 | |
| 4936 | return 0; |
| 4937 | } |
| 4938 | |
| 4939 | int radio::nvReadItemResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4940 | int responseType, int serial, RIL_Errno e, |
| 4941 | void *response, size_t responseLen) { |
| 4942 | RLOGD("radio::nvReadItemResponse: serial %d", serial); |
| 4943 | |
| 4944 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4945 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4946 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4947 | Return<void> retStatus = radioService[slotId]->mRadioResponse->nvReadItemResponse( |
| 4948 | responseInfo, |
| 4949 | convertCharPtrToHidlString((char *) response)); |
| 4950 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4951 | } else { |
| 4952 | RLOGE("radio::nvReadItemResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4953 | } |
| 4954 | |
| 4955 | return 0; |
| 4956 | } |
| 4957 | |
| 4958 | int radio::nvWriteItemResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4959 | int responseType, int serial, RIL_Errno e, |
| 4960 | void *response, size_t responseLen) { |
| 4961 | RLOGD("radio::nvWriteItemResponse: serial %d", serial); |
| 4962 | |
| 4963 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4964 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4965 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4966 | Return<void> retStatus |
| 4967 | = radioService[slotId]->mRadioResponse->nvWriteItemResponse(responseInfo); |
| 4968 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4969 | } else { |
| 4970 | RLOGE("radio::nvWriteItemResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4971 | } |
| 4972 | |
| 4973 | return 0; |
| 4974 | } |
| 4975 | |
| 4976 | int radio::nvWriteCdmaPrlResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4977 | int responseType, int serial, RIL_Errno e, |
| 4978 | void *response, size_t responseLen) { |
| 4979 | RLOGD("radio::nvWriteCdmaPrlResponse: serial %d", serial); |
| 4980 | |
| 4981 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4982 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4983 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4984 | Return<void> retStatus |
| 4985 | = radioService[slotId]->mRadioResponse->nvWriteCdmaPrlResponse(responseInfo); |
| 4986 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4987 | } else { |
| 4988 | RLOGE("radio::nvWriteCdmaPrlResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 4989 | } |
| 4990 | |
| 4991 | return 0; |
| 4992 | } |
| 4993 | |
| 4994 | int radio::nvResetConfigResponse(android::Parcel &p, int slotId, int requestNumber, |
| 4995 | int responseType, int serial, RIL_Errno e, |
| 4996 | void *response, size_t responseLen) { |
| 4997 | RLOGD("radio::nvResetConfigResponse: serial %d", serial); |
| 4998 | |
| 4999 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5000 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5001 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5002 | Return<void> retStatus |
| 5003 | = radioService[slotId]->mRadioResponse->nvResetConfigResponse(responseInfo); |
| 5004 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5005 | } else { |
| 5006 | RLOGE("radio::nvResetConfigResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5007 | } |
| 5008 | |
| 5009 | return 0; |
| 5010 | } |
| 5011 | |
| 5012 | int radio::setUiccSubscriptionResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5013 | int responseType, int serial, RIL_Errno e, |
| 5014 | void *response, size_t responseLen) { |
| 5015 | RLOGD("radio::setUiccSubscriptionResponse: serial %d", serial); |
| 5016 | |
| 5017 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5018 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5019 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5020 | Return<void> retStatus |
| 5021 | = radioService[slotId]->mRadioResponse->setUiccSubscriptionResponse(responseInfo); |
| 5022 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5023 | } else { |
| 5024 | RLOGE("radio::setUiccSubscriptionResponse: radioService[%d]->mRadioResponse == NULL", |
| 5025 | slotId); |
| 5026 | } |
| 5027 | |
| 5028 | return 0; |
| 5029 | } |
| 5030 | |
| 5031 | int radio::setDataAllowedResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5032 | int responseType, int serial, RIL_Errno e, |
| 5033 | void *response, size_t responseLen) { |
| 5034 | RLOGD("radio::setDataAllowedResponse: serial %d", serial); |
| 5035 | |
| 5036 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5037 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5038 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5039 | Return<void> retStatus |
| 5040 | = radioService[slotId]->mRadioResponse->setDataAllowedResponse(responseInfo); |
| 5041 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5042 | } else { |
| 5043 | RLOGE("radio::setDataAllowedResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5044 | } |
| 5045 | |
| 5046 | return 0; |
| 5047 | } |
| 5048 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5049 | int radio::getHardwareConfigResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5050 | int responseType, int serial, RIL_Errno e, |
| 5051 | void *response, size_t responseLen) { |
| 5052 | RLOGD("radio::getHardwareConfigResponse: serial %d", serial); |
| 5053 | |
| 5054 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5055 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5056 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5057 | |
| 5058 | hidl_vec<HardwareConfig> result; |
| 5059 | if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { |
| 5060 | RLOGE("radio::hardwareConfigChangedInd: invalid response"); |
| 5061 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5062 | } else { |
| 5063 | convertRilHardwareConfigListToHal(response, responseLen, result); |
| 5064 | } |
| 5065 | |
| 5066 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getHardwareConfigResponse( |
| 5067 | responseInfo, result); |
| 5068 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5069 | } else { |
| 5070 | RLOGE("radio::getHardwareConfigResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5071 | } |
| 5072 | |
| 5073 | return 0; |
| 5074 | } |
| 5075 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5076 | int radio::requestIccSimAuthenticationResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5077 | int responseType, int serial, RIL_Errno e, |
| 5078 | void *response, size_t responseLen) { |
| 5079 | RLOGD("radio::requestIccSimAuthenticationResponse: serial %d", serial); |
| 5080 | |
| 5081 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5082 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5083 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 5084 | responseLen); |
| 5085 | |
| 5086 | Return<void> retStatus |
| 5087 | = radioService[slotId]->mRadioResponse->requestIccSimAuthenticationResponse( |
| 5088 | responseInfo, result); |
| 5089 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5090 | } else { |
| 5091 | RLOGE("radio::requestIccSimAuthenticationResponse: radioService[%d]->mRadioResponse " |
| 5092 | "== NULL", slotId); |
| 5093 | } |
| 5094 | |
| 5095 | return 0; |
| 5096 | } |
| 5097 | |
| 5098 | int radio::setDataProfileResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5099 | int responseType, int serial, RIL_Errno e, |
| 5100 | void *response, size_t responseLen) { |
| 5101 | RLOGD("radio::setDataProfileResponse: serial %d", serial); |
| 5102 | |
| 5103 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5104 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5105 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5106 | Return<void> retStatus |
| 5107 | = radioService[slotId]->mRadioResponse->setDataProfileResponse(responseInfo); |
| 5108 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5109 | } else { |
| 5110 | RLOGE("radio::setDataProfileResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5111 | } |
| 5112 | |
| 5113 | return 0; |
| 5114 | } |
| 5115 | |
| 5116 | int radio::requestShutdownResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5117 | int responseType, int serial, RIL_Errno e, |
| 5118 | void *response, size_t responseLen) { |
| 5119 | RLOGD("radio::requestShutdownResponse: serial %d", serial); |
| 5120 | |
| 5121 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5122 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5123 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5124 | Return<void> retStatus |
| 5125 | = radioService[slotId]->mRadioResponse->requestShutdownResponse(responseInfo); |
| 5126 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5127 | } else { |
| 5128 | RLOGE("radio::requestShutdownResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5129 | } |
| 5130 | |
| 5131 | return 0; |
| 5132 | } |
| 5133 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5134 | void responseRadioCapability(RadioResponseInfo& responseInfo, int serial, |
| 5135 | int responseType, RIL_Errno e, void *response, size_t responseLen, RadioCapability& rc) { |
| 5136 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5137 | |
Amit Mahajan | 1fbff08 | 2017-02-24 11:24:39 -0800 | [diff] [blame] | 5138 | if (response == NULL || responseLen != sizeof(RIL_RadioCapability)) { |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5139 | RLOGE("responseRadioCapability: Invalid response"); |
| 5140 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5141 | rc.logicalModemUuid = hidl_string(); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5142 | } else { |
| 5143 | convertRilRadioCapabilityToHal(response, responseLen, rc); |
| 5144 | } |
| 5145 | } |
| 5146 | |
| 5147 | int radio::getRadioCapabilityResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5148 | int responseType, int serial, RIL_Errno e, |
| 5149 | void *response, size_t responseLen) { |
| 5150 | RLOGD("radio::getRadioCapabilityResponse: serial %d", serial); |
| 5151 | |
| 5152 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5153 | RadioResponseInfo responseInfo = {}; |
| 5154 | RadioCapability result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5155 | responseRadioCapability(responseInfo, serial, responseType, e, response, responseLen, |
| 5156 | result); |
| 5157 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getRadioCapabilityResponse( |
| 5158 | responseInfo, result); |
| 5159 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5160 | } else { |
| 5161 | RLOGE("radio::getRadioCapabilityResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5162 | } |
| 5163 | |
| 5164 | return 0; |
| 5165 | } |
| 5166 | |
| 5167 | int radio::setRadioCapabilityResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5168 | int responseType, int serial, RIL_Errno e, |
| 5169 | void *response, size_t responseLen) { |
| 5170 | RLOGD("radio::setRadioCapabilityResponse: serial %d", serial); |
| 5171 | |
| 5172 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5173 | RadioResponseInfo responseInfo = {}; |
| 5174 | RadioCapability result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5175 | responseRadioCapability(responseInfo, serial, responseType, e, response, responseLen, |
| 5176 | result); |
| 5177 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setRadioCapabilityResponse( |
| 5178 | responseInfo, result); |
| 5179 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5180 | } else { |
| 5181 | RLOGE("radio::setRadioCapabilityResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5182 | } |
| 5183 | |
| 5184 | return 0; |
| 5185 | } |
| 5186 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5187 | LceStatusInfo responseLceStatusInfo(RadioResponseInfo& responseInfo, int serial, int responseType, |
| 5188 | RIL_Errno e, void *response, size_t responseLen) { |
| 5189 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5190 | LceStatusInfo result = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5191 | |
| 5192 | if (response == NULL || responseLen != sizeof(RIL_LceStatusInfo)) { |
| 5193 | RLOGE("Invalid response: NULL"); |
| 5194 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5195 | } else { |
| 5196 | RIL_LceStatusInfo *resp = (RIL_LceStatusInfo *) response; |
| 5197 | result.lceStatus = (LceStatus) resp->lce_status; |
| 5198 | result.actualIntervalMs = (uint8_t) resp->actual_interval_ms; |
| 5199 | } |
| 5200 | return result; |
| 5201 | } |
| 5202 | |
| 5203 | int radio::startLceServiceResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5204 | int responseType, int serial, RIL_Errno e, |
| 5205 | void *response, size_t responseLen) { |
| 5206 | RLOGD("radio::startLceServiceResponse: serial %d", serial); |
| 5207 | |
| 5208 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5209 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5210 | LceStatusInfo result = responseLceStatusInfo(responseInfo, serial, responseType, e, |
| 5211 | response, responseLen); |
| 5212 | |
| 5213 | Return<void> retStatus |
| 5214 | = radioService[slotId]->mRadioResponse->startLceServiceResponse(responseInfo, |
| 5215 | result); |
| 5216 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5217 | } else { |
| 5218 | RLOGE("radio::startLceServiceResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5219 | } |
| 5220 | |
| 5221 | return 0; |
| 5222 | } |
| 5223 | |
| 5224 | int radio::stopLceServiceResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5225 | int responseType, int serial, RIL_Errno e, |
| 5226 | void *response, size_t responseLen) { |
| 5227 | RLOGD("radio::stopLceServiceResponse: serial %d", serial); |
| 5228 | |
| 5229 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5230 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5231 | LceStatusInfo result = responseLceStatusInfo(responseInfo, serial, responseType, e, |
| 5232 | response, responseLen); |
| 5233 | |
| 5234 | Return<void> retStatus |
| 5235 | = radioService[slotId]->mRadioResponse->stopLceServiceResponse(responseInfo, |
| 5236 | result); |
| 5237 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5238 | } else { |
| 5239 | RLOGE("radio::stopLceServiceResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5240 | } |
| 5241 | |
| 5242 | return 0; |
| 5243 | } |
| 5244 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5245 | int radio::pullLceDataResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5246 | int responseType, int serial, RIL_Errno e, |
| 5247 | void *response, size_t responseLen) { |
| 5248 | RLOGD("radio::pullLceDataResponse: serial %d", serial); |
| 5249 | |
| 5250 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5251 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5252 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5253 | |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5254 | LceDataInfo result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5255 | if (response == NULL || responseLen != sizeof(RIL_LceDataInfo)) { |
| 5256 | RLOGE("radio::pullLceDataResponse: Invalid response"); |
| 5257 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5258 | } else { |
| 5259 | convertRilLceDataInfoToHal(response, responseLen, result); |
| 5260 | } |
| 5261 | |
| 5262 | Return<void> retStatus = radioService[slotId]->mRadioResponse->pullLceDataResponse( |
| 5263 | responseInfo, result); |
| 5264 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5265 | } else { |
| 5266 | RLOGE("radio::pullLceDataResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5267 | } |
| 5268 | |
| 5269 | return 0; |
| 5270 | } |
| 5271 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5272 | int radio::getModemActivityInfoResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5273 | int responseType, int serial, RIL_Errno e, |
| 5274 | void *response, size_t responseLen) { |
| 5275 | RLOGD("radio::getModemActivityInfoResponse: serial %d", serial); |
| 5276 | |
| 5277 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5278 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5279 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5280 | ActivityStatsInfo info; |
| 5281 | if (response == NULL || responseLen != sizeof(RIL_ActivityStatsInfo)) { |
| 5282 | RLOGE("radio::getModemActivityInfoResponse Invalid response: NULL"); |
| 5283 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5284 | } else { |
| 5285 | RIL_ActivityStatsInfo *resp = (RIL_ActivityStatsInfo *)response; |
| 5286 | info.sleepModeTimeMs = resp->sleep_mode_time_ms; |
| 5287 | info.idleModeTimeMs = resp->idle_mode_time_ms; |
| 5288 | for(int i = 0; i < RIL_NUM_TX_POWER_LEVELS; i++) { |
| 5289 | info.txmModetimeMs[i] = resp->tx_mode_time_ms[i]; |
| 5290 | } |
| 5291 | info.rxModeTimeMs = resp->rx_mode_time_ms; |
| 5292 | } |
| 5293 | |
| 5294 | Return<void> retStatus |
| 5295 | = radioService[slotId]->mRadioResponse->getModemActivityInfoResponse(responseInfo, |
| 5296 | info); |
| 5297 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5298 | } else { |
| 5299 | RLOGE("radio::getModemActivityInfoResponse: radioService[%d]->mRadioResponse == NULL", |
| 5300 | slotId); |
| 5301 | } |
| 5302 | |
| 5303 | return 0; |
| 5304 | } |
| 5305 | |
| 5306 | int radio::setAllowedCarriersResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5307 | int responseType, int serial, RIL_Errno e, |
| 5308 | void *response, size_t responseLen) { |
| 5309 | RLOGD("radio::setAllowedCarriersResponse: serial %d", serial); |
| 5310 | |
| 5311 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5312 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5313 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 5314 | Return<void> retStatus |
| 5315 | = radioService[slotId]->mRadioResponse->setAllowedCarriersResponse(responseInfo, |
| 5316 | ret); |
| 5317 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5318 | } else { |
| 5319 | RLOGE("radio::setAllowedCarriersResponse: radioService[%d]->mRadioResponse == NULL", |
| 5320 | slotId); |
| 5321 | } |
| 5322 | |
| 5323 | return 0; |
| 5324 | } |
| 5325 | |
| 5326 | int radio::getAllowedCarriersResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5327 | int responseType, int serial, RIL_Errno e, |
| 5328 | void *response, size_t responseLen) { |
| 5329 | RLOGD("radio::getAllowedCarriersResponse: serial %d", serial); |
| 5330 | |
| 5331 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5332 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5333 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5334 | CarrierRestrictions carrierInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5335 | bool allAllowed = true; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5336 | if (response == NULL || responseLen != sizeof(RIL_CarrierRestrictions)) { |
| 5337 | RLOGE("radio::getAllowedCarriersResponse Invalid response: NULL"); |
| 5338 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5339 | } else { |
| 5340 | RIL_CarrierRestrictions *pCr = (RIL_CarrierRestrictions *)response; |
| 5341 | if (pCr->len_allowed_carriers > 0 || pCr->len_excluded_carriers > 0) { |
| 5342 | allAllowed = false; |
| 5343 | } |
| 5344 | |
| 5345 | carrierInfo.allowedCarriers.resize(pCr->len_allowed_carriers); |
| 5346 | for(int i = 0; i < pCr->len_allowed_carriers; i++) { |
| 5347 | RIL_Carrier *carrier = pCr->allowed_carriers + i; |
| 5348 | carrierInfo.allowedCarriers[i].mcc = convertCharPtrToHidlString(carrier->mcc); |
| 5349 | carrierInfo.allowedCarriers[i].mnc = convertCharPtrToHidlString(carrier->mnc); |
| 5350 | carrierInfo.allowedCarriers[i].matchType = (CarrierMatchType) carrier->match_type; |
| 5351 | carrierInfo.allowedCarriers[i].matchData = |
| 5352 | convertCharPtrToHidlString(carrier->match_data); |
| 5353 | } |
| 5354 | |
| 5355 | carrierInfo.excludedCarriers.resize(pCr->len_excluded_carriers); |
| 5356 | for(int i = 0; i < pCr->len_excluded_carriers; i++) { |
| 5357 | RIL_Carrier *carrier = pCr->excluded_carriers + i; |
| 5358 | carrierInfo.excludedCarriers[i].mcc = convertCharPtrToHidlString(carrier->mcc); |
| 5359 | carrierInfo.excludedCarriers[i].mnc = convertCharPtrToHidlString(carrier->mnc); |
| 5360 | carrierInfo.excludedCarriers[i].matchType = (CarrierMatchType) carrier->match_type; |
| 5361 | carrierInfo.excludedCarriers[i].matchData = |
| 5362 | convertCharPtrToHidlString(carrier->match_data); |
| 5363 | } |
| 5364 | } |
| 5365 | |
| 5366 | Return<void> retStatus |
| 5367 | = radioService[slotId]->mRadioResponse->getAllowedCarriersResponse(responseInfo, |
| 5368 | allAllowed, carrierInfo); |
| 5369 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5370 | } else { |
| 5371 | RLOGE("radio::getAllowedCarriersResponse: radioService[%d]->mRadioResponse == NULL", |
| 5372 | slotId); |
| 5373 | } |
| 5374 | |
| 5375 | return 0; |
| 5376 | } |
| 5377 | |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 5378 | int radio::setSimCardPowerResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5379 | int responseType, int serial, RIL_Errno e, |
| 5380 | void *response, size_t responseLen) { |
| 5381 | RLOGD("radio::setSimCardPowerResponse: serial %d", serial); |
| 5382 | |
| 5383 | if (radioService[slotId]->mRadioResponse != NULL) { |
| 5384 | RadioResponseInfo responseInfo = {}; |
| 5385 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5386 | Return<void> retStatus |
| 5387 | = radioService[slotId]->mRadioResponse->setSimCardPowerResponse(responseInfo); |
| 5388 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5389 | } else { |
| 5390 | RLOGE("radio::setSimCardPowerResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
| 5391 | } |
| 5392 | |
| 5393 | return 0; |
| 5394 | } |
| 5395 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5396 | int radio::sendRequestRawResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5397 | int responseType, int serial, RIL_Errno e, |
| 5398 | void *response, size_t responseLen) { |
| 5399 | RLOGD("radio::sendRequestRawResponse: serial %d", serial); |
| 5400 | |
| 5401 | if (oemHookService[slotId]->mOemHookResponse != NULL) { |
| 5402 | RadioResponseInfo responseInfo = {}; |
| 5403 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5404 | hidl_vec<uint8_t> data; |
| 5405 | |
| 5406 | if (response == NULL) { |
| 5407 | RLOGE("radio::sendRequestRawResponse: Invalid response"); |
| 5408 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5409 | } else { |
| 5410 | data.setToExternal((uint8_t *) response, responseLen); |
| 5411 | } |
| 5412 | Return<void> retStatus = oemHookService[slotId]->mOemHookResponse-> |
| 5413 | sendRequestRawResponse(responseInfo, data); |
| 5414 | checkReturnStatus(slotId, retStatus); |
| 5415 | } else { |
| 5416 | RLOGE("radio::sendRequestRawResponse: oemHookService[%d]->mOemHookResponse == NULL", |
| 5417 | slotId); |
| 5418 | } |
| 5419 | |
| 5420 | return 0; |
| 5421 | } |
| 5422 | |
| 5423 | int radio::sendRequestStringsResponse(android::Parcel &p, int slotId, int requestNumber, |
| 5424 | int responseType, int serial, RIL_Errno e, |
| 5425 | void *response, size_t responseLen) { |
| 5426 | RLOGD("radio::sendRequestStringsResponse: serial %d", serial); |
| 5427 | |
| 5428 | if (oemHookService[slotId]->mOemHookResponse != NULL) { |
| 5429 | RadioResponseInfo responseInfo = {}; |
| 5430 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5431 | hidl_vec<hidl_string> data; |
| 5432 | |
| 5433 | if (response == NULL || responseLen % sizeof(char *) != 0) { |
| 5434 | RLOGE("radio::sendRequestStringsResponse Invalid response: NULL"); |
| 5435 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5436 | } else { |
| 5437 | char **resp = (char **) response; |
| 5438 | int numStrings = responseLen / sizeof(char *); |
| 5439 | data.resize(numStrings); |
| 5440 | for (int i = 0; i < numStrings; i++) { |
| 5441 | data[i] = convertCharPtrToHidlString(resp[i]); |
| 5442 | } |
| 5443 | } |
| 5444 | Return<void> retStatus |
| 5445 | = oemHookService[slotId]->mOemHookResponse->sendRequestStringsResponse( |
| 5446 | responseInfo, data); |
| 5447 | checkReturnStatus(slotId, retStatus); |
| 5448 | } else { |
| 5449 | RLOGE("radio::sendRequestStringsResponse: oemHookService[%d]->mOemHookResponse == " |
| 5450 | "NULL", slotId); |
| 5451 | } |
| 5452 | |
| 5453 | return 0; |
| 5454 | } |
| 5455 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5456 | // Radio Indication functions |
| 5457 | |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5458 | RadioIndicationType convertIntToRadioIndicationType(int indicationType) { |
| 5459 | return indicationType == RESPONSE_UNSOLICITED ? (RadioIndicationType::UNSOLICITED) : |
| 5460 | (RadioIndicationType::UNSOLICITED_ACK_EXP); |
| 5461 | } |
| 5462 | |
| 5463 | void radio::radioStateChangedInd(int slotId, int indicationType, RIL_RadioState radioState) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5464 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5465 | RLOGD("radio::radioStateChangedInd: radioState %d", radioState); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5466 | Return<void> retStatus = radioService[slotId]->mRadioIndication->radioStateChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5467 | convertIntToRadioIndicationType(indicationType), (RadioState) radioState); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5468 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 5469 | } else { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5470 | RLOGE("radio::radioStateChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 5471 | } |
| 5472 | } |
| 5473 | |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5474 | int radio::callStateChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 5475 | int indicationType, int token, RIL_Errno e, void *response, |
| 5476 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5477 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5478 | RLOGD("radio::callStateChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5479 | Return<void> retStatus = radioService[slotId]->mRadioIndication->callStateChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5480 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5481 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5482 | } else { |
| 5483 | RLOGE("radio::callStateChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5484 | } |
| 5485 | |
| 5486 | return 0; |
| 5487 | } |
| 5488 | |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 5489 | int radio::networkStateChangedInd(android::Parcel &p, int slotId, int requestNumber, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5490 | int indicationType, int token, RIL_Errno e, void *response, |
| 5491 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5492 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 5493 | RLOGD("radio::networkStateChangedInd"); |
| 5494 | Return<void> retStatus = radioService[slotId]->mRadioIndication->networkStateChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5495 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5496 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5497 | } else { |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 5498 | RLOGE("radio::networkStateChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5499 | slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5500 | } |
| 5501 | |
| 5502 | return 0; |
| 5503 | } |
| 5504 | |
| 5505 | uint8_t hexCharToInt(uint8_t c) { |
| 5506 | if (c >= '0' && c <= '9') return (c - '0'); |
| 5507 | if (c >= 'A' && c <= 'F') return (c - 'A' + 10); |
| 5508 | if (c >= 'a' && c <= 'f') return (c - 'a' + 10); |
| 5509 | |
| 5510 | return INVALID_HEX_CHAR; |
| 5511 | } |
| 5512 | |
| 5513 | uint8_t * convertHexStringToBytes(void *response, size_t responseLen) { |
| 5514 | if (responseLen % 2 != 0) { |
| 5515 | return NULL; |
| 5516 | } |
| 5517 | |
| 5518 | uint8_t *bytes = (uint8_t *)calloc(responseLen/2, sizeof(uint8_t)); |
| 5519 | if (bytes == NULL) { |
| 5520 | RLOGE("convertHexStringToBytes: cannot allocate memory for bytes string"); |
| 5521 | return NULL; |
| 5522 | } |
| 5523 | uint8_t *hexString = (uint8_t *)response; |
| 5524 | |
Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame] | 5525 | for (size_t i = 0; i < responseLen; i += 2) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5526 | uint8_t hexChar1 = hexCharToInt(hexString[i]); |
| 5527 | uint8_t hexChar2 = hexCharToInt(hexString[i + 1]); |
| 5528 | |
| 5529 | if (hexChar1 == INVALID_HEX_CHAR || hexChar2 == INVALID_HEX_CHAR) { |
| 5530 | RLOGE("convertHexStringToBytes: invalid hex char %d %d", |
| 5531 | hexString[i], hexString[i + 1]); |
| 5532 | free(bytes); |
| 5533 | return NULL; |
| 5534 | } |
| 5535 | bytes[i/2] = ((hexChar1 << 4) | hexChar2); |
| 5536 | } |
| 5537 | |
| 5538 | return bytes; |
| 5539 | } |
| 5540 | |
| 5541 | int radio::newSmsInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5542 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5543 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5544 | if (response == NULL || responseLen == 0) { |
| 5545 | RLOGE("radio::newSmsInd: invalid response"); |
| 5546 | return 0; |
| 5547 | } |
| 5548 | |
| 5549 | uint8_t *bytes = convertHexStringToBytes(response, responseLen); |
| 5550 | if (bytes == NULL) { |
| 5551 | RLOGE("radio::newSmsInd: convertHexStringToBytes failed"); |
| 5552 | return 0; |
| 5553 | } |
| 5554 | |
| 5555 | hidl_vec<uint8_t> pdu; |
| 5556 | pdu.setToExternal(bytes, responseLen/2); |
| 5557 | RLOGD("radio::newSmsInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5558 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newSms( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5559 | convertIntToRadioIndicationType(indicationType), pdu); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5560 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5561 | free(bytes); |
| 5562 | } else { |
| 5563 | RLOGE("radio::newSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5564 | } |
| 5565 | |
| 5566 | return 0; |
| 5567 | } |
| 5568 | |
| 5569 | int radio::newSmsStatusReportInd(android::Parcel &p, int slotId, int requestNumber, |
| 5570 | int indicationType, int token, RIL_Errno e, void *response, |
| 5571 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5572 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5573 | if (response == NULL || responseLen == 0) { |
| 5574 | RLOGE("radio::newSmsStatusReportInd: invalid response"); |
| 5575 | return 0; |
| 5576 | } |
| 5577 | |
| 5578 | uint8_t *bytes = convertHexStringToBytes(response, responseLen); |
| 5579 | if (bytes == NULL) { |
| 5580 | RLOGE("radio::newSmsStatusReportInd: convertHexStringToBytes failed"); |
| 5581 | return 0; |
| 5582 | } |
| 5583 | |
| 5584 | hidl_vec<uint8_t> pdu; |
| 5585 | pdu.setToExternal(bytes, responseLen/2); |
| 5586 | RLOGD("radio::newSmsStatusReportInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5587 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newSmsStatusReport( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5588 | convertIntToRadioIndicationType(indicationType), pdu); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5589 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5590 | free(bytes); |
| 5591 | } else { |
| 5592 | RLOGE("radio::newSmsStatusReportInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5593 | } |
| 5594 | |
| 5595 | return 0; |
| 5596 | } |
| 5597 | |
| 5598 | int radio::newSmsOnSimInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5599 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5600 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5601 | if (response == NULL || responseLen != sizeof(int)) { |
| 5602 | RLOGE("radio::newSmsOnSimInd: invalid response"); |
| 5603 | return 0; |
| 5604 | } |
| 5605 | int32_t recordNumber = ((int32_t *) response)[0]; |
| 5606 | RLOGD("radio::newSmsOnSimInd: slotIndex %d", recordNumber); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5607 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newSmsOnSim( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5608 | convertIntToRadioIndicationType(indicationType), recordNumber); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5609 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5610 | } else { |
| 5611 | RLOGE("radio::newSmsOnSimInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5612 | } |
| 5613 | |
| 5614 | return 0; |
| 5615 | } |
| 5616 | |
| 5617 | int radio::onUssdInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5618 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5619 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5620 | if (response == NULL || responseLen != 2 * sizeof(char *)) { |
| 5621 | RLOGE("radio::onUssdInd: invalid response"); |
| 5622 | return 0; |
| 5623 | } |
| 5624 | char **strings = (char **) response; |
| 5625 | char *mode = strings[0]; |
| 5626 | hidl_string msg = convertCharPtrToHidlString(strings[1]); |
| 5627 | UssdModeType modeType = (UssdModeType) atoi(mode); |
| 5628 | RLOGD("radio::onUssdInd: mode %s", mode); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5629 | Return<void> retStatus = radioService[slotId]->mRadioIndication->onUssd( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5630 | convertIntToRadioIndicationType(indicationType), modeType, msg); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5631 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5632 | } else { |
| 5633 | RLOGE("radio::onUssdInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5634 | } |
| 5635 | |
| 5636 | return 0; |
| 5637 | } |
| 5638 | |
| 5639 | int radio::nitzTimeReceivedInd(android::Parcel &p, int slotId, int requestNumber, |
| 5640 | int indicationType, int token, RIL_Errno e, void *response, |
| 5641 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5642 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5643 | if (response == NULL || responseLen == 0) { |
| 5644 | RLOGE("radio::nitzTimeReceivedInd: invalid response"); |
| 5645 | return 0; |
| 5646 | } |
| 5647 | hidl_string nitzTime = convertCharPtrToHidlString((char *) response); |
| 5648 | int64_t timeReceived = android::elapsedRealtime(); |
Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame] | 5649 | RLOGD("radio::nitzTimeReceivedInd: nitzTime %s receivedTime %" PRId64, nitzTime.c_str(), |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5650 | timeReceived); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5651 | Return<void> retStatus = radioService[slotId]->mRadioIndication->nitzTimeReceived( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5652 | convertIntToRadioIndicationType(indicationType), nitzTime, timeReceived); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5653 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5654 | } else { |
| 5655 | RLOGE("radio::nitzTimeReceivedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Weilun Du | d2c3093 | 2017-02-09 12:32:42 -0800 | [diff] [blame] | 5656 | return -1; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5657 | } |
| 5658 | |
| 5659 | return 0; |
| 5660 | } |
| 5661 | |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5662 | void convertRilSignalStrengthToHal(void *response, size_t responseLen, |
| 5663 | SignalStrength& signalStrength) { |
| 5664 | RIL_SignalStrength_v10 *rilSignalStrength = (RIL_SignalStrength_v10 *) response; |
| 5665 | |
| 5666 | // Fixup LTE for backwards compatibility |
| 5667 | // signalStrength: -1 -> 99 |
| 5668 | if (rilSignalStrength->LTE_SignalStrength.signalStrength == -1) { |
| 5669 | rilSignalStrength->LTE_SignalStrength.signalStrength = 99; |
| 5670 | } |
| 5671 | // rsrp: -1 -> INT_MAX all other negative value to positive. |
| 5672 | // So remap here |
| 5673 | if (rilSignalStrength->LTE_SignalStrength.rsrp == -1) { |
| 5674 | rilSignalStrength->LTE_SignalStrength.rsrp = INT_MAX; |
| 5675 | } else if (rilSignalStrength->LTE_SignalStrength.rsrp < -1) { |
| 5676 | rilSignalStrength->LTE_SignalStrength.rsrp = -rilSignalStrength->LTE_SignalStrength.rsrp; |
| 5677 | } |
| 5678 | // rsrq: -1 -> INT_MAX |
| 5679 | if (rilSignalStrength->LTE_SignalStrength.rsrq == -1) { |
| 5680 | rilSignalStrength->LTE_SignalStrength.rsrq = INT_MAX; |
| 5681 | } |
| 5682 | // Not remapping rssnr is already using INT_MAX |
| 5683 | // cqi: -1 -> INT_MAX |
| 5684 | if (rilSignalStrength->LTE_SignalStrength.cqi == -1) { |
| 5685 | rilSignalStrength->LTE_SignalStrength.cqi = INT_MAX; |
| 5686 | } |
| 5687 | |
| 5688 | signalStrength.gw.signalStrength = rilSignalStrength->GW_SignalStrength.signalStrength; |
| 5689 | signalStrength.gw.bitErrorRate = rilSignalStrength->GW_SignalStrength.bitErrorRate; |
| 5690 | signalStrength.cdma.dbm = rilSignalStrength->CDMA_SignalStrength.dbm; |
| 5691 | signalStrength.cdma.ecio = rilSignalStrength->CDMA_SignalStrength.ecio; |
| 5692 | signalStrength.evdo.dbm = rilSignalStrength->EVDO_SignalStrength.dbm; |
| 5693 | signalStrength.evdo.ecio = rilSignalStrength->EVDO_SignalStrength.ecio; |
| 5694 | signalStrength.evdo.signalNoiseRatio = |
| 5695 | rilSignalStrength->EVDO_SignalStrength.signalNoiseRatio; |
| 5696 | signalStrength.lte.signalStrength = rilSignalStrength->LTE_SignalStrength.signalStrength; |
| 5697 | signalStrength.lte.rsrp = rilSignalStrength->LTE_SignalStrength.rsrp; |
| 5698 | signalStrength.lte.rsrq = rilSignalStrength->LTE_SignalStrength.rsrq; |
| 5699 | signalStrength.lte.rssnr = rilSignalStrength->LTE_SignalStrength.rssnr; |
| 5700 | signalStrength.lte.cqi = rilSignalStrength->LTE_SignalStrength.cqi; |
| 5701 | signalStrength.lte.timingAdvance = rilSignalStrength->LTE_SignalStrength.timingAdvance; |
| 5702 | signalStrength.tdScdma.rscp = rilSignalStrength->TD_SCDMA_SignalStrength.rscp; |
| 5703 | } |
| 5704 | |
| 5705 | int radio::currentSignalStrengthInd(android::Parcel &p, int slotId, int requestNumber, |
| 5706 | int indicationType, int token, RIL_Errno e, |
| 5707 | void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5708 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5709 | if (response == NULL || responseLen != sizeof(RIL_SignalStrength_v10)) { |
| 5710 | RLOGE("radio::currentSignalStrengthInd: invalid response"); |
| 5711 | return 0; |
| 5712 | } |
| 5713 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5714 | SignalStrength signalStrength = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5715 | convertRilSignalStrengthToHal(response, responseLen, signalStrength); |
| 5716 | |
| 5717 | RLOGD("radio::currentSignalStrengthInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5718 | Return<void> retStatus = radioService[slotId]->mRadioIndication->currentSignalStrength( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5719 | convertIntToRadioIndicationType(indicationType), signalStrength); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5720 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5721 | } else { |
| 5722 | RLOGE("radio::currentSignalStrengthInd: radioService[%d]->mRadioIndication == NULL", |
| 5723 | slotId); |
| 5724 | } |
| 5725 | |
| 5726 | return 0; |
| 5727 | } |
| 5728 | |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5729 | void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse, |
| 5730 | SetupDataCallResult& dcResult) { |
Jack Yu | 5079e18 | 2017-02-28 15:21:18 -0800 | [diff] [blame^] | 5731 | dcResult.status = (DataCallFailCause) dcResponse->status; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5732 | dcResult.suggestedRetryTime = dcResponse->suggestedRetryTime; |
| 5733 | dcResult.cid = dcResponse->cid; |
| 5734 | dcResult.active = dcResponse->active; |
| 5735 | dcResult.type = convertCharPtrToHidlString(dcResponse->type); |
| 5736 | dcResult.ifname = convertCharPtrToHidlString(dcResponse->ifname); |
| 5737 | dcResult.addresses = convertCharPtrToHidlString(dcResponse->addresses); |
| 5738 | dcResult.dnses = convertCharPtrToHidlString(dcResponse->dnses); |
| 5739 | dcResult.gateways = convertCharPtrToHidlString(dcResponse->gateways); |
| 5740 | dcResult.pcscf = convertCharPtrToHidlString(dcResponse->pcscf); |
| 5741 | dcResult.mtu = dcResponse->mtu; |
| 5742 | } |
| 5743 | |
| 5744 | void convertRilDataCallListToHal(void *response, size_t responseLen, |
| 5745 | hidl_vec<SetupDataCallResult>& dcResultList) { |
| 5746 | int num = responseLen / sizeof(RIL_Data_Call_Response_v11); |
| 5747 | |
| 5748 | RIL_Data_Call_Response_v11 *dcResponse = (RIL_Data_Call_Response_v11 *) response; |
| 5749 | dcResultList.resize(num); |
| 5750 | for (int i = 0; i < num; i++) { |
| 5751 | convertRilDataCallToHal(&dcResponse[i], dcResultList[i]); |
| 5752 | } |
| 5753 | } |
| 5754 | |
| 5755 | int radio::dataCallListChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 5756 | int indicationType, int token, RIL_Errno e, void *response, |
| 5757 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5758 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5759 | if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { |
| 5760 | RLOGE("radio::dataCallListChangedInd: invalid response"); |
| 5761 | return 0; |
| 5762 | } |
| 5763 | hidl_vec<SetupDataCallResult> dcList; |
| 5764 | convertRilDataCallListToHal(response, responseLen, dcList); |
| 5765 | RLOGD("radio::dataCallListChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5766 | Return<void> retStatus = radioService[slotId]->mRadioIndication->dataCallListChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5767 | convertIntToRadioIndicationType(indicationType), dcList); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5768 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5769 | } else { |
| 5770 | RLOGE("radio::dataCallListChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5771 | } |
| 5772 | |
| 5773 | return 0; |
| 5774 | } |
| 5775 | |
| 5776 | int radio::suppSvcNotifyInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5777 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5778 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5779 | if (response == NULL || responseLen != sizeof(RIL_SuppSvcNotification)) { |
| 5780 | RLOGE("radio::suppSvcNotifyInd: invalid response"); |
| 5781 | return 0; |
| 5782 | } |
| 5783 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5784 | SuppSvcNotification suppSvc = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5785 | RIL_SuppSvcNotification *ssn = (RIL_SuppSvcNotification *) response; |
| 5786 | suppSvc.isMT = ssn->notificationType; |
| 5787 | suppSvc.code = ssn->code; |
| 5788 | suppSvc.index = ssn->index; |
| 5789 | suppSvc.type = ssn->type; |
| 5790 | suppSvc.number = convertCharPtrToHidlString(ssn->number); |
| 5791 | |
| 5792 | RLOGD("radio::suppSvcNotifyInd: isMT %d code %d index %d type %d", |
| 5793 | suppSvc.isMT, suppSvc.code, suppSvc.index, suppSvc.type); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5794 | Return<void> retStatus = radioService[slotId]->mRadioIndication->suppSvcNotify( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5795 | convertIntToRadioIndicationType(indicationType), suppSvc); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5796 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5797 | } else { |
| 5798 | RLOGE("radio::suppSvcNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5799 | } |
| 5800 | |
| 5801 | return 0; |
| 5802 | } |
| 5803 | |
| 5804 | int radio::stkSessionEndInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5805 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5806 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5807 | RLOGD("radio::stkSessionEndInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5808 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkSessionEnd( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5809 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5810 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5811 | } else { |
| 5812 | RLOGE("radio::stkSessionEndInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5813 | } |
| 5814 | |
| 5815 | return 0; |
| 5816 | } |
| 5817 | |
| 5818 | int radio::stkProactiveCommandInd(android::Parcel &p, int slotId, int requestNumber, |
| 5819 | int indicationType, int token, RIL_Errno e, void *response, |
| 5820 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5821 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5822 | if (response == NULL || responseLen == 0) { |
| 5823 | RLOGE("radio::stkProactiveCommandInd: invalid response"); |
| 5824 | return 0; |
| 5825 | } |
| 5826 | RLOGD("radio::stkProactiveCommandInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5827 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkProactiveCommand( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5828 | convertIntToRadioIndicationType(indicationType), |
| 5829 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5830 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5831 | } else { |
| 5832 | RLOGE("radio::stkProactiveCommandInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5833 | } |
| 5834 | |
| 5835 | return 0; |
| 5836 | } |
| 5837 | |
| 5838 | int radio::stkEventNotifyInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5839 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5840 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5841 | if (response == NULL || responseLen == 0) { |
| 5842 | RLOGE("radio::stkEventNotifyInd: invalid response"); |
| 5843 | return 0; |
| 5844 | } |
| 5845 | RLOGD("radio::stkEventNotifyInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5846 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkEventNotify( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5847 | convertIntToRadioIndicationType(indicationType), |
| 5848 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5849 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5850 | } else { |
| 5851 | RLOGE("radio::stkEventNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5852 | } |
| 5853 | |
| 5854 | return 0; |
| 5855 | } |
| 5856 | |
| 5857 | int radio::stkCallSetupInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5858 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5859 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5860 | if (response == NULL || responseLen != sizeof(int)) { |
| 5861 | RLOGE("radio::stkCallSetupInd: invalid response"); |
| 5862 | return 0; |
| 5863 | } |
| 5864 | int32_t timeout = ((int32_t *) response)[0]; |
| 5865 | RLOGD("radio::stkCallSetupInd: timeout %d", timeout); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5866 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkCallSetup( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5867 | convertIntToRadioIndicationType(indicationType), timeout); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5868 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5869 | } else { |
| 5870 | RLOGE("radio::stkCallSetupInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5871 | } |
| 5872 | |
| 5873 | return 0; |
| 5874 | } |
| 5875 | |
| 5876 | int radio::simSmsStorageFullInd(android::Parcel &p, int slotId, int requestNumber, |
| 5877 | int indicationType, int token, RIL_Errno e, void *response, |
| 5878 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5879 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5880 | RLOGD("radio::simSmsStorageFullInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5881 | Return<void> retStatus = radioService[slotId]->mRadioIndication->simSmsStorageFull( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5882 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5883 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5884 | } else { |
| 5885 | RLOGE("radio::simSmsStorageFullInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5886 | } |
| 5887 | |
| 5888 | return 0; |
| 5889 | } |
| 5890 | |
| 5891 | int radio::simRefreshInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5892 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5893 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5894 | if (response == NULL || responseLen != sizeof(RIL_SimRefreshResponse_v7)) { |
| 5895 | RLOGE("radio::simRefreshInd: invalid response"); |
| 5896 | return 0; |
| 5897 | } |
| 5898 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5899 | SimRefreshResult refreshResult = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5900 | RIL_SimRefreshResponse_v7 *simRefreshResponse = ((RIL_SimRefreshResponse_v7 *) response); |
| 5901 | refreshResult.type = |
| 5902 | (android::hardware::radio::V1_0::SimRefreshType) simRefreshResponse->result; |
| 5903 | refreshResult.efId = simRefreshResponse->ef_id; |
| 5904 | refreshResult.aid = convertCharPtrToHidlString(simRefreshResponse->aid); |
| 5905 | |
| 5906 | RLOGD("radio::simRefreshInd: type %d efId %d", refreshResult.type, refreshResult.efId); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5907 | Return<void> retStatus = radioService[slotId]->mRadioIndication->simRefresh( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5908 | convertIntToRadioIndicationType(indicationType), refreshResult); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5909 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5910 | } else { |
| 5911 | RLOGE("radio::simRefreshInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5912 | } |
| 5913 | |
| 5914 | return 0; |
| 5915 | } |
| 5916 | |
| 5917 | void convertRilCdmaSignalInfoRecordToHal(RIL_CDMA_SignalInfoRecord *signalInfoRecord, |
| 5918 | CdmaSignalInfoRecord& record) { |
| 5919 | record.isPresent = signalInfoRecord->isPresent; |
| 5920 | record.signalType = signalInfoRecord->signalType; |
| 5921 | record.alertPitch = signalInfoRecord->alertPitch; |
| 5922 | record.signal = signalInfoRecord->signal; |
| 5923 | } |
| 5924 | |
| 5925 | int radio::callRingInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5926 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5927 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5928 | bool isGsm; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5929 | CdmaSignalInfoRecord record = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5930 | if (response == NULL || responseLen == 0) { |
| 5931 | isGsm = true; |
| 5932 | } else { |
| 5933 | isGsm = false; |
| 5934 | if (responseLen != sizeof (RIL_CDMA_SignalInfoRecord)) { |
| 5935 | RLOGE("radio::callRingInd: invalid response"); |
| 5936 | return 0; |
| 5937 | } |
| 5938 | convertRilCdmaSignalInfoRecordToHal((RIL_CDMA_SignalInfoRecord *) response, record); |
| 5939 | } |
| 5940 | |
| 5941 | RLOGD("radio::callRingInd: isGsm %d", isGsm); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5942 | Return<void> retStatus = radioService[slotId]->mRadioIndication->callRing( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5943 | convertIntToRadioIndicationType(indicationType), isGsm, record); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5944 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5945 | } else { |
| 5946 | RLOGE("radio::callRingInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5947 | } |
| 5948 | |
| 5949 | return 0; |
| 5950 | } |
| 5951 | |
| 5952 | int radio::simStatusChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 5953 | int indicationType, int token, RIL_Errno e, void *response, |
| 5954 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5955 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5956 | RLOGD("radio::simStatusChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5957 | Return<void> retStatus = radioService[slotId]->mRadioIndication->simStatusChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5958 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5959 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5960 | } else { |
| 5961 | RLOGE("radio::simStatusChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 5962 | } |
| 5963 | |
| 5964 | return 0; |
| 5965 | } |
| 5966 | |
| 5967 | int radio::cdmaNewSmsInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, |
| 5968 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5969 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5970 | if (response == NULL || responseLen != sizeof(RIL_CDMA_SMS_Message)) { |
| 5971 | RLOGE("radio::cdmaNewSmsInd: invalid response"); |
| 5972 | return 0; |
| 5973 | } |
| 5974 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5975 | CdmaSmsMessage msg = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5976 | RIL_CDMA_SMS_Message *rilMsg = (RIL_CDMA_SMS_Message *) response; |
| 5977 | msg.teleserviceId = rilMsg->uTeleserviceID; |
| 5978 | msg.isServicePresent = rilMsg->bIsServicePresent; |
| 5979 | msg.serviceCategory = rilMsg->uServicecategory; |
| 5980 | msg.address.digitMode = |
| 5981 | (android::hardware::radio::V1_0::CdmaSmsDigitMode) rilMsg->sAddress.digit_mode; |
| 5982 | msg.address.numberMode = |
| 5983 | (android::hardware::radio::V1_0::CdmaSmsNumberMode) rilMsg->sAddress.number_mode; |
| 5984 | msg.address.numberType = |
| 5985 | (android::hardware::radio::V1_0::CdmaSmsNumberType) rilMsg->sAddress.number_type; |
| 5986 | msg.address.numberPlan = |
| 5987 | (android::hardware::radio::V1_0::CdmaSmsNumberPlan) rilMsg->sAddress.number_plan; |
| 5988 | |
| 5989 | int digitLimit = MIN((rilMsg->sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX); |
| 5990 | msg.address.digits.setToExternal(rilMsg->sAddress.digits, digitLimit); |
| 5991 | |
| 5992 | msg.subAddress.subaddressType = (android::hardware::radio::V1_0::CdmaSmsSubaddressType) |
| 5993 | rilMsg->sSubAddress.subaddressType; |
| 5994 | msg.subAddress.odd = rilMsg->sSubAddress.odd; |
| 5995 | |
| 5996 | digitLimit= MIN((rilMsg->sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX); |
| 5997 | msg.subAddress.digits.setToExternal(rilMsg->sSubAddress.digits, digitLimit); |
| 5998 | |
| 5999 | digitLimit = MIN((rilMsg->uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX); |
| 6000 | msg.bearerData.setToExternal(rilMsg->aBearerData, digitLimit); |
| 6001 | |
| 6002 | RLOGD("radio::cdmaNewSmsInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6003 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaNewSms( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6004 | convertIntToRadioIndicationType(indicationType), msg); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6005 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6006 | } else { |
| 6007 | RLOGE("radio::cdmaNewSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6008 | } |
| 6009 | |
| 6010 | return 0; |
| 6011 | } |
| 6012 | |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6013 | int radio::newBroadcastSmsInd(android::Parcel &p, int slotId, int requestNumber, |
| 6014 | int indicationType, int token, RIL_Errno e, void *response, |
| 6015 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6016 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6017 | if (response == NULL || responseLen == 0) { |
| 6018 | RLOGE("radio::newBroadcastSmsInd: invalid response"); |
| 6019 | return 0; |
| 6020 | } |
| 6021 | |
| 6022 | hidl_vec<uint8_t> data; |
| 6023 | data.setToExternal((uint8_t *) response, responseLen); |
| 6024 | RLOGD("radio::newBroadcastSmsInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6025 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newBroadcastSms( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6026 | convertIntToRadioIndicationType(indicationType), data); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6027 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6028 | } else { |
| 6029 | RLOGE("radio::newBroadcastSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6030 | } |
| 6031 | |
| 6032 | return 0; |
| 6033 | } |
| 6034 | |
| 6035 | int radio::cdmaRuimSmsStorageFullInd(android::Parcel &p, int slotId, int requestNumber, |
| 6036 | int indicationType, int token, RIL_Errno e, void *response, |
| 6037 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6038 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6039 | RLOGD("radio::cdmaRuimSmsStorageFullInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6040 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaRuimSmsStorageFull( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6041 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6042 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6043 | } else { |
| 6044 | RLOGE("radio::cdmaRuimSmsStorageFullInd: radioService[%d]->mRadioIndication == NULL", |
| 6045 | slotId); |
| 6046 | } |
| 6047 | |
| 6048 | return 0; |
| 6049 | } |
| 6050 | |
| 6051 | int radio::restrictedStateChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6052 | int indicationType, int token, RIL_Errno e, void *response, |
| 6053 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6054 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6055 | if (response == NULL || responseLen != sizeof(int)) { |
| 6056 | RLOGE("radio::restrictedStateChangedInd: invalid response"); |
| 6057 | return 0; |
| 6058 | } |
| 6059 | int32_t state = ((int32_t *) response)[0]; |
| 6060 | RLOGD("radio::restrictedStateChangedInd: state %d", state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6061 | Return<void> retStatus = radioService[slotId]->mRadioIndication->restrictedStateChanged( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6062 | convertIntToRadioIndicationType(indicationType), (PhoneRestrictedState) state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6063 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6064 | } else { |
| 6065 | RLOGE("radio::restrictedStateChangedInd: radioService[%d]->mRadioIndication == NULL", |
| 6066 | slotId); |
| 6067 | } |
| 6068 | |
| 6069 | return 0; |
| 6070 | } |
| 6071 | |
| 6072 | int radio::enterEmergencyCallbackModeInd(android::Parcel &p, int slotId, int requestNumber, |
| 6073 | int indicationType, int token, RIL_Errno e, void *response, |
| 6074 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6075 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6076 | RLOGD("radio::enterEmergencyCallbackModeInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6077 | Return<void> retStatus = radioService[slotId]->mRadioIndication->enterEmergencyCallbackMode( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6078 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6079 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6080 | } else { |
| 6081 | RLOGE("radio::enterEmergencyCallbackModeInd: radioService[%d]->mRadioIndication == NULL", |
| 6082 | slotId); |
| 6083 | } |
| 6084 | |
| 6085 | return 0; |
| 6086 | } |
| 6087 | |
| 6088 | int radio::cdmaCallWaitingInd(android::Parcel &p, int slotId, int requestNumber, |
| 6089 | int indicationType, int token, RIL_Errno e, void *response, |
| 6090 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6091 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6092 | if (response == NULL || responseLen != sizeof(RIL_CDMA_CallWaiting_v6)) { |
| 6093 | RLOGE("radio::cdmaCallWaitingInd: invalid response"); |
| 6094 | return 0; |
| 6095 | } |
| 6096 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6097 | CdmaCallWaiting callWaitingRecord = {}; |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6098 | RIL_CDMA_CallWaiting_v6 *callWaitingRil = ((RIL_CDMA_CallWaiting_v6 *) response); |
| 6099 | callWaitingRecord.number = convertCharPtrToHidlString(callWaitingRil->number); |
| 6100 | callWaitingRecord.numberPresentation = |
| 6101 | (CdmaCallWaitingNumberPresentation) callWaitingRil->numberPresentation; |
| 6102 | callWaitingRecord.name = convertCharPtrToHidlString(callWaitingRil->name); |
| 6103 | convertRilCdmaSignalInfoRecordToHal(&callWaitingRil->signalInfoRecord, |
| 6104 | callWaitingRecord.signalInfoRecord); |
| 6105 | callWaitingRecord.numberType = (CdmaCallWaitingNumberType) callWaitingRil->number_type; |
| 6106 | callWaitingRecord.numberPlan = (CdmaCallWaitingNumberPlan) callWaitingRil->number_plan; |
| 6107 | |
| 6108 | RLOGD("radio::cdmaCallWaitingInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6109 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaCallWaiting( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6110 | convertIntToRadioIndicationType(indicationType), callWaitingRecord); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6111 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6112 | } else { |
| 6113 | RLOGE("radio::cdmaCallWaitingInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6114 | } |
| 6115 | |
| 6116 | return 0; |
| 6117 | } |
| 6118 | |
| 6119 | int radio::cdmaOtaProvisionStatusInd(android::Parcel &p, int slotId, int requestNumber, |
| 6120 | int indicationType, int token, RIL_Errno e, void *response, |
| 6121 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6122 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6123 | if (response == NULL || responseLen != sizeof(int)) { |
| 6124 | RLOGE("radio::cdmaOtaProvisionStatusInd: invalid response"); |
| 6125 | return 0; |
| 6126 | } |
| 6127 | int32_t status = ((int32_t *) response)[0]; |
| 6128 | RLOGD("radio::cdmaOtaProvisionStatusInd: status %d", status); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6129 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaOtaProvisionStatus( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6130 | convertIntToRadioIndicationType(indicationType), (CdmaOtaProvisionStatus) status); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6131 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6132 | } else { |
| 6133 | RLOGE("radio::cdmaOtaProvisionStatusInd: radioService[%d]->mRadioIndication == NULL", |
| 6134 | slotId); |
| 6135 | } |
| 6136 | |
| 6137 | return 0; |
| 6138 | } |
| 6139 | |
| 6140 | int radio::cdmaInfoRecInd(android::Parcel &p, int slotId, int requestNumber, |
| 6141 | int indicationType, int token, RIL_Errno e, void *response, |
| 6142 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6143 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6144 | if (response == NULL || responseLen != sizeof(RIL_CDMA_InformationRecords)) { |
| 6145 | RLOGE("radio::cdmaInfoRecInd: invalid response"); |
| 6146 | return 0; |
| 6147 | } |
| 6148 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6149 | CdmaInformationRecords records = {}; |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6150 | RIL_CDMA_InformationRecords *recordsRil = (RIL_CDMA_InformationRecords *) response; |
| 6151 | |
| 6152 | char* string8 = NULL; |
| 6153 | int num = MIN(recordsRil->numberOfInfoRecs, RIL_CDMA_MAX_NUMBER_OF_INFO_RECS); |
| 6154 | if (recordsRil->numberOfInfoRecs > RIL_CDMA_MAX_NUMBER_OF_INFO_RECS) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6155 | RLOGE("radio::cdmaInfoRecInd: received %d recs which is more than %d, dropping " |
| 6156 | "additional ones", recordsRil->numberOfInfoRecs, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6157 | RIL_CDMA_MAX_NUMBER_OF_INFO_RECS); |
| 6158 | } |
| 6159 | records.infoRec.resize(num); |
| 6160 | for (int i = 0 ; i < num ; i++) { |
| 6161 | CdmaInformationRecord *record = &records.infoRec[i]; |
| 6162 | RIL_CDMA_InformationRecord *infoRec = &recordsRil->infoRec[i]; |
| 6163 | record->name = (CdmaInfoRecName) infoRec->name; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6164 | // All vectors should be size 0 except one which will be size 1. Set everything to |
| 6165 | // size 0 initially. |
| 6166 | record->display.resize(0); |
| 6167 | record->number.resize(0); |
| 6168 | record->signal.resize(0); |
| 6169 | record->redir.resize(0); |
| 6170 | record->lineCtrl.resize(0); |
| 6171 | record->clir.resize(0); |
| 6172 | record->audioCtrl.resize(0); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6173 | switch (infoRec->name) { |
| 6174 | case RIL_CDMA_DISPLAY_INFO_REC: |
| 6175 | case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: { |
| 6176 | if (infoRec->rec.display.alpha_len > CDMA_ALPHA_INFO_BUFFER_LENGTH) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6177 | RLOGE("radio::cdmaInfoRecInd: invalid display info response length %d " |
| 6178 | "expected not more than %d", (int) infoRec->rec.display.alpha_len, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6179 | CDMA_ALPHA_INFO_BUFFER_LENGTH); |
| 6180 | return 0; |
| 6181 | } |
| 6182 | string8 = (char*) malloc((infoRec->rec.display.alpha_len + 1) * sizeof(char)); |
| 6183 | if (string8 == NULL) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6184 | RLOGE("radio::cdmaInfoRecInd: Memory allocation failed for " |
| 6185 | "responseCdmaInformationRecords"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6186 | return 0; |
| 6187 | } |
| 6188 | memcpy(string8, infoRec->rec.display.alpha_buf, infoRec->rec.display.alpha_len); |
| 6189 | string8[(int)infoRec->rec.display.alpha_len] = '\0'; |
| 6190 | |
| 6191 | record->display.resize(1); |
| 6192 | record->display[0].alphaBuf = string8; |
| 6193 | free(string8); |
| 6194 | string8 = NULL; |
| 6195 | break; |
| 6196 | } |
| 6197 | |
| 6198 | case RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: |
| 6199 | case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: |
| 6200 | case RIL_CDMA_CONNECTED_NUMBER_INFO_REC: { |
| 6201 | if (infoRec->rec.number.len > CDMA_NUMBER_INFO_BUFFER_LENGTH) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6202 | RLOGE("radio::cdmaInfoRecInd: invalid display info response length %d " |
| 6203 | "expected not more than %d", (int) infoRec->rec.number.len, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6204 | CDMA_NUMBER_INFO_BUFFER_LENGTH); |
| 6205 | return 0; |
| 6206 | } |
| 6207 | string8 = (char*) malloc((infoRec->rec.number.len + 1) * sizeof(char)); |
| 6208 | if (string8 == NULL) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6209 | RLOGE("radio::cdmaInfoRecInd: Memory allocation failed for " |
| 6210 | "responseCdmaInformationRecords"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6211 | return 0; |
| 6212 | } |
| 6213 | memcpy(string8, infoRec->rec.number.buf, infoRec->rec.number.len); |
| 6214 | string8[(int)infoRec->rec.number.len] = '\0'; |
| 6215 | |
| 6216 | record->number.resize(1); |
| 6217 | record->number[0].number = string8; |
| 6218 | free(string8); |
| 6219 | string8 = NULL; |
| 6220 | record->number[0].numberType = infoRec->rec.number.number_type; |
| 6221 | record->number[0].numberPlan = infoRec->rec.number.number_plan; |
| 6222 | record->number[0].pi = infoRec->rec.number.pi; |
| 6223 | record->number[0].si = infoRec->rec.number.si; |
| 6224 | break; |
| 6225 | } |
| 6226 | |
| 6227 | case RIL_CDMA_SIGNAL_INFO_REC: { |
| 6228 | record->signal.resize(1); |
| 6229 | record->signal[0].isPresent = infoRec->rec.signal.isPresent; |
| 6230 | record->signal[0].signalType = infoRec->rec.signal.signalType; |
| 6231 | record->signal[0].alertPitch = infoRec->rec.signal.alertPitch; |
| 6232 | record->signal[0].signal = infoRec->rec.signal.signal; |
| 6233 | break; |
| 6234 | } |
| 6235 | |
| 6236 | case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: { |
| 6237 | if (infoRec->rec.redir.redirectingNumber.len > |
| 6238 | CDMA_NUMBER_INFO_BUFFER_LENGTH) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6239 | RLOGE("radio::cdmaInfoRecInd: invalid display info response length %d " |
| 6240 | "expected not more than %d\n", |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6241 | (int)infoRec->rec.redir.redirectingNumber.len, |
| 6242 | CDMA_NUMBER_INFO_BUFFER_LENGTH); |
| 6243 | return 0; |
| 6244 | } |
| 6245 | string8 = (char*) malloc((infoRec->rec.redir.redirectingNumber.len + 1) * |
| 6246 | sizeof(char)); |
| 6247 | if (string8 == NULL) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6248 | RLOGE("radio::cdmaInfoRecInd: Memory allocation failed for " |
| 6249 | "responseCdmaInformationRecords"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6250 | return 0; |
| 6251 | } |
| 6252 | memcpy(string8, infoRec->rec.redir.redirectingNumber.buf, |
| 6253 | infoRec->rec.redir.redirectingNumber.len); |
| 6254 | string8[(int)infoRec->rec.redir.redirectingNumber.len] = '\0'; |
| 6255 | |
| 6256 | record->redir.resize(1); |
| 6257 | record->redir[0].redirectingNumber.number = string8; |
| 6258 | free(string8); |
| 6259 | string8 = NULL; |
| 6260 | record->redir[0].redirectingNumber.numberType = |
| 6261 | infoRec->rec.redir.redirectingNumber.number_type; |
| 6262 | record->redir[0].redirectingNumber.numberPlan = |
| 6263 | infoRec->rec.redir.redirectingNumber.number_plan; |
| 6264 | record->redir[0].redirectingNumber.pi = infoRec->rec.redir.redirectingNumber.pi; |
| 6265 | record->redir[0].redirectingNumber.si = infoRec->rec.redir.redirectingNumber.si; |
| 6266 | record->redir[0].redirectingReason = |
| 6267 | (CdmaRedirectingReason) infoRec->rec.redir.redirectingReason; |
| 6268 | break; |
| 6269 | } |
| 6270 | |
| 6271 | case RIL_CDMA_LINE_CONTROL_INFO_REC: { |
| 6272 | record->lineCtrl.resize(1); |
| 6273 | record->lineCtrl[0].lineCtrlPolarityIncluded = |
| 6274 | infoRec->rec.lineCtrl.lineCtrlPolarityIncluded; |
| 6275 | record->lineCtrl[0].lineCtrlToggle = infoRec->rec.lineCtrl.lineCtrlToggle; |
| 6276 | record->lineCtrl[0].lineCtrlReverse = infoRec->rec.lineCtrl.lineCtrlReverse; |
| 6277 | record->lineCtrl[0].lineCtrlPowerDenial = |
| 6278 | infoRec->rec.lineCtrl.lineCtrlPowerDenial; |
| 6279 | break; |
| 6280 | } |
| 6281 | |
| 6282 | case RIL_CDMA_T53_CLIR_INFO_REC: { |
| 6283 | record->clir.resize(1); |
| 6284 | record->clir[0].cause = infoRec->rec.clir.cause; |
| 6285 | break; |
| 6286 | } |
| 6287 | |
| 6288 | case RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: { |
| 6289 | record->audioCtrl.resize(1); |
| 6290 | record->audioCtrl[0].upLink = infoRec->rec.audioCtrl.upLink; |
| 6291 | record->audioCtrl[0].downLink = infoRec->rec.audioCtrl.downLink; |
| 6292 | break; |
| 6293 | } |
| 6294 | |
| 6295 | case RIL_CDMA_T53_RELEASE_INFO_REC: |
| 6296 | RLOGE("radio::cdmaInfoRecInd: RIL_CDMA_T53_RELEASE_INFO_REC: INVALID"); |
| 6297 | return 0; |
| 6298 | |
| 6299 | default: |
| 6300 | RLOGE("radio::cdmaInfoRecInd: Incorrect name value"); |
| 6301 | return 0; |
| 6302 | } |
| 6303 | } |
| 6304 | |
| 6305 | RLOGD("radio::cdmaInfoRecInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6306 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaInfoRec( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6307 | convertIntToRadioIndicationType(indicationType), records); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6308 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6309 | } else { |
| 6310 | RLOGE("radio::cdmaInfoRecInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6311 | } |
| 6312 | |
| 6313 | return 0; |
| 6314 | } |
| 6315 | |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6316 | int radio::indicateRingbackToneInd(android::Parcel &p, int slotId, int requestNumber, |
| 6317 | int indicationType, int token, RIL_Errno e, void *response, |
| 6318 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6319 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6320 | if (response == NULL || responseLen != sizeof(int)) { |
| 6321 | RLOGE("radio::indicateRingbackToneInd: invalid response"); |
| 6322 | return 0; |
| 6323 | } |
| 6324 | bool start = ((int32_t *) response)[0]; |
| 6325 | RLOGD("radio::indicateRingbackToneInd: start %d", start); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6326 | Return<void> retStatus = radioService[slotId]->mRadioIndication->indicateRingbackTone( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6327 | convertIntToRadioIndicationType(indicationType), start); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6328 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6329 | } else { |
| 6330 | RLOGE("radio::indicateRingbackToneInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6331 | } |
| 6332 | |
| 6333 | return 0; |
| 6334 | } |
| 6335 | |
| 6336 | int radio::resendIncallMuteInd(android::Parcel &p, int slotId, int requestNumber, |
| 6337 | int indicationType, int token, RIL_Errno e, void *response, |
| 6338 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6339 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6340 | RLOGD("radio::resendIncallMuteInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6341 | Return<void> retStatus = radioService[slotId]->mRadioIndication->resendIncallMute( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6342 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6343 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6344 | } else { |
| 6345 | RLOGE("radio::resendIncallMuteInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6346 | } |
| 6347 | |
| 6348 | return 0; |
| 6349 | } |
| 6350 | |
| 6351 | int radio::cdmaSubscriptionSourceChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6352 | int indicationType, int token, RIL_Errno e, |
| 6353 | void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6354 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6355 | if (response == NULL || responseLen != sizeof(int)) { |
| 6356 | RLOGE("radio::cdmaSubscriptionSourceChangedInd: invalid response"); |
| 6357 | return 0; |
| 6358 | } |
| 6359 | int32_t cdmaSource = ((int32_t *) response)[0]; |
| 6360 | RLOGD("radio::cdmaSubscriptionSourceChangedInd: cdmaSource %d", cdmaSource); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6361 | Return<void> retStatus = radioService[slotId]->mRadioIndication-> |
| 6362 | cdmaSubscriptionSourceChanged(convertIntToRadioIndicationType(indicationType), |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6363 | (CdmaSubscriptionSource) cdmaSource); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6364 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6365 | } else { |
| 6366 | RLOGE("radio::cdmaSubscriptionSourceChangedInd: radioService[%d]->mRadioIndication == NULL", |
| 6367 | slotId); |
| 6368 | } |
| 6369 | |
| 6370 | return 0; |
| 6371 | } |
| 6372 | |
| 6373 | int radio::cdmaPrlChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6374 | int indicationType, int token, RIL_Errno e, void *response, |
| 6375 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6376 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6377 | if (response == NULL || responseLen != sizeof(int)) { |
| 6378 | RLOGE("radio::cdmaPrlChangedInd: invalid response"); |
| 6379 | return 0; |
| 6380 | } |
| 6381 | int32_t version = ((int32_t *) response)[0]; |
| 6382 | RLOGD("radio::cdmaPrlChangedInd: version %d", version); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6383 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaPrlChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6384 | convertIntToRadioIndicationType(indicationType), version); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6385 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6386 | } else { |
| 6387 | RLOGE("radio::cdmaPrlChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6388 | } |
| 6389 | |
| 6390 | return 0; |
| 6391 | } |
| 6392 | |
| 6393 | int radio::exitEmergencyCallbackModeInd(android::Parcel &p, int slotId, int requestNumber, |
| 6394 | int indicationType, int token, RIL_Errno e, void *response, |
| 6395 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6396 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6397 | RLOGD("radio::exitEmergencyCallbackModeInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6398 | Return<void> retStatus = radioService[slotId]->mRadioIndication->exitEmergencyCallbackMode( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6399 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6400 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6401 | } else { |
| 6402 | RLOGE("radio::exitEmergencyCallbackModeInd: radioService[%d]->mRadioIndication == NULL", |
| 6403 | slotId); |
| 6404 | } |
| 6405 | |
| 6406 | return 0; |
| 6407 | } |
| 6408 | |
| 6409 | int radio::rilConnectedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6410 | int indicationType, int token, RIL_Errno e, void *response, |
| 6411 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6412 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6413 | RLOGD("radio::rilConnectedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6414 | Return<void> retStatus = radioService[slotId]->mRadioIndication->rilConnected( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6415 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6416 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6417 | } else { |
| 6418 | RLOGE("radio::rilConnectedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6419 | } |
| 6420 | |
| 6421 | return 0; |
| 6422 | } |
| 6423 | |
| 6424 | int radio::voiceRadioTechChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6425 | int indicationType, int token, RIL_Errno e, void *response, |
| 6426 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6427 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6428 | if (response == NULL || responseLen != sizeof(int)) { |
| 6429 | RLOGE("radio::voiceRadioTechChangedInd: invalid response"); |
| 6430 | return 0; |
| 6431 | } |
| 6432 | int32_t rat = ((int32_t *) response)[0]; |
| 6433 | RLOGD("radio::voiceRadioTechChangedInd: rat %d", rat); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6434 | Return<void> retStatus = radioService[slotId]->mRadioIndication->voiceRadioTechChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6435 | convertIntToRadioIndicationType(indicationType), (RadioTechnology) rat); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6436 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6437 | } else { |
| 6438 | RLOGE("radio::voiceRadioTechChangedInd: radioService[%d]->mRadioIndication == NULL", |
| 6439 | slotId); |
| 6440 | } |
| 6441 | |
| 6442 | return 0; |
| 6443 | } |
| 6444 | |
| 6445 | void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<CellInfo>& records) { |
| 6446 | int num = responseLen / sizeof(RIL_CellInfo_v12); |
| 6447 | records.resize(num); |
| 6448 | |
| 6449 | RIL_CellInfo_v12 *rillCellInfo = (RIL_CellInfo_v12 *) response; |
| 6450 | for (int i = 0; i < num; i++) { |
| 6451 | records[i].cellInfoType = (CellInfoType) rillCellInfo->cellInfoType; |
| 6452 | records[i].registered = rillCellInfo->registered; |
| 6453 | records[i].timeStampType = (TimeStampType) rillCellInfo->timeStampType; |
| 6454 | records[i].timeStamp = rillCellInfo->timeStamp; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6455 | // All vectors should be size 0 except one which will be size 1. Set everything to |
| 6456 | // size 0 initially. |
| 6457 | records[i].gsm.resize(0); |
| 6458 | records[i].wcdma.resize(0); |
| 6459 | records[i].cdma.resize(0); |
| 6460 | records[i].lte.resize(0); |
| 6461 | records[i].tdscdma.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6462 | switch(rillCellInfo->cellInfoType) { |
| 6463 | case RIL_CELL_INFO_TYPE_GSM: { |
| 6464 | records[i].gsm.resize(1); |
| 6465 | CellInfoGsm *cellInfoGsm = &records[i].gsm[0]; |
| 6466 | cellInfoGsm->cellIdentityGsm.mcc = |
| 6467 | std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mcc); |
| 6468 | cellInfoGsm->cellIdentityGsm.mnc = |
| 6469 | std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mnc); |
| 6470 | cellInfoGsm->cellIdentityGsm.lac = |
| 6471 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.lac; |
| 6472 | cellInfoGsm->cellIdentityGsm.cid = |
| 6473 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.cid; |
| 6474 | cellInfoGsm->cellIdentityGsm.arfcn = |
| 6475 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.arfcn; |
| 6476 | cellInfoGsm->cellIdentityGsm.bsic = |
| 6477 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.bsic; |
| 6478 | cellInfoGsm->signalStrengthGsm.signalStrength = |
| 6479 | rillCellInfo->CellInfo.gsm.signalStrengthGsm.signalStrength; |
| 6480 | cellInfoGsm->signalStrengthGsm.bitErrorRate = |
| 6481 | rillCellInfo->CellInfo.gsm.signalStrengthGsm.bitErrorRate; |
| 6482 | cellInfoGsm->signalStrengthGsm.timingAdvance = |
| 6483 | rillCellInfo->CellInfo.gsm.signalStrengthGsm.timingAdvance; |
| 6484 | break; |
| 6485 | } |
| 6486 | |
| 6487 | case RIL_CELL_INFO_TYPE_WCDMA: { |
| 6488 | records[i].wcdma.resize(1); |
| 6489 | CellInfoWcdma *cellInfoWcdma = &records[i].wcdma[0]; |
| 6490 | cellInfoWcdma->cellIdentityWcdma.mcc = |
| 6491 | std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mcc); |
| 6492 | cellInfoWcdma->cellIdentityWcdma.mnc = |
| 6493 | std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mnc); |
| 6494 | cellInfoWcdma->cellIdentityWcdma.lac = |
| 6495 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.lac; |
| 6496 | cellInfoWcdma->cellIdentityWcdma.cid = |
| 6497 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.cid; |
| 6498 | cellInfoWcdma->cellIdentityWcdma.psc = |
| 6499 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.psc; |
| 6500 | cellInfoWcdma->cellIdentityWcdma.uarfcn = |
| 6501 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.uarfcn; |
| 6502 | cellInfoWcdma->signalStrengthWcdma.signalStrength = |
| 6503 | rillCellInfo->CellInfo.wcdma.signalStrengthWcdma.signalStrength; |
| 6504 | cellInfoWcdma->signalStrengthWcdma.bitErrorRate = |
| 6505 | rillCellInfo->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate; |
| 6506 | break; |
| 6507 | } |
| 6508 | |
| 6509 | case RIL_CELL_INFO_TYPE_CDMA: { |
| 6510 | records[i].cdma.resize(1); |
| 6511 | CellInfoCdma *cellInfoCdma = &records[i].cdma[0]; |
| 6512 | cellInfoCdma->cellIdentityCdma.networkId = |
| 6513 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.networkId; |
| 6514 | cellInfoCdma->cellIdentityCdma.systemId = |
| 6515 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.systemId; |
| 6516 | cellInfoCdma->cellIdentityCdma.baseStationId = |
| 6517 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.basestationId; |
| 6518 | cellInfoCdma->cellIdentityCdma.longitude = |
| 6519 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.longitude; |
| 6520 | cellInfoCdma->cellIdentityCdma.latitude = |
| 6521 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.latitude; |
| 6522 | cellInfoCdma->signalStrengthCdma.dbm = |
| 6523 | rillCellInfo->CellInfo.cdma.signalStrengthCdma.dbm; |
| 6524 | cellInfoCdma->signalStrengthCdma.ecio = |
| 6525 | rillCellInfo->CellInfo.cdma.signalStrengthCdma.ecio; |
| 6526 | cellInfoCdma->signalStrengthEvdo.dbm = |
| 6527 | rillCellInfo->CellInfo.cdma.signalStrengthEvdo.dbm; |
| 6528 | cellInfoCdma->signalStrengthEvdo.ecio = |
| 6529 | rillCellInfo->CellInfo.cdma.signalStrengthEvdo.ecio; |
| 6530 | cellInfoCdma->signalStrengthEvdo.signalNoiseRatio = |
| 6531 | rillCellInfo->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio; |
| 6532 | break; |
| 6533 | } |
| 6534 | |
| 6535 | case RIL_CELL_INFO_TYPE_LTE: { |
| 6536 | records[i].lte.resize(1); |
| 6537 | CellInfoLte *cellInfoLte = &records[i].lte[0]; |
| 6538 | cellInfoLte->cellIdentityLte.mcc = |
| 6539 | std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mcc); |
| 6540 | cellInfoLte->cellIdentityLte.mnc = |
| 6541 | std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mnc); |
| 6542 | cellInfoLte->cellIdentityLte.ci = |
| 6543 | rillCellInfo->CellInfo.lte.cellIdentityLte.ci; |
| 6544 | cellInfoLte->cellIdentityLte.pci = |
| 6545 | rillCellInfo->CellInfo.lte.cellIdentityLte.pci; |
| 6546 | cellInfoLte->cellIdentityLte.tac = |
| 6547 | rillCellInfo->CellInfo.lte.cellIdentityLte.tac; |
| 6548 | cellInfoLte->cellIdentityLte.earfcn = |
| 6549 | rillCellInfo->CellInfo.lte.cellIdentityLte.earfcn; |
| 6550 | cellInfoLte->signalStrengthLte.signalStrength = |
| 6551 | rillCellInfo->CellInfo.lte.signalStrengthLte.signalStrength; |
| 6552 | cellInfoLte->signalStrengthLte.rsrp = |
| 6553 | rillCellInfo->CellInfo.lte.signalStrengthLte.rsrp; |
| 6554 | cellInfoLte->signalStrengthLte.rsrq = |
| 6555 | rillCellInfo->CellInfo.lte.signalStrengthLte.rsrq; |
| 6556 | cellInfoLte->signalStrengthLte.rssnr = |
| 6557 | rillCellInfo->CellInfo.lte.signalStrengthLte.rssnr; |
| 6558 | cellInfoLte->signalStrengthLte.cqi = |
| 6559 | rillCellInfo->CellInfo.lte.signalStrengthLte.cqi; |
| 6560 | cellInfoLte->signalStrengthLte.timingAdvance = |
| 6561 | rillCellInfo->CellInfo.lte.signalStrengthLte.timingAdvance; |
| 6562 | break; |
| 6563 | } |
| 6564 | |
| 6565 | case RIL_CELL_INFO_TYPE_TD_SCDMA: { |
| 6566 | records[i].tdscdma.resize(1); |
| 6567 | CellInfoTdscdma *cellInfoTdscdma = &records[i].tdscdma[0]; |
| 6568 | cellInfoTdscdma->cellIdentityTdscdma.mcc = |
| 6569 | std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mcc); |
| 6570 | cellInfoTdscdma->cellIdentityTdscdma.mnc = |
| 6571 | std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mnc); |
| 6572 | cellInfoTdscdma->cellIdentityTdscdma.lac = |
| 6573 | rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.lac; |
| 6574 | cellInfoTdscdma->cellIdentityTdscdma.cid = |
| 6575 | rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.cid; |
| 6576 | cellInfoTdscdma->cellIdentityTdscdma.cpid = |
| 6577 | rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.cpid; |
| 6578 | cellInfoTdscdma->signalStrengthTdscdma.rscp = |
| 6579 | rillCellInfo->CellInfo.tdscdma.signalStrengthTdscdma.rscp; |
| 6580 | break; |
| 6581 | } |
| 6582 | } |
| 6583 | rillCellInfo += 1; |
| 6584 | } |
| 6585 | } |
| 6586 | |
| 6587 | int radio::cellInfoListInd(android::Parcel &p, int slotId, int requestNumber, |
| 6588 | int indicationType, int token, RIL_Errno e, void *response, |
| 6589 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6590 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6591 | if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { |
| 6592 | RLOGE("radio::cellInfoListInd: invalid response"); |
| 6593 | return 0; |
| 6594 | } |
| 6595 | |
| 6596 | hidl_vec<CellInfo> records; |
| 6597 | convertRilCellInfoListToHal(response, responseLen, records); |
| 6598 | |
| 6599 | RLOGD("radio::cellInfoListInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6600 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cellInfoList( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6601 | convertIntToRadioIndicationType(indicationType), records); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6602 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6603 | } else { |
| 6604 | RLOGE("radio::cellInfoListInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6605 | } |
| 6606 | |
| 6607 | return 0; |
| 6608 | } |
| 6609 | |
| 6610 | int radio::imsNetworkStateChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6611 | int indicationType, int token, RIL_Errno e, void *response, |
| 6612 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6613 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6614 | RLOGD("radio::imsNetworkStateChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6615 | Return<void> retStatus = radioService[slotId]->mRadioIndication->imsNetworkStateChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6616 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6617 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6618 | } else { |
| 6619 | RLOGE("radio::imsNetworkStateChangedInd: radioService[%d]->mRadioIndication == NULL", |
| 6620 | slotId); |
| 6621 | } |
| 6622 | |
| 6623 | return 0; |
| 6624 | } |
| 6625 | |
| 6626 | int radio::subscriptionStatusChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6627 | int indicationType, int token, RIL_Errno e, void *response, |
| 6628 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6629 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6630 | if (response == NULL || responseLen != sizeof(int)) { |
| 6631 | RLOGE("radio::subscriptionStatusChangedInd: invalid response"); |
| 6632 | return 0; |
| 6633 | } |
| 6634 | bool activate = ((int32_t *) response)[0]; |
| 6635 | RLOGD("radio::subscriptionStatusChangedInd: activate %d", activate); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6636 | Return<void> retStatus = radioService[slotId]->mRadioIndication->subscriptionStatusChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6637 | convertIntToRadioIndicationType(indicationType), activate); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6638 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6639 | } else { |
| 6640 | RLOGE("radio::subscriptionStatusChangedInd: radioService[%d]->mRadioIndication == NULL", |
| 6641 | slotId); |
| 6642 | } |
| 6643 | |
| 6644 | return 0; |
| 6645 | } |
| 6646 | |
| 6647 | int radio::srvccStateNotifyInd(android::Parcel &p, int slotId, int requestNumber, |
| 6648 | int indicationType, int token, RIL_Errno e, void *response, |
| 6649 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6650 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6651 | if (response == NULL || responseLen != sizeof(int)) { |
| 6652 | RLOGE("radio::srvccStateNotifyInd: invalid response"); |
| 6653 | return 0; |
| 6654 | } |
| 6655 | int32_t state = ((int32_t *) response)[0]; |
| 6656 | RLOGD("radio::srvccStateNotifyInd: rat %d", state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6657 | Return<void> retStatus = radioService[slotId]->mRadioIndication->srvccStateNotify( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6658 | convertIntToRadioIndicationType(indicationType), (SrvccState) state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6659 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6660 | } else { |
| 6661 | RLOGE("radio::srvccStateNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6662 | } |
| 6663 | |
| 6664 | return 0; |
| 6665 | } |
| 6666 | |
| 6667 | void convertRilHardwareConfigListToHal(void *response, size_t responseLen, |
| 6668 | hidl_vec<HardwareConfig>& records) { |
| 6669 | int num = responseLen / sizeof(RIL_HardwareConfig); |
| 6670 | records.resize(num); |
| 6671 | |
| 6672 | RIL_HardwareConfig *rilHardwareConfig = (RIL_HardwareConfig *) response; |
| 6673 | for (int i = 0; i < num; i++) { |
| 6674 | records[i].type = (HardwareConfigType) rilHardwareConfig[i].type; |
| 6675 | records[i].uuid = convertCharPtrToHidlString(rilHardwareConfig[i].uuid); |
| 6676 | records[i].state = (HardwareConfigState) rilHardwareConfig[i].state; |
| 6677 | switch (rilHardwareConfig[i].type) { |
| 6678 | case RIL_HARDWARE_CONFIG_MODEM: { |
| 6679 | records[i].modem.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6680 | records[i].sim.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6681 | HardwareConfigModem *hwConfigModem = &records[i].modem[0]; |
| 6682 | hwConfigModem->rat = rilHardwareConfig[i].cfg.modem.rat; |
| 6683 | hwConfigModem->maxVoice = rilHardwareConfig[i].cfg.modem.maxVoice; |
| 6684 | hwConfigModem->maxData = rilHardwareConfig[i].cfg.modem.maxData; |
| 6685 | hwConfigModem->maxStandby = rilHardwareConfig[i].cfg.modem.maxStandby; |
| 6686 | break; |
| 6687 | } |
| 6688 | |
| 6689 | case RIL_HARDWARE_CONFIG_SIM: { |
| 6690 | records[i].sim.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6691 | records[i].modem.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6692 | records[i].sim[0].modemUuid = |
| 6693 | convertCharPtrToHidlString(rilHardwareConfig[i].cfg.sim.modemUuid); |
| 6694 | break; |
| 6695 | } |
| 6696 | } |
| 6697 | } |
| 6698 | } |
| 6699 | |
| 6700 | int radio::hardwareConfigChangedInd(android::Parcel &p, int slotId, int requestNumber, |
| 6701 | int indicationType, int token, RIL_Errno e, void *response, |
| 6702 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6703 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6704 | if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { |
| 6705 | RLOGE("radio::hardwareConfigChangedInd: invalid response"); |
| 6706 | return 0; |
| 6707 | } |
| 6708 | |
| 6709 | hidl_vec<HardwareConfig> configs; |
| 6710 | convertRilHardwareConfigListToHal(response, responseLen, configs); |
| 6711 | |
| 6712 | RLOGD("radio::hardwareConfigChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6713 | Return<void> retStatus = radioService[slotId]->mRadioIndication->hardwareConfigChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6714 | convertIntToRadioIndicationType(indicationType), configs); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6715 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6716 | } else { |
| 6717 | RLOGE("radio::hardwareConfigChangedInd: radioService[%d]->mRadioIndication == NULL", |
| 6718 | slotId); |
| 6719 | } |
| 6720 | |
| 6721 | return 0; |
| 6722 | } |
| 6723 | |
| 6724 | void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc) { |
| 6725 | RIL_RadioCapability *rilRadioCapability = (RIL_RadioCapability *) response; |
| 6726 | rc.session = rilRadioCapability->session; |
| 6727 | rc.phase = (android::hardware::radio::V1_0::RadioCapabilityPhase) rilRadioCapability->phase; |
| 6728 | rc.raf = rilRadioCapability->rat; |
| 6729 | rc.logicalModemUuid = convertCharPtrToHidlString(rilRadioCapability->logicalModemUuid); |
| 6730 | rc.status = (android::hardware::radio::V1_0::RadioCapabilityStatus) rilRadioCapability->status; |
| 6731 | } |
| 6732 | |
| 6733 | int radio::radioCapabilityIndicationInd(android::Parcel &p, int slotId, int requestNumber, |
| 6734 | int indicationType, int token, RIL_Errno e, void *response, |
| 6735 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6736 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6737 | if (response == NULL || responseLen != sizeof(RIL_RadioCapability)) { |
| 6738 | RLOGE("radio::radioCapabilityIndicationInd: invalid response"); |
| 6739 | return 0; |
| 6740 | } |
| 6741 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6742 | RadioCapability rc = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6743 | convertRilRadioCapabilityToHal(response, responseLen, rc); |
| 6744 | |
| 6745 | RLOGD("radio::radioCapabilityIndicationInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6746 | Return<void> retStatus = radioService[slotId]->mRadioIndication->radioCapabilityIndication( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6747 | convertIntToRadioIndicationType(indicationType), rc); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6748 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6749 | } else { |
| 6750 | RLOGE("radio::radioCapabilityIndicationInd: radioService[%d]->mRadioIndication == NULL", |
| 6751 | slotId); |
| 6752 | } |
| 6753 | |
| 6754 | return 0; |
| 6755 | } |
| 6756 | |
| 6757 | bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType) { |
| 6758 | if ((reqType == SS_INTERROGATION) && |
| 6759 | (serType == SS_CFU || |
| 6760 | serType == SS_CF_BUSY || |
| 6761 | serType == SS_CF_NO_REPLY || |
| 6762 | serType == SS_CF_NOT_REACHABLE || |
| 6763 | serType == SS_CF_ALL || |
| 6764 | serType == SS_CF_ALL_CONDITIONAL)) { |
| 6765 | return true; |
| 6766 | } |
| 6767 | return false; |
| 6768 | } |
| 6769 | |
| 6770 | int radio::onSupplementaryServiceIndicationInd(android::Parcel &p, int slotId, int requestNumber, |
| 6771 | int indicationType, int token, RIL_Errno e, |
| 6772 | void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6773 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6774 | if (response == NULL || responseLen != sizeof(RIL_StkCcUnsolSsResponse)) { |
| 6775 | RLOGE("radio::onSupplementaryServiceIndicationInd: invalid response"); |
| 6776 | return 0; |
| 6777 | } |
| 6778 | |
| 6779 | RIL_StkCcUnsolSsResponse *rilSsResponse = (RIL_StkCcUnsolSsResponse *) response; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6780 | StkCcUnsolSsResult ss = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6781 | ss.serviceType = (SsServiceType) rilSsResponse->serviceType; |
| 6782 | ss.requestType = (SsRequestType) rilSsResponse->requestType; |
| 6783 | ss.teleserviceType = (SsTeleserviceType) rilSsResponse->teleserviceType; |
| 6784 | ss.serviceClass = rilSsResponse->serviceClass; |
| 6785 | ss.result = (RadioError) rilSsResponse->result; |
| 6786 | |
| 6787 | if (isServiceTypeCfQuery(rilSsResponse->serviceType, rilSsResponse->requestType)) { |
| 6788 | RLOGD("radio::onSupplementaryServiceIndicationInd CF type, num of Cf elements %d", |
| 6789 | rilSsResponse->cfData.numValidIndexes); |
| 6790 | if (rilSsResponse->cfData.numValidIndexes > NUM_SERVICE_CLASSES) { |
| 6791 | RLOGE("radio::onSupplementaryServiceIndicationInd numValidIndexes is greater than " |
| 6792 | "max value %d, truncating it to max value", NUM_SERVICE_CLASSES); |
| 6793 | rilSsResponse->cfData.numValidIndexes = NUM_SERVICE_CLASSES; |
| 6794 | } |
| 6795 | |
| 6796 | ss.cfData.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6797 | ss.ssInfo.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6798 | |
| 6799 | /* number of call info's */ |
| 6800 | ss.cfData[0].cfInfo.resize(rilSsResponse->cfData.numValidIndexes); |
| 6801 | |
| 6802 | for (int i = 0; i < rilSsResponse->cfData.numValidIndexes; i++) { |
| 6803 | RIL_CallForwardInfo cf = rilSsResponse->cfData.cfInfo[i]; |
| 6804 | CallForwardInfo *cfInfo = &ss.cfData[0].cfInfo[i]; |
| 6805 | |
| 6806 | cfInfo->status = (CallForwardInfoStatus) cf.status; |
| 6807 | cfInfo->reason = cf.reason; |
| 6808 | cfInfo->serviceClass = cf.serviceClass; |
| 6809 | cfInfo->toa = cf.toa; |
| 6810 | cfInfo->number = convertCharPtrToHidlString(cf.number); |
| 6811 | cfInfo->timeSeconds = cf.timeSeconds; |
| 6812 | RLOGD("radio::onSupplementaryServiceIndicationInd: " |
| 6813 | "Data: %d,reason=%d,cls=%d,toa=%d,num=%s,tout=%d],", cf.status, |
| 6814 | cf.reason, cf.serviceClass, cf.toa, (char*)cf.number, cf.timeSeconds); |
| 6815 | } |
| 6816 | } else { |
| 6817 | ss.ssInfo.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6818 | ss.cfData.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6819 | |
| 6820 | /* each int */ |
| 6821 | ss.ssInfo[0].ssInfo.resize(SS_INFO_MAX); |
| 6822 | for (int i = 0; i < SS_INFO_MAX; i++) { |
| 6823 | RLOGD("radio::onSupplementaryServiceIndicationInd: Data: %d", |
| 6824 | rilSsResponse->ssInfo[i]); |
| 6825 | ss.ssInfo[0].ssInfo[i] = rilSsResponse->ssInfo[i]; |
| 6826 | } |
| 6827 | } |
| 6828 | |
| 6829 | RLOGD("radio::onSupplementaryServiceIndicationInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6830 | Return<void> retStatus = radioService[slotId]->mRadioIndication-> |
| 6831 | onSupplementaryServiceIndication(convertIntToRadioIndicationType(indicationType), |
| 6832 | ss); |
| 6833 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6834 | } else { |
| 6835 | RLOGE("radio::onSupplementaryServiceIndicationInd: " |
| 6836 | "radioService[%d]->mRadioIndication == NULL", slotId); |
| 6837 | } |
| 6838 | |
| 6839 | return 0; |
| 6840 | } |
| 6841 | |
| 6842 | int radio::stkCallControlAlphaNotifyInd(android::Parcel &p, int slotId, int requestNumber, |
| 6843 | int indicationType, int token, RIL_Errno e, void *response, |
| 6844 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6845 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6846 | if (response == NULL || responseLen == 0) { |
| 6847 | RLOGE("radio::stkCallControlAlphaNotifyInd: invalid response"); |
| 6848 | return 0; |
| 6849 | } |
| 6850 | RLOGD("radio::stkCallControlAlphaNotifyInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6851 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkCallControlAlphaNotify( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6852 | convertIntToRadioIndicationType(indicationType), |
| 6853 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6854 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6855 | } else { |
| 6856 | RLOGE("radio::stkCallControlAlphaNotifyInd: radioService[%d]->mRadioIndication == NULL", |
| 6857 | slotId); |
| 6858 | } |
| 6859 | |
| 6860 | return 0; |
| 6861 | } |
| 6862 | |
| 6863 | void convertRilLceDataInfoToHal(void *response, size_t responseLen, LceDataInfo& lce) { |
| 6864 | RIL_LceDataInfo *rilLceDataInfo = (RIL_LceDataInfo *)response; |
| 6865 | lce.lastHopCapacityKbps = rilLceDataInfo->last_hop_capacity_kbps; |
| 6866 | lce.confidenceLevel = rilLceDataInfo->confidence_level; |
| 6867 | lce.lceSuspended = rilLceDataInfo->lce_suspended; |
| 6868 | } |
| 6869 | |
| 6870 | int radio::lceDataInd(android::Parcel &p, int slotId, int requestNumber, |
| 6871 | int indicationType, int token, RIL_Errno e, void *response, |
| 6872 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6873 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6874 | if (response == NULL || responseLen != sizeof(RIL_LceDataInfo)) { |
| 6875 | RLOGE("radio::lceDataInd: invalid response"); |
| 6876 | return 0; |
| 6877 | } |
| 6878 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6879 | LceDataInfo lce = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6880 | convertRilLceDataInfoToHal(response, responseLen, lce); |
| 6881 | RLOGD("radio::lceDataInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6882 | Return<void> retStatus = radioService[slotId]->mRadioIndication->lceData( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6883 | convertIntToRadioIndicationType(indicationType), lce); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6884 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6885 | } else { |
| 6886 | RLOGE("radio::lceDataInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6887 | } |
| 6888 | |
| 6889 | return 0; |
| 6890 | } |
| 6891 | |
| 6892 | int radio::pcoDataInd(android::Parcel &p, int slotId, int requestNumber, |
| 6893 | int indicationType, int token, RIL_Errno e, void *response, |
| 6894 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6895 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6896 | if (response == NULL || responseLen != sizeof(RIL_PCO_Data)) { |
| 6897 | RLOGE("radio::pcoDataInd: invalid response"); |
| 6898 | return 0; |
| 6899 | } |
| 6900 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6901 | PcoDataInfo pco = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6902 | RIL_PCO_Data *rilPcoData = (RIL_PCO_Data *)response; |
| 6903 | pco.cid = rilPcoData->cid; |
| 6904 | pco.bearerProto = convertCharPtrToHidlString(rilPcoData->bearer_proto); |
| 6905 | pco.pcoId = rilPcoData->pco_id; |
| 6906 | pco.contents.setToExternal((uint8_t *) rilPcoData->contents, rilPcoData->contents_length); |
| 6907 | |
| 6908 | RLOGD("radio::pcoDataInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6909 | Return<void> retStatus = radioService[slotId]->mRadioIndication->pcoData( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6910 | convertIntToRadioIndicationType(indicationType), pco); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6911 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6912 | } else { |
| 6913 | RLOGE("radio::pcoDataInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6914 | } |
| 6915 | |
| 6916 | return 0; |
| 6917 | } |
| 6918 | |
| 6919 | int radio::modemResetInd(android::Parcel &p, int slotId, int requestNumber, |
| 6920 | int indicationType, int token, RIL_Errno e, void *response, |
| 6921 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6922 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6923 | if (response == NULL || responseLen == 0) { |
| 6924 | RLOGE("radio::modemResetInd: invalid response"); |
| 6925 | return 0; |
| 6926 | } |
| 6927 | RLOGD("radio::modemResetInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6928 | Return<void> retStatus = radioService[slotId]->mRadioIndication->modemReset( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6929 | convertIntToRadioIndicationType(indicationType), |
| 6930 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6931 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6932 | } else { |
| 6933 | RLOGE("radio::modemResetInd: radioService[%d]->mRadioIndication == NULL", slotId); |
| 6934 | } |
| 6935 | |
| 6936 | return 0; |
| 6937 | } |
| 6938 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 6939 | int radio::oemHookRawInd(android::Parcel &p, int slotId, int requestNumber, |
| 6940 | int indicationType, int token, RIL_Errno e, void *response, |
| 6941 | size_t responseLen) { |
| 6942 | if (oemHookService[slotId] != NULL && oemHookService[slotId]->mOemHookIndication != NULL) { |
| 6943 | if (response == NULL || responseLen == 0) { |
| 6944 | RLOGE("radio::oemHookRawInd: invalid response"); |
| 6945 | return 0; |
| 6946 | } |
| 6947 | |
| 6948 | hidl_vec<uint8_t> data; |
| 6949 | data.setToExternal((uint8_t *) response, responseLen); |
| 6950 | RLOGD("radio::oemHookRawInd"); |
| 6951 | Return<void> retStatus = oemHookService[slotId]->mOemHookIndication->oemHookRaw( |
| 6952 | convertIntToRadioIndicationType(indicationType), data); |
| 6953 | checkReturnStatus(slotId, retStatus); |
| 6954 | } else { |
| 6955 | RLOGE("radio::oemHookRawInd: oemHookService[%d]->mOemHookIndication == NULL", slotId); |
| 6956 | } |
| 6957 | |
| 6958 | return 0; |
| 6959 | } |
| 6960 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 6961 | void radio::registerService(RIL_RadioFunctions *callbacks, CommandInfo *commands) { |
| 6962 | using namespace android::hardware; |
| 6963 | int simCount = 1; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 6964 | const char *serviceNames[] = { |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 6965 | android::RIL_getRilSocketName() |
| 6966 | #if (SIM_COUNT >= 2) |
| 6967 | , SOCKET2_NAME_RIL |
| 6968 | #if (SIM_COUNT >= 3) |
| 6969 | , SOCKET3_NAME_RIL |
| 6970 | #if (SIM_COUNT >= 4) |
| 6971 | , SOCKET4_NAME_RIL |
| 6972 | #endif |
| 6973 | #endif |
| 6974 | #endif |
| 6975 | }; |
| 6976 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 6977 | const char *oemHookServiceNames[] = { |
| 6978 | OEM_HOOK_SERVICE_NAME |
| 6979 | #if (SIM_COUNT >= 2) |
| 6980 | , OEM_HOOK2_SERVICE_NAME |
| 6981 | #if (SIM_COUNT >= 3) |
| 6982 | , OEM_HOOK3_SERVICE_NAME |
| 6983 | #if (SIM_COUNT >= 4) |
| 6984 | , OEM_HOOK4_SERVICE_NAME |
| 6985 | #endif |
| 6986 | #endif |
| 6987 | #endif |
| 6988 | }; |
| 6989 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 6990 | #if (SIM_COUNT >= 2) |
| 6991 | simCount = SIM_COUNT; |
| 6992 | #endif |
| 6993 | |
| 6994 | configureRpcThreadpool(1, true /* callerWillJoin */); |
| 6995 | for (int i = 0; i < simCount; i++) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6996 | pthread_rwlock_t *radioServiceRwlockPtr = getRadioServiceRwlock(i); |
| 6997 | int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 6998 | assert(ret == 0); |
| 6999 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7000 | radioService[i] = new RadioImpl; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 7001 | radioService[i]->mSlotId = i; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7002 | oemHookService[i] = new OemHookImpl; |
| 7003 | oemHookService[i]->mSlotId = i; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 7004 | RLOGD("radio::registerService: starting IRadio %s", serviceNames[i]); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7005 | android::status_t status = radioService[i]->registerAsService(serviceNames[i]); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7006 | status = oemHookService[i]->registerAsService(oemHookServiceNames[i]); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7007 | |
| 7008 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 7009 | assert(ret == 0); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7010 | } |
| 7011 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 7012 | s_vendorFunctions = callbacks; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7013 | s_commands = commands; |
| 7014 | } |
| 7015 | |
| 7016 | void rilc_thread_pool() { |
| 7017 | joinRpcThreadpool(); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7018 | } |
| 7019 | |
| 7020 | pthread_rwlock_t * radio::getRadioServiceRwlock(int slotId) { |
| 7021 | pthread_rwlock_t *radioServiceRwlockPtr = &radioServiceRwlock; |
| 7022 | |
| 7023 | #if (SIM_COUNT >= 2) |
| 7024 | if (slotId == 2) radioServiceRwlockPtr = &radioServiceRwlock2; |
| 7025 | #if (SIM_COUNT >= 3) |
| 7026 | if (slotId == 3) radioServiceRwlockPtr = &radioServiceRwlock3; |
| 7027 | #if (SIM_COUNT >= 4) |
| 7028 | if (slotId == 4) radioServiceRwlockPtr = &radioServiceRwlock4; |
| 7029 | #endif |
| 7030 | #endif |
| 7031 | #endif |
| 7032 | |
| 7033 | return radioServiceRwlockPtr; |
Sanket Padawe | 0de29d1 | 2017-02-10 13:19:47 -0800 | [diff] [blame] | 7034 | } |