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 | |
Amit Mahajan | 34b33aa | 2017-03-01 11:13:15 -0800 | [diff] [blame] | 17 | #define LOG_TAG "RILC" |
| 18 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 19 | #include <android/hardware/radio/1.0/IRadio.h> |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 20 | #include <android/hardware/radio/deprecated/1.0/IOemHook.h> |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 21 | |
| 22 | #include <hwbinder/IPCThreadState.h> |
| 23 | #include <hwbinder/ProcessState.h> |
| 24 | #include <ril_service.h> |
| 25 | #include <hidl/HidlTransportSupport.h> |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 26 | #include <utils/SystemClock.h> |
Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame] | 27 | #include <inttypes.h> |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 28 | |
| 29 | #define INVALID_HEX_CHAR 16 |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 30 | |
| 31 | using namespace android::hardware::radio::V1_0; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 32 | using namespace android::hardware::radio::deprecated::V1_0; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 33 | using ::android::hardware::configureRpcThreadpool; |
| 34 | using ::android::hardware::joinRpcThreadpool; |
| 35 | using ::android::hardware::Return; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 36 | using ::android::hardware::hidl_string; |
| 37 | using ::android::hardware::hidl_vec; |
| 38 | using ::android::hardware::hidl_array; |
| 39 | using ::android::hardware::Void; |
| 40 | using android::CommandInfo; |
| 41 | using android::RequestInfo; |
| 42 | using android::requestToString; |
| 43 | using android::sp; |
| 44 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 45 | #define BOOL_TO_INT(x) (x ? 1 : 0) |
| 46 | #define ATOI_NULL_HANDLED(x) (x ? atoi(x) : -1) |
| 47 | #define ATOI_NULL_HANDLED_DEF(x, defaultVal) (x ? atoi(x) : defaultVal) |
| 48 | |
| 49 | RIL_RadioFunctions *s_vendorFunctions = NULL; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 50 | static CommandInfo *s_commands; |
| 51 | |
| 52 | struct RadioImpl; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 53 | struct OemHookImpl; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 54 | |
| 55 | #if (SIM_COUNT >= 2) |
| 56 | sp<RadioImpl> radioService[SIM_COUNT]; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 57 | sp<OemHookImpl> oemHookService[SIM_COUNT]; |
| 58 | // counter used for synchronization. It is incremented every time response callbacks are updated. |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 59 | volatile int32_t mCounterRadio[SIM_COUNT]; |
| 60 | volatile int32_t mCounterOemHook[SIM_COUNT]; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 61 | #else |
| 62 | sp<RadioImpl> radioService[1]; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 63 | sp<OemHookImpl> oemHookService[1]; |
| 64 | // counter used for synchronization. It is incremented every time response callbacks are updated. |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 65 | volatile int32_t mCounterRadio[1]; |
| 66 | volatile int32_t mCounterOemHook[1]; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 67 | #endif |
| 68 | |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 69 | static pthread_rwlock_t radioServiceRwlock = PTHREAD_RWLOCK_INITIALIZER; |
| 70 | |
| 71 | #if (SIM_COUNT >= 2) |
| 72 | static pthread_rwlock_t radioServiceRwlock2 = PTHREAD_RWLOCK_INITIALIZER; |
| 73 | #if (SIM_COUNT >= 3) |
| 74 | static pthread_rwlock_t radioServiceRwlock3 = PTHREAD_RWLOCK_INITIALIZER; |
| 75 | #if (SIM_COUNT >= 4) |
| 76 | static pthread_rwlock_t radioServiceRwlock4 = PTHREAD_RWLOCK_INITIALIZER; |
| 77 | #endif |
| 78 | #endif |
| 79 | #endif |
| 80 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 81 | void convertRilHardwareConfigListToHal(void *response, size_t responseLen, |
| 82 | hidl_vec<HardwareConfig>& records); |
| 83 | |
| 84 | void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc); |
| 85 | |
| 86 | void convertRilLceDataInfoToHal(void *response, size_t responseLen, LceDataInfo& lce); |
| 87 | |
| 88 | void convertRilSignalStrengthToHal(void *response, size_t responseLen, |
| 89 | SignalStrength& signalStrength); |
| 90 | |
| 91 | void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse, |
| 92 | SetupDataCallResult& dcResult); |
| 93 | |
| 94 | void convertRilDataCallListToHal(void *response, size_t responseLen, |
| 95 | hidl_vec<SetupDataCallResult>& dcResultList); |
| 96 | |
| 97 | void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<CellInfo>& records); |
| 98 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 99 | struct RadioImpl : public IRadio { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 100 | int32_t mSlotId; |
| 101 | sp<IRadioResponse> mRadioResponse; |
| 102 | sp<IRadioIndication> mRadioIndication; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 103 | |
| 104 | Return<void> setResponseFunctions( |
| 105 | const ::android::sp<IRadioResponse>& radioResponse, |
| 106 | const ::android::sp<IRadioIndication>& radioIndication); |
| 107 | |
| 108 | Return<void> getIccCardStatus(int32_t serial); |
| 109 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 110 | Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin, |
| 111 | const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 112 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 113 | Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, |
| 114 | const hidl_string& pin, const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 115 | |
| 116 | Return<void> supplyIccPin2ForApp(int32_t serial, |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 117 | const hidl_string& pin2, |
| 118 | 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> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, |
| 121 | const hidl_string& pin2, 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> changeIccPinForApp(int32_t serial, const hidl_string& oldPin, |
| 124 | const hidl_string& newPin, 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> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, |
| 127 | const hidl_string& newPin2, const hidl_string& aid); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 128 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 129 | Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 130 | |
| 131 | Return<void> getCurrentCalls(int32_t serial); |
| 132 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 133 | Return<void> dial(int32_t serial, const Dial& dialInfo); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 134 | |
| 135 | Return<void> getImsiForApp(int32_t serial, |
| 136 | const ::android::hardware::hidl_string& aid); |
| 137 | |
| 138 | Return<void> hangup(int32_t serial, int32_t gsmIndex); |
| 139 | |
| 140 | Return<void> hangupWaitingOrBackground(int32_t serial); |
| 141 | |
| 142 | Return<void> hangupForegroundResumeBackground(int32_t serial); |
| 143 | |
| 144 | Return<void> switchWaitingOrHoldingAndActive(int32_t serial); |
| 145 | |
| 146 | Return<void> conference(int32_t serial); |
| 147 | |
| 148 | Return<void> rejectCall(int32_t serial); |
| 149 | |
| 150 | Return<void> getLastCallFailCause(int32_t serial); |
| 151 | |
| 152 | Return<void> getSignalStrength(int32_t serial); |
| 153 | |
| 154 | Return<void> getVoiceRegistrationState(int32_t serial); |
| 155 | |
| 156 | Return<void> getDataRegistrationState(int32_t serial); |
| 157 | |
| 158 | Return<void> getOperator(int32_t serial); |
| 159 | |
| 160 | Return<void> setRadioPower(int32_t serial, bool on); |
| 161 | |
| 162 | Return<void> sendDtmf(int32_t serial, |
| 163 | const ::android::hardware::hidl_string& s); |
| 164 | |
| 165 | Return<void> sendSms(int32_t serial, const GsmSmsMessage& message); |
| 166 | |
| 167 | Return<void> sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message); |
| 168 | |
| 169 | Return<void> setupDataCall(int32_t serial, |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 170 | RadioTechnology radioTechnology, |
| 171 | const DataProfileInfo& profileInfo, |
| 172 | bool modemCognitive, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 173 | bool roamingAllowed, |
| 174 | bool isRoaming); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 175 | |
| 176 | Return<void> iccIOForApp(int32_t serial, |
| 177 | const IccIo& iccIo); |
| 178 | |
| 179 | Return<void> sendUssd(int32_t serial, |
| 180 | const ::android::hardware::hidl_string& ussd); |
| 181 | |
| 182 | Return<void> cancelPendingUssd(int32_t serial); |
| 183 | |
| 184 | Return<void> getClir(int32_t serial); |
| 185 | |
| 186 | Return<void> setClir(int32_t serial, int32_t status); |
| 187 | |
| 188 | Return<void> getCallForwardStatus(int32_t serial, |
| 189 | const CallForwardInfo& callInfo); |
| 190 | |
| 191 | Return<void> setCallForward(int32_t serial, |
| 192 | const CallForwardInfo& callInfo); |
| 193 | |
| 194 | Return<void> getCallWaiting(int32_t serial, int32_t serviceClass); |
| 195 | |
| 196 | Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass); |
| 197 | |
| 198 | Return<void> acknowledgeLastIncomingGsmSms(int32_t serial, |
| 199 | bool success, SmsAcknowledgeFailCause cause); |
| 200 | |
| 201 | Return<void> acceptCall(int32_t serial); |
| 202 | |
| 203 | Return<void> deactivateDataCall(int32_t serial, |
| 204 | int32_t cid, bool reasonRadioShutDown); |
| 205 | |
| 206 | Return<void> getFacilityLockForApp(int32_t serial, |
| 207 | const ::android::hardware::hidl_string& facility, |
| 208 | const ::android::hardware::hidl_string& password, |
| 209 | int32_t serviceClass, |
| 210 | const ::android::hardware::hidl_string& appId); |
| 211 | |
| 212 | Return<void> setFacilityLockForApp(int32_t serial, |
| 213 | const ::android::hardware::hidl_string& facility, |
| 214 | bool lockState, |
| 215 | const ::android::hardware::hidl_string& password, |
| 216 | int32_t serviceClass, |
| 217 | const ::android::hardware::hidl_string& appId); |
| 218 | |
| 219 | Return<void> setBarringPassword(int32_t serial, |
| 220 | const ::android::hardware::hidl_string& facility, |
| 221 | const ::android::hardware::hidl_string& oldPassword, |
| 222 | const ::android::hardware::hidl_string& newPassword); |
| 223 | |
| 224 | Return<void> getNetworkSelectionMode(int32_t serial); |
| 225 | |
| 226 | Return<void> setNetworkSelectionModeAutomatic(int32_t serial); |
| 227 | |
| 228 | Return<void> setNetworkSelectionModeManual(int32_t serial, |
| 229 | const ::android::hardware::hidl_string& operatorNumeric); |
| 230 | |
| 231 | Return<void> getAvailableNetworks(int32_t serial); |
| 232 | |
| 233 | Return<void> startDtmf(int32_t serial, |
| 234 | const ::android::hardware::hidl_string& s); |
| 235 | |
| 236 | Return<void> stopDtmf(int32_t serial); |
| 237 | |
| 238 | Return<void> getBasebandVersion(int32_t serial); |
| 239 | |
| 240 | Return<void> separateConnection(int32_t serial, int32_t gsmIndex); |
| 241 | |
| 242 | Return<void> setMute(int32_t serial, bool enable); |
| 243 | |
| 244 | Return<void> getMute(int32_t serial); |
| 245 | |
| 246 | Return<void> getClip(int32_t serial); |
| 247 | |
| 248 | Return<void> getDataCallList(int32_t serial); |
| 249 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 250 | Return<void> setSuppServiceNotifications(int32_t serial, bool enable); |
| 251 | |
| 252 | Return<void> writeSmsToSim(int32_t serial, |
| 253 | const SmsWriteArgs& smsWriteArgs); |
| 254 | |
| 255 | Return<void> deleteSmsOnSim(int32_t serial, int32_t index); |
| 256 | |
| 257 | Return<void> setBandMode(int32_t serial, RadioBandMode mode); |
| 258 | |
| 259 | Return<void> getAvailableBandModes(int32_t serial); |
| 260 | |
| 261 | Return<void> sendEnvelope(int32_t serial, |
| 262 | const ::android::hardware::hidl_string& command); |
| 263 | |
| 264 | Return<void> sendTerminalResponseToSim(int32_t serial, |
| 265 | const ::android::hardware::hidl_string& commandResponse); |
| 266 | |
| 267 | Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept); |
| 268 | |
| 269 | Return<void> explicitCallTransfer(int32_t serial); |
| 270 | |
| 271 | Return<void> setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType); |
| 272 | |
| 273 | Return<void> getPreferredNetworkType(int32_t serial); |
| 274 | |
| 275 | Return<void> getNeighboringCids(int32_t serial); |
| 276 | |
| 277 | Return<void> setLocationUpdates(int32_t serial, bool enable); |
| 278 | |
| 279 | Return<void> setCdmaSubscriptionSource(int32_t serial, |
| 280 | CdmaSubscriptionSource cdmaSub); |
| 281 | |
| 282 | Return<void> setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type); |
| 283 | |
| 284 | Return<void> getCdmaRoamingPreference(int32_t serial); |
| 285 | |
| 286 | Return<void> setTTYMode(int32_t serial, TtyMode mode); |
| 287 | |
| 288 | Return<void> getTTYMode(int32_t serial); |
| 289 | |
| 290 | Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable); |
| 291 | |
| 292 | Return<void> getPreferredVoicePrivacy(int32_t serial); |
| 293 | |
| 294 | Return<void> sendCDMAFeatureCode(int32_t serial, |
| 295 | const ::android::hardware::hidl_string& featureCode); |
| 296 | |
| 297 | Return<void> sendBurstDtmf(int32_t serial, |
| 298 | const ::android::hardware::hidl_string& dtmf, |
| 299 | int32_t on, |
| 300 | int32_t off); |
| 301 | |
| 302 | Return<void> sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms); |
| 303 | |
| 304 | Return<void> acknowledgeLastIncomingCdmaSms(int32_t serial, |
| 305 | const CdmaSmsAck& smsAck); |
| 306 | |
| 307 | Return<void> getGsmBroadcastConfig(int32_t serial); |
| 308 | |
| 309 | Return<void> setGsmBroadcastConfig(int32_t serial, |
| 310 | const hidl_vec<GsmBroadcastSmsConfigInfo>& configInfo); |
| 311 | |
| 312 | Return<void> setGsmBroadcastActivation(int32_t serial, bool activate); |
| 313 | |
| 314 | Return<void> getCdmaBroadcastConfig(int32_t serial); |
| 315 | |
| 316 | Return<void> setCdmaBroadcastConfig(int32_t serial, |
| 317 | const hidl_vec<CdmaBroadcastSmsConfigInfo>& configInfo); |
| 318 | |
| 319 | Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate); |
| 320 | |
| 321 | Return<void> getCDMASubscription(int32_t serial); |
| 322 | |
| 323 | Return<void> writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms); |
| 324 | |
| 325 | Return<void> deleteSmsOnRuim(int32_t serial, int32_t index); |
| 326 | |
| 327 | Return<void> getDeviceIdentity(int32_t serial); |
| 328 | |
| 329 | Return<void> exitEmergencyCallbackMode(int32_t serial); |
| 330 | |
| 331 | Return<void> getSmscAddress(int32_t serial); |
| 332 | |
| 333 | Return<void> setSmscAddress(int32_t serial, |
| 334 | const ::android::hardware::hidl_string& smsc); |
| 335 | |
| 336 | Return<void> reportSmsMemoryStatus(int32_t serial, bool available); |
| 337 | |
| 338 | Return<void> reportStkServiceIsRunning(int32_t serial); |
| 339 | |
| 340 | Return<void> getCdmaSubscriptionSource(int32_t serial); |
| 341 | |
| 342 | Return<void> requestIsimAuthentication(int32_t serial, |
| 343 | const ::android::hardware::hidl_string& challenge); |
| 344 | |
| 345 | Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, |
| 346 | bool success, |
| 347 | const ::android::hardware::hidl_string& ackPdu); |
| 348 | |
| 349 | Return<void> sendEnvelopeWithStatus(int32_t serial, |
| 350 | const ::android::hardware::hidl_string& contents); |
| 351 | |
| 352 | Return<void> getVoiceRadioTechnology(int32_t serial); |
| 353 | |
| 354 | Return<void> getCellInfoList(int32_t serial); |
| 355 | |
| 356 | Return<void> setCellInfoListRate(int32_t serial, int32_t rate); |
| 357 | |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 358 | Return<void> setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 359 | bool modemCognitive, bool isRoaming); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 360 | |
| 361 | Return<void> getImsRegistrationState(int32_t serial); |
| 362 | |
| 363 | Return<void> sendImsSms(int32_t serial, const ImsSmsMessage& message); |
| 364 | |
| 365 | Return<void> iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message); |
| 366 | |
| 367 | Return<void> iccOpenLogicalChannel(int32_t serial, |
| 368 | const ::android::hardware::hidl_string& aid); |
| 369 | |
| 370 | Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId); |
| 371 | |
| 372 | Return<void> iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message); |
| 373 | |
| 374 | Return<void> nvReadItem(int32_t serial, NvItem itemId); |
| 375 | |
| 376 | Return<void> nvWriteItem(int32_t serial, const NvWriteItem& item); |
| 377 | |
| 378 | Return<void> nvWriteCdmaPrl(int32_t serial, |
| 379 | const ::android::hardware::hidl_vec<uint8_t>& prl); |
| 380 | |
| 381 | Return<void> nvResetConfig(int32_t serial, ResetNvType resetType); |
| 382 | |
| 383 | Return<void> setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub); |
| 384 | |
| 385 | Return<void> setDataAllowed(int32_t serial, bool allow); |
| 386 | |
| 387 | Return<void> getHardwareConfig(int32_t serial); |
| 388 | |
| 389 | Return<void> requestIccSimAuthentication(int32_t serial, |
| 390 | int32_t authContext, |
| 391 | const ::android::hardware::hidl_string& authData, |
| 392 | const ::android::hardware::hidl_string& aid); |
| 393 | |
| 394 | Return<void> setDataProfile(int32_t serial, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 395 | const ::android::hardware::hidl_vec<DataProfileInfo>& profiles, bool isRoaming); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 396 | |
| 397 | Return<void> requestShutdown(int32_t serial); |
| 398 | |
| 399 | Return<void> getRadioCapability(int32_t serial); |
| 400 | |
| 401 | Return<void> setRadioCapability(int32_t serial, const RadioCapability& rc); |
| 402 | |
| 403 | Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode); |
| 404 | |
| 405 | Return<void> stopLceService(int32_t serial); |
| 406 | |
| 407 | Return<void> pullLceData(int32_t serial); |
| 408 | |
| 409 | Return<void> getModemActivityInfo(int32_t serial); |
| 410 | |
| 411 | Return<void> setAllowedCarriers(int32_t serial, |
| 412 | bool allAllowed, |
| 413 | const CarrierRestrictions& carriers); |
| 414 | |
| 415 | Return<void> getAllowedCarriers(int32_t serial); |
| 416 | |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 417 | Return<void> sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state); |
| 418 | |
| 419 | Return<void> setIndicationFilter(int32_t serial, int32_t indicationFilter); |
| 420 | |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 421 | Return<void> setSimCardPower(int32_t serial, bool powerUp); |
| 422 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 423 | Return<void> responseAcknowledgement(); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 424 | |
| 425 | void checkReturnStatus(Return<void>& ret); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 426 | }; |
| 427 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 428 | struct OemHookImpl : public IOemHook { |
| 429 | int32_t mSlotId; |
| 430 | sp<IOemHookResponse> mOemHookResponse; |
| 431 | sp<IOemHookIndication> mOemHookIndication; |
| 432 | |
| 433 | Return<void> setResponseFunctions( |
| 434 | const ::android::sp<IOemHookResponse>& oemHookResponse, |
| 435 | const ::android::sp<IOemHookIndication>& oemHookIndication); |
| 436 | |
| 437 | Return<void> sendRequestRaw(int32_t serial, |
| 438 | const ::android::hardware::hidl_vec<uint8_t>& data); |
| 439 | |
| 440 | Return<void> sendRequestStrings(int32_t serial, |
| 441 | const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data); |
| 442 | }; |
| 443 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 444 | void memsetAndFreeStrings(int numPointers, ...) { |
| 445 | va_list ap; |
| 446 | va_start(ap, numPointers); |
| 447 | for (int i = 0; i < numPointers; i++) { |
| 448 | char *ptr = va_arg(ap, char *); |
| 449 | if (ptr) { |
| 450 | #ifdef MEMSET_FREED |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 451 | // TODO: Should pass in the maximum length of the string |
| 452 | memsetString(ptr); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 453 | #endif |
| 454 | free(ptr); |
| 455 | } |
| 456 | } |
| 457 | va_end(ap); |
| 458 | } |
| 459 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 460 | void sendErrorResponse(RequestInfo *pRI, RIL_Errno err) { |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 461 | pRI->pCI->responseFunction((int) pRI->socket_id, |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 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 | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 700 | void checkReturnStatus(int32_t slotId, Return<void>& ret, bool isRadioService) { |
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 | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 710 | int counter = isRadioService ? mCounterRadio[slotId] : mCounterOemHook[slotId]; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 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 | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 720 | if (counter == (isRadioService ? mCounterRadio[slotId] : mCounterOemHook[slotId])) { |
| 721 | if (isRadioService) { |
| 722 | radioService[slotId]->mRadioResponse = NULL; |
| 723 | radioService[slotId]->mRadioIndication = NULL; |
| 724 | } else { |
| 725 | oemHookService[slotId]->mOemHookResponse = NULL; |
| 726 | oemHookService[slotId]->mOemHookIndication = NULL; |
| 727 | } |
| 728 | isRadioService ? mCounterRadio[slotId]++ : mCounterOemHook[slotId]++; |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 729 | } else { |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 730 | RLOGE("checkReturnStatus: not resetting responseFunctions as they likely " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 731 | "got updated on another thread"); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 732 | } |
| 733 | |
| 734 | // release wrlock |
| 735 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 736 | assert(ret == 0); |
| 737 | |
| 738 | // Reacquire rdlock |
| 739 | ret = pthread_rwlock_rdlock(radioServiceRwlockPtr); |
| 740 | assert(ret == 0); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 741 | } |
| 742 | } |
| 743 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 744 | void RadioImpl::checkReturnStatus(Return<void>& ret) { |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 745 | ::checkReturnStatus(mSlotId, ret, true); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 746 | } |
| 747 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 748 | Return<void> RadioImpl::setResponseFunctions( |
| 749 | const ::android::sp<IRadioResponse>& radioResponseParam, |
| 750 | const ::android::sp<IRadioIndication>& radioIndicationParam) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 751 | RLOGD("setResponseFunctions"); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 752 | |
| 753 | pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); |
| 754 | int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 755 | assert(ret == 0); |
| 756 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 757 | mRadioResponse = radioResponseParam; |
| 758 | mRadioIndication = radioIndicationParam; |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 759 | mCounterRadio[mSlotId]++; |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 760 | |
| 761 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 762 | assert(ret == 0); |
| 763 | |
Amit Mahajan | 60482fd | 2017-03-14 16:39:27 -0700 | [diff] [blame^] | 764 | // client is connected. Send initial indications. |
| 765 | android::onNewCommandConnect((RIL_SOCKET_ID) mSlotId); |
| 766 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 767 | return Void(); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | Return<void> RadioImpl::getIccCardStatus(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 771 | RLOGD("getIccCardStatus: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 772 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_SIM_STATUS); |
| 773 | return Void(); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 774 | } |
| 775 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 776 | Return<void> RadioImpl::supplyIccPinForApp(int32_t serial, const hidl_string& pin, |
| 777 | const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 778 | RLOGD("supplyIccPinForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 779 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN, |
| 780 | 2, (const char *)pin, (const char *)aid); |
| 781 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 782 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 783 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 784 | Return<void> RadioImpl::supplyIccPukForApp(int32_t serial, const hidl_string& puk, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 785 | const hidl_string& pin, const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 786 | RLOGD("supplyIccPukForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 787 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK, |
| 788 | 3, (const char *)puk, (const char *)pin, (const char *)aid); |
| 789 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 790 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 791 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 792 | Return<void> RadioImpl::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 793 | const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 794 | RLOGD("supplyIccPin2ForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 795 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN2, |
| 796 | 2, (const char *)pin2, (const char *)aid); |
| 797 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | Return<void> RadioImpl::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 801 | const hidl_string& pin2, const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 802 | RLOGD("supplyIccPuk2ForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 803 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK2, |
| 804 | 3, (const char *)puk2, (const char *)pin2, (const char *)aid); |
| 805 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | Return<void> RadioImpl::changeIccPinForApp(int32_t serial, const hidl_string& oldPin, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 809 | const hidl_string& newPin, const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 810 | RLOGD("changeIccPinForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 811 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN, |
| 812 | 3, (const char *)oldPin, (const char *)newPin, (const char *)aid); |
| 813 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 814 | } |
| 815 | |
| 816 | Return<void> RadioImpl::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 817 | const hidl_string& newPin2, const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 818 | RLOGD("changeIccPin2ForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 819 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN2, |
| 820 | 3, (const char *)oldPin2, (const char *)newPin2, (const char *)aid); |
| 821 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 822 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 823 | |
| 824 | Return<void> RadioImpl::supplyNetworkDepersonalization(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 825 | const hidl_string& netPin) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 826 | RLOGD("supplyNetworkDepersonalization: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 827 | dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, |
| 828 | 1, (const char *)netPin); |
| 829 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 830 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 831 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 832 | Return<void> RadioImpl::getCurrentCalls(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 833 | RLOGD("getCurrentCalls: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 834 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CURRENT_CALLS); |
| 835 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 836 | } |
| 837 | |
| 838 | Return<void> RadioImpl::dial(int32_t serial, const Dial& dialInfo) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 839 | RLOGD("dial: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 840 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_DIAL); |
| 841 | if (pRI == NULL) { |
| 842 | return Void(); |
| 843 | } |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 844 | RIL_Dial dial = {}; |
| 845 | RIL_UUS_Info uusInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 846 | int32_t sizeOfDial = sizeof(dial); |
| 847 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 848 | if (!copyHidlStringToRil(&dial.address, dialInfo.address, pRI)) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 849 | return Void(); |
| 850 | } |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 851 | dial.clir = (int) dialInfo.clir; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 852 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 853 | if (dialInfo.uusInfo.size() != 0) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 854 | uusInfo.uusType = (RIL_UUS_Type) dialInfo.uusInfo[0].uusType; |
| 855 | uusInfo.uusDcs = (RIL_UUS_DCS) dialInfo.uusInfo[0].uusDcs; |
| 856 | |
| 857 | if (dialInfo.uusInfo[0].uusData.size() == 0) { |
| 858 | uusInfo.uusData = NULL; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 859 | uusInfo.uusLength = 0; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 860 | } else { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 861 | if (!copyHidlStringToRil(&uusInfo.uusData, dialInfo.uusInfo[0].uusData, pRI)) { |
| 862 | memsetAndFreeStrings(1, dial.address); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 863 | return Void(); |
| 864 | } |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 865 | uusInfo.uusLength = dialInfo.uusInfo[0].uusData.size(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 866 | } |
| 867 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 868 | dial.uusInfo = &uusInfo; |
| 869 | } |
| 870 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 871 | s_vendorFunctions->onRequest(RIL_REQUEST_DIAL, &dial, sizeOfDial, pRI); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 872 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 873 | memsetAndFreeStrings(2, dial.address, uusInfo.uusData); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 874 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 875 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 876 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 877 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 878 | Return<void> RadioImpl::getImsiForApp(int32_t serial, const hidl_string& aid) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 879 | RLOGD("getImsiForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 880 | dispatchStrings(serial, mSlotId, RIL_REQUEST_GET_IMSI, |
| 881 | 1, (const char *) aid); |
| 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::hangup(int32_t serial, int32_t gsmIndex) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 886 | RLOGD("hangup: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 887 | dispatchInts(serial, mSlotId, RIL_REQUEST_HANGUP, 1, gsmIndex); |
| 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::hangupWaitingOrBackground(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 892 | RLOGD("hangupWaitingOrBackground: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 893 | dispatchVoid(serial, mSlotId, RIL_REQUEST_HANGUP_WAITING_OR_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::hangupForegroundResumeBackground(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 898 | RLOGD("hangupForegroundResumeBackground: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 899 | dispatchVoid(serial, mSlotId, RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND); |
| 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::switchWaitingOrHoldingAndActive(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 904 | RLOGD("switchWaitingOrHoldingAndActive: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 905 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE); |
| 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::conference(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 910 | RLOGD("conference: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 911 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CONFERENCE); |
| 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::rejectCall(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 916 | RLOGD("rejectCall: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 917 | dispatchVoid(serial, mSlotId, RIL_REQUEST_UDUB); |
| 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::getLastCallFailCause(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 922 | RLOGD("getLastCallFailCause: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 923 | dispatchVoid(serial, mSlotId, RIL_REQUEST_LAST_CALL_FAIL_CAUSE); |
| 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::getSignalStrength(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 928 | RLOGD("getSignalStrength: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 929 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SIGNAL_STRENGTH); |
| 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::getVoiceRegistrationState(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 934 | RLOGD("getVoiceRegistrationState: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 935 | dispatchVoid(serial, mSlotId, RIL_REQUEST_VOICE_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::getDataRegistrationState(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 940 | RLOGD("getDataRegistrationState: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 941 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DATA_REGISTRATION_STATE); |
| 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::getOperator(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 946 | RLOGD("getOperator: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 947 | dispatchVoid(serial, mSlotId, RIL_REQUEST_OPERATOR); |
| 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::setRadioPower(int32_t serial, bool on) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 952 | RLOGD("setRadioPower: serial %d on %d", serial, on); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 953 | dispatchInts(serial, mSlotId, RIL_REQUEST_RADIO_POWER, 1, BOOL_TO_INT(on)); |
| 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::sendDtmf(int32_t serial, const hidl_string& s) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 958 | RLOGD("sendDtmf: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 959 | dispatchString(serial, mSlotId, RIL_REQUEST_DTMF, (const char *) s); |
| 960 | return Void(); |
| 961 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 962 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 963 | Return<void> RadioImpl::sendSms(int32_t serial, const GsmSmsMessage& message) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 964 | RLOGD("sendSms: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 965 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SEND_SMS, |
| 966 | 2, (const char *) message.smscPdu, (const char *) message.pdu); |
| 967 | return Void(); |
| 968 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 969 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 970 | Return<void> RadioImpl::sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 971 | RLOGD("sendSMSExpectMore: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 972 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SEND_SMS_EXPECT_MORE, |
| 973 | 2, (const char *) message.smscPdu, (const char *) message.pdu); |
| 974 | return Void(); |
| 975 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 976 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 977 | const char *convertMvnoTypeToString(MvnoType type) { |
| 978 | switch (type) { |
| 979 | case MvnoType::IMSI: return "imsi"; |
| 980 | case MvnoType::GID: return "gid"; |
| 981 | case MvnoType::SPN: return "spn"; |
| 982 | default: return NULL; |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | Return<void> RadioImpl::setupDataCall(int32_t serial, RadioTechnology radioTechnology, |
| 987 | const DataProfileInfo& dataProfileInfo, bool modemCognitive, |
| 988 | bool roamingAllowed, bool isRoaming) { |
| 989 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 990 | RLOGD("setupDataCall: serial %d", serial); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 991 | |
Jack Yu | ffc0645 | 2017-02-13 11:21:00 -0800 | [diff] [blame] | 992 | if (s_vendorFunctions->version >= 4 && s_vendorFunctions->version <= 14) { |
| 993 | const hidl_string &protocol = |
| 994 | (isRoaming ? dataProfileInfo.roamingProtocol : dataProfileInfo.protocol); |
| 995 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 7, |
| 996 | std::to_string((int) radioTechnology + 2).c_str(), |
| 997 | std::to_string((int) dataProfileInfo.profileId).c_str(), |
| 998 | dataProfileInfo.apn.c_str(), |
| 999 | dataProfileInfo.user.c_str(), |
| 1000 | dataProfileInfo.password.c_str(), |
| 1001 | std::to_string((int) dataProfileInfo.authType).c_str(), |
| 1002 | protocol.c_str()); |
| 1003 | } else if (s_vendorFunctions->version >= 15) { |
| 1004 | const char *mvnoTypeStr = convertMvnoTypeToString(dataProfileInfo.mvnoType); |
| 1005 | if (mvnoTypeStr == NULL) { |
| 1006 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1007 | RIL_REQUEST_SETUP_DATA_CALL); |
| 1008 | if (pRI != NULL) { |
| 1009 | sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); |
| 1010 | } |
| 1011 | return Void(); |
| 1012 | } |
| 1013 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 15, |
| 1014 | std::to_string((int) radioTechnology + 2).c_str(), |
| 1015 | std::to_string((int) dataProfileInfo.profileId).c_str(), |
| 1016 | dataProfileInfo.apn.c_str(), |
| 1017 | dataProfileInfo.user.c_str(), |
| 1018 | dataProfileInfo.password.c_str(), |
| 1019 | std::to_string((int) dataProfileInfo.authType).c_str(), |
| 1020 | dataProfileInfo.protocol.c_str(), |
| 1021 | dataProfileInfo.roamingProtocol.c_str(), |
| 1022 | std::to_string(dataProfileInfo.supportedApnTypesBitmap).c_str(), |
| 1023 | std::to_string(dataProfileInfo.bearerBitmap).c_str(), |
| 1024 | BOOL_TO_INT(modemCognitive), |
| 1025 | std::to_string(dataProfileInfo.mtu).c_str(), |
| 1026 | mvnoTypeStr, |
| 1027 | dataProfileInfo.mvnoMatchData.c_str(), |
| 1028 | BOOL_TO_INT(roamingAllowed)); |
| 1029 | } else { |
| 1030 | RLOGE("Unsupported RIL version %d, min version expected 4", s_vendorFunctions->version); |
| 1031 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 1032 | RIL_REQUEST_SETUP_DATA_CALL); |
| 1033 | if (pRI != NULL) { |
| 1034 | sendErrorResponse(pRI, RIL_E_REQUEST_NOT_SUPPORTED); |
| 1035 | } |
| 1036 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1037 | return Void(); |
| 1038 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1039 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1040 | Return<void> RadioImpl::iccIOForApp(int32_t serial, const IccIo& iccIo) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1041 | RLOGD("iccIOForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1042 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SIM_IO); |
| 1043 | if (pRI == NULL) { |
| 1044 | return Void(); |
| 1045 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1046 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1047 | RIL_SIM_IO_v6 rilIccIo; |
| 1048 | rilIccIo.command = iccIo.command; |
| 1049 | rilIccIo.fileid = iccIo.fileId; |
| 1050 | if (!copyHidlStringToRil(&rilIccIo.path, iccIo.path, pRI)) { |
| 1051 | return Void(); |
| 1052 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1053 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1054 | rilIccIo.p1 = iccIo.p1; |
| 1055 | rilIccIo.p2 = iccIo.p2; |
| 1056 | rilIccIo.p3 = iccIo.p3; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1057 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1058 | if (!copyHidlStringToRil(&rilIccIo.data, iccIo.data, pRI)) { |
| 1059 | memsetAndFreeStrings(1, rilIccIo.path); |
| 1060 | return Void(); |
| 1061 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1062 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1063 | if (!copyHidlStringToRil(&rilIccIo.pin2, iccIo.pin2, pRI)) { |
| 1064 | memsetAndFreeStrings(2, rilIccIo.path, rilIccIo.data); |
| 1065 | return Void(); |
| 1066 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1067 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1068 | if (!copyHidlStringToRil(&rilIccIo.aidPtr, iccIo.aid, pRI)) { |
| 1069 | memsetAndFreeStrings(3, rilIccIo.path, rilIccIo.data, rilIccIo.pin2); |
| 1070 | return Void(); |
| 1071 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1072 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1073 | s_vendorFunctions->onRequest(RIL_REQUEST_SIM_IO, &rilIccIo, sizeof(rilIccIo), pRI); |
| 1074 | |
| 1075 | memsetAndFreeStrings(4, rilIccIo.path, rilIccIo.data, rilIccIo.pin2, rilIccIo.aidPtr); |
| 1076 | |
| 1077 | return Void(); |
| 1078 | } |
| 1079 | |
| 1080 | Return<void> RadioImpl::sendUssd(int32_t serial, const hidl_string& ussd) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1081 | RLOGD("sendUssd: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1082 | dispatchString(serial, mSlotId, RIL_REQUEST_SEND_USSD, (const char *) ussd); |
| 1083 | return Void(); |
| 1084 | } |
| 1085 | |
| 1086 | Return<void> RadioImpl::cancelPendingUssd(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1087 | RLOGD("cancelPendingUssd: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1088 | dispatchVoid(serial, mSlotId, RIL_REQUEST_CANCEL_USSD); |
| 1089 | return Void(); |
| 1090 | } |
| 1091 | |
| 1092 | Return<void> RadioImpl::getClir(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1093 | RLOGD("getClir: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1094 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CLIR); |
| 1095 | return Void(); |
| 1096 | } |
| 1097 | |
| 1098 | Return<void> RadioImpl::setClir(int32_t serial, int32_t status) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1099 | RLOGD("setClir: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1100 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_CLIR, 1, status); |
| 1101 | return Void(); |
| 1102 | } |
| 1103 | |
| 1104 | Return<void> RadioImpl::getCallForwardStatus(int32_t serial, const CallForwardInfo& callInfo) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1105 | RLOGD("getCallForwardStatus: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1106 | dispatchCallForwardStatus(serial, mSlotId, RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, |
| 1107 | callInfo); |
| 1108 | return Void(); |
| 1109 | } |
| 1110 | |
| 1111 | Return<void> RadioImpl::setCallForward(int32_t serial, const CallForwardInfo& callInfo) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1112 | RLOGD("setCallForward: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1113 | dispatchCallForwardStatus(serial, mSlotId, RIL_REQUEST_SET_CALL_FORWARD, |
| 1114 | callInfo); |
| 1115 | return Void(); |
| 1116 | } |
| 1117 | |
| 1118 | Return<void> RadioImpl::getCallWaiting(int32_t serial, int32_t serviceClass) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1119 | RLOGD("getCallWaiting: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1120 | dispatchInts(serial, mSlotId, RIL_REQUEST_QUERY_CALL_WAITING, 1, serviceClass); |
| 1121 | return Void(); |
| 1122 | } |
| 1123 | |
| 1124 | Return<void> RadioImpl::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1125 | RLOGD("setCallWaiting: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1126 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_CALL_WAITING, 2, BOOL_TO_INT(enable), |
| 1127 | serviceClass); |
| 1128 | return Void(); |
| 1129 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1130 | |
| 1131 | Return<void> RadioImpl::acknowledgeLastIncomingGsmSms(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1132 | bool success, SmsAcknowledgeFailCause cause) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1133 | RLOGD("acknowledgeLastIncomingGsmSms: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1134 | dispatchInts(serial, mSlotId, RIL_REQUEST_SMS_ACKNOWLEDGE, 2, BOOL_TO_INT(success), |
| 1135 | cause); |
| 1136 | return Void(); |
| 1137 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1138 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1139 | Return<void> RadioImpl::acceptCall(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1140 | RLOGD("acceptCall: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1141 | dispatchVoid(serial, mSlotId, RIL_REQUEST_ANSWER); |
| 1142 | return Void(); |
| 1143 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1144 | |
| 1145 | Return<void> RadioImpl::deactivateDataCall(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1146 | int32_t cid, bool reasonRadioShutDown) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1147 | RLOGD("deactivateDataCall: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1148 | dispatchStrings(serial, mSlotId, RIL_REQUEST_DEACTIVATE_DATA_CALL, |
| 1149 | 2, (const char *) (std::to_string(cid)).c_str(), reasonRadioShutDown ? "1" : "0"); |
| 1150 | return Void(); |
| 1151 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1152 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1153 | Return<void> RadioImpl::getFacilityLockForApp(int32_t serial, const hidl_string& facility, |
| 1154 | const hidl_string& password, int32_t serviceClass, |
| 1155 | const hidl_string& appId) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1156 | RLOGD("getFacilityLockForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1157 | dispatchStrings(serial, mSlotId, RIL_REQUEST_QUERY_FACILITY_LOCK, |
| 1158 | 4, (const char *) facility, (const char *) password, |
| 1159 | (const char *) (std::to_string(serviceClass)).c_str(), (const char *) appId); |
| 1160 | return Void(); |
| 1161 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1162 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1163 | Return<void> RadioImpl::setFacilityLockForApp(int32_t serial, const hidl_string& facility, |
| 1164 | bool lockState, const hidl_string& password, |
| 1165 | int32_t serviceClass, const hidl_string& appId) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1166 | RLOGD("setFacilityLockForApp: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1167 | dispatchStrings(serial, mSlotId, RIL_REQUEST_SET_FACILITY_LOCK, |
| 1168 | 5, (const char *) facility, lockState ? "1" : "0", (const char *) password, |
| 1169 | (const char *) (std::to_string(serviceClass)).c_str(), (const char *) appId); |
| 1170 | return Void(); |
| 1171 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1172 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1173 | Return<void> RadioImpl::setBarringPassword(int32_t serial, const hidl_string& facility, |
| 1174 | const hidl_string& oldPassword, |
| 1175 | const hidl_string& newPassword) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1176 | RLOGD("setBarringPassword: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1177 | dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_BARRING_PASSWORD, |
| 1178 | 2, (const char *) oldPassword, (const char *) newPassword); |
| 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::getNetworkSelectionMode(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1183 | RLOGD("getNetworkSelectionMode: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1184 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE); |
| 1185 | return Void(); |
| 1186 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1187 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1188 | Return<void> RadioImpl::setNetworkSelectionModeAutomatic(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1189 | RLOGD("setNetworkSelectionModeAutomatic: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1190 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC); |
| 1191 | return Void(); |
| 1192 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1193 | |
| 1194 | Return<void> RadioImpl::setNetworkSelectionModeManual(int32_t serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1195 | const hidl_string& operatorNumeric) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1196 | RLOGD("setNetworkSelectionModeManual: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1197 | dispatchString(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, |
| 1198 | (const char *) operatorNumeric); |
| 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::getAvailableNetworks(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1203 | RLOGD("getAvailableNetworks: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1204 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_AVAILABLE_NETWORKS); |
| 1205 | return Void(); |
| 1206 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1207 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1208 | Return<void> RadioImpl::startDtmf(int32_t serial, const hidl_string& s) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1209 | RLOGD("startDtmf: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1210 | dispatchString(serial, mSlotId, RIL_REQUEST_DTMF_START, |
| 1211 | (const char *) s); |
| 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::stopDtmf(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1216 | RLOGD("stopDtmf: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1217 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DTMF_STOP); |
| 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::getBasebandVersion(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1222 | RLOGD("getBasebandVersion: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1223 | dispatchVoid(serial, mSlotId, RIL_REQUEST_BASEBAND_VERSION); |
| 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::separateConnection(int32_t serial, int32_t gsmIndex) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1228 | RLOGD("separateConnection: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1229 | dispatchInts(serial, mSlotId, RIL_REQUEST_SEPARATE_CONNECTION, 1, gsmIndex); |
| 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::setMute(int32_t serial, bool enable) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1234 | RLOGD("setMute: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1235 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_MUTE, 1, BOOL_TO_INT(enable)); |
| 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::getMute(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1240 | RLOGD("getMute: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1241 | dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_MUTE); |
| 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::getClip(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1246 | RLOGD("getClip: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1247 | dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_CLIP); |
| 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::getDataCallList(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1252 | RLOGD("getDataCallList: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1253 | dispatchVoid(serial, mSlotId, RIL_REQUEST_DATA_CALL_LIST); |
| 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1258 | RLOGD("setSuppServiceNotifications: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1265 | RLOGD("writeSmsToSim: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1292 | RLOGD("deleteSmsOnSim: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1298 | RLOGD("setBandMode: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 1299 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_BAND_MODE, 1, mode); |
| 1300 | return Void(); |
| 1301 | } |
| 1302 | |
| 1303 | Return<void> RadioImpl::getAvailableBandModes(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1304 | RLOGD("getAvailableBandModes: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1310 | RLOGD("sendEnvelope: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1318 | RLOGD("sendTerminalResponseToSim: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1325 | RLOGD("handleStkCallSetupRequestFromSim: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1332 | RLOGD("explicitCallTransfer: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1338 | RLOGD("setPreferredNetworkType: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1344 | RLOGD("getPreferredNetworkType: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1350 | RLOGD("getNeighboringCids: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1356 | RLOGD("setLocationUpdates: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1362 | RLOGD("setCdmaSubscriptionSource: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1368 | RLOGD("setCdmaRoamingPreference: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1374 | RLOGD("getCdmaRoamingPreference: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1380 | RLOGD("setTTYMode: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1386 | RLOGD("getTTYMode: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1392 | RLOGD("setPreferredVoicePrivacy: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1399 | RLOGD("getPreferredVoicePrivacy: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1405 | RLOGD("sendCDMAFeatureCode: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1413 | RLOGD("sendBurstDtmf: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1454 | RLOGD("sendCdmaSms: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1468 | RLOGD("acknowledgeLastIncomingCdmaSms: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1484 | RLOGD("getGsmBroadcastConfig: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1492 | RLOGD("setGsmBroadcastConfig: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1518 | RLOGD("setGsmBroadcastActivation: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1525 | RLOGD("getCdmaBroadcastConfig: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1533 | RLOGD("setCdmaBroadcastConfig: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1557 | RLOGD("setCdmaBroadcastActivation: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1564 | RLOGD("getCDMASubscription: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1570 | RLOGD("writeSmsToRuim: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1586 | RLOGD("deleteSmsOnRuim: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1592 | RLOGD("getDeviceIdentity: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1598 | RLOGD("exitEmergencyCallbackMode: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1604 | RLOGD("getSmscAddress: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1610 | RLOGD("setSmscAddress: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1617 | RLOGD("reportSmsMemoryStatus: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1624 | RLOGD("reportStkServiceIsRunning: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1630 | RLOGD("getCdmaSubscriptionSource: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1636 | RLOGD("requestIsimAuthentication: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1644 | RLOGD("acknowledgeIncomingGsmSmsWithPdu: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1651 | RLOGD("sendEnvelopeWithStatus: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1658 | RLOGD("getVoiceRadioTechnology: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1664 | RLOGD("getCellInfoList: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1670 | RLOGD("setCellInfoListRate: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1677 | RLOGD("setInitialAttachApn: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1753 | RLOGD("getImsRegistrationState: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1839 | RLOGD("sendImsSms: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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 { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1852 | RLOGE("sendImsSms: Invalid radio tech %s", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1860 | RLOGD("iccTransmitApduBasicChannel: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1866 | RLOGD("iccOpenLogicalChannel: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1873 | RLOGD("iccCloseLogicalChannel: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1879 | RLOGD("iccTransmitApduLogicalChannel: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1885 | RLOGD("nvReadItem: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1900 | RLOGD("nvWriteItem: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1922 | RLOGD("nvWriteCdmaPrl: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1928 | RLOGD("nvResetConfig: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1934 | RLOGD("setUiccSubscription: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1953 | RLOGD("setDataAllowed: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1959 | RLOGD("getHardwareConfig: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 1966 | RLOGD("requestIccSimAuthentication: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2029 | RLOGD("setDataProfile: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2189 | RLOGD("requestShutdown: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2190 | dispatchVoid(serial, mSlotId, RIL_REQUEST_SHUTDOWN); |
| 2191 | return Void(); |
| 2192 | } |
| 2193 | |
| 2194 | Return<void> RadioImpl::getRadioCapability(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2195 | RLOGD("getRadioCapability: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2201 | RLOGD("setRadioCapability: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2223 | RLOGD("startLceService: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2230 | RLOGD("stopLceService: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2231 | dispatchVoid(serial, mSlotId, RIL_REQUEST_STOP_LCE); |
| 2232 | return Void(); |
| 2233 | } |
| 2234 | |
| 2235 | Return<void> RadioImpl::pullLceData(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2236 | RLOGD("pullLceData: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2237 | dispatchVoid(serial, mSlotId, RIL_REQUEST_PULL_LCEDATA); |
| 2238 | return Void(); |
| 2239 | } |
| 2240 | |
| 2241 | Return<void> RadioImpl::getModemActivityInfo(int32_t serial) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2242 | RLOGD("getModemActivityInfo: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2249 | RLOGD("setAllowedCarriers: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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 = {}; |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 2257 | RIL_Carrier *allowedCarriers = NULL; |
| 2258 | RIL_Carrier *excludedCarriers = NULL; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2263 | RLOGE("setAllowedCarriers: Memory allocation failed for request %s", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2273 | RLOGE("setAllowedCarriers: Memory allocation failed for request %s", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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 | |
Amit Mahajan | 3f510f6 | 2017-03-01 10:26:58 -0800 | [diff] [blame] | 2291 | for (int i = 0; i < cr.len_excluded_carriers; i++) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2311 | RLOGD("getAllowedCarriers: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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 | |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 2316 | Return<void> RadioImpl::sendDeviceState(int32_t serial, DeviceStateType deviceStateType, |
| 2317 | bool state) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2318 | RLOGD("sendDeviceState: serial %d", serial); |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 2319 | if (s_vendorFunctions->version < 15) { |
| 2320 | if (deviceStateType == DeviceStateType::LOW_DATA_EXPECTED) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2321 | RLOGD("sendDeviceState: calling screen state %d", BOOL_TO_INT(!state)); |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 2322 | dispatchInts(serial, mSlotId, RIL_REQUEST_SCREEN_STATE, 1, BOOL_TO_INT(!state)); |
| 2323 | } else { |
| 2324 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 2325 | RIL_REQUEST_SEND_DEVICE_STATE); |
| 2326 | sendErrorResponse(pRI, RIL_E_REQUEST_NOT_SUPPORTED); |
| 2327 | } |
| 2328 | return Void(); |
| 2329 | } |
| 2330 | dispatchInts(serial, mSlotId, RIL_REQUEST_SEND_DEVICE_STATE, 2, (int) deviceStateType, |
| 2331 | BOOL_TO_INT(state)); |
| 2332 | return Void(); |
| 2333 | } |
| 2334 | |
| 2335 | Return<void> RadioImpl::setIndicationFilter(int32_t serial, int32_t indicationFilter) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2336 | RLOGD("setIndicationFilter: serial %d", serial); |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 2337 | if (s_vendorFunctions->version < 15) { |
| 2338 | RequestInfo *pRI = android::addRequestToList(serial, mSlotId, |
| 2339 | RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER); |
| 2340 | sendErrorResponse(pRI, RIL_E_REQUEST_NOT_SUPPORTED); |
| 2341 | return Void(); |
| 2342 | } |
| 2343 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, 1, indicationFilter); |
| 2344 | return Void(); |
| 2345 | } |
| 2346 | |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 2347 | Return<void> RadioImpl::setSimCardPower(int32_t serial, bool powerUp) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2348 | RLOGD("setSimCardPower: serial %d", serial); |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 2349 | dispatchInts(serial, mSlotId, RIL_REQUEST_SET_SIM_CARD_POWER, 1, BOOL_TO_INT(powerUp)); |
| 2350 | return Void(); |
| 2351 | } |
| 2352 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2353 | Return<void> RadioImpl::responseAcknowledgement() { |
| 2354 | android::releaseWakeLock(); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2355 | return Void(); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2356 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2357 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 2358 | Return<void> OemHookImpl::setResponseFunctions( |
| 2359 | const ::android::sp<IOemHookResponse>& oemHookResponseParam, |
| 2360 | const ::android::sp<IOemHookIndication>& oemHookIndicationParam) { |
| 2361 | RLOGD("OemHookImpl::setResponseFunctions"); |
| 2362 | |
| 2363 | pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); |
| 2364 | int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 2365 | assert(ret == 0); |
| 2366 | |
| 2367 | mOemHookResponse = oemHookResponseParam; |
| 2368 | mOemHookIndication = oemHookIndicationParam; |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 2369 | mCounterOemHook[mSlotId]++; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 2370 | |
| 2371 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 2372 | assert(ret == 0); |
| 2373 | |
| 2374 | return Void(); |
| 2375 | } |
| 2376 | |
| 2377 | Return<void> OemHookImpl::sendRequestRaw(int32_t serial, const hidl_vec<uint8_t>& data) { |
| 2378 | RLOGD("OemHookImpl::sendRequestRaw: serial %d", serial); |
| 2379 | dispatchRaw(serial, mSlotId, RIL_REQUEST_OEM_HOOK_RAW, data); |
| 2380 | return Void(); |
| 2381 | } |
| 2382 | |
| 2383 | Return<void> OemHookImpl::sendRequestStrings(int32_t serial, |
| 2384 | const hidl_vec<hidl_string>& data) { |
| 2385 | RLOGD("OemHookImpl::sendRequestStrings: serial %d", serial); |
| 2386 | dispatchStrings(serial, mSlotId, RIL_REQUEST_OEM_HOOK_STRINGS, data); |
| 2387 | return Void(); |
| 2388 | } |
| 2389 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2390 | /*************************************************************************************************** |
| 2391 | * RESPONSE FUNCTIONS |
| 2392 | * Functions above are used for requests going from framework to vendor code. The ones below are |
| 2393 | * responses for those requests coming back from the vendor code. |
| 2394 | **************************************************************************************************/ |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2395 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2396 | void radio::acknowledgeRequest(int slotId, int serial) { |
| 2397 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2398 | Return<void> retStatus = radioService[slotId]->mRadioResponse->acknowledgeRequest(serial); |
| 2399 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2400 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2401 | RLOGE("acknowledgeRequest: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2402 | } |
| 2403 | } |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2404 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2405 | void populateResponseInfo(RadioResponseInfo& responseInfo, int serial, int responseType, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2406 | RIL_Errno e) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2407 | responseInfo.serial = serial; |
| 2408 | switch (responseType) { |
| 2409 | case RESPONSE_SOLICITED: |
| 2410 | responseInfo.type = RadioResponseType::SOLICITED; |
| 2411 | break; |
| 2412 | case RESPONSE_SOLICITED_ACK_EXP: |
| 2413 | responseInfo.type = RadioResponseType::SOLICITED_ACK_EXP; |
| 2414 | break; |
| 2415 | } |
| 2416 | responseInfo.error = (RadioError) e; |
| 2417 | } |
| 2418 | |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2419 | int responseIntOrEmpty(RadioResponseInfo& responseInfo, int serial, int responseType, RIL_Errno e, |
| 2420 | void *response, size_t responseLen) { |
| 2421 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2422 | int ret = -1; |
| 2423 | |
| 2424 | if (response == NULL && responseLen == 0) { |
| 2425 | // Earlier RILs did not send a response for some cases although the interface |
| 2426 | // expected an integer as response. Do not return error if response is empty. Instead |
| 2427 | // Return -1 in those cases to maintain backward compatibility. |
| 2428 | } else if (response == NULL || responseLen != sizeof(int)) { |
| 2429 | RLOGE("responseIntOrEmpty: Invalid response"); |
| 2430 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2431 | } else { |
| 2432 | int *p_int = (int *) response; |
| 2433 | ret = p_int[0]; |
| 2434 | } |
| 2435 | return ret; |
| 2436 | } |
| 2437 | |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2438 | int responseInt(RadioResponseInfo& responseInfo, int serial, int responseType, RIL_Errno e, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2439 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2440 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2441 | int ret = -1; |
| 2442 | |
| 2443 | if (response == NULL || responseLen != sizeof(int)) { |
| 2444 | RLOGE("responseInt: Invalid response"); |
| 2445 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2446 | } else { |
| 2447 | int *p_int = (int *) response; |
| 2448 | ret = p_int[0]; |
| 2449 | } |
| 2450 | return ret; |
| 2451 | } |
| 2452 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2453 | int radio::getIccCardStatusResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2454 | int responseType, int serial, RIL_Errno e, |
| 2455 | void *response, size_t responseLen) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2456 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2457 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2458 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2459 | CardStatus cardStatus = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2460 | if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2461 | RLOGE("getIccCardStatusResponse: Invalid response"); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2462 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2463 | } else { |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2464 | RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response); |
| 2465 | cardStatus.cardState = (CardState) p_cur->card_state; |
| 2466 | cardStatus.universalPinState = (PinState) p_cur->universal_pin_state; |
| 2467 | cardStatus.gsmUmtsSubscriptionAppIndex = p_cur->gsm_umts_subscription_app_index; |
| 2468 | cardStatus.cdmaSubscriptionAppIndex = p_cur->cdma_subscription_app_index; |
| 2469 | cardStatus.imsSubscriptionAppIndex = p_cur->ims_subscription_app_index; |
| 2470 | |
| 2471 | RIL_AppStatus *rilAppStatus = p_cur->applications; |
| 2472 | cardStatus.applications.resize(p_cur->num_applications); |
| 2473 | AppStatus *appStatus = cardStatus.applications.data(); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2474 | RLOGD("getIccCardStatusResponse: num_applications %d", p_cur->num_applications); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2475 | for (int i = 0; i < p_cur->num_applications; i++) { |
| 2476 | appStatus[i].appType = (AppType) rilAppStatus[i].app_type; |
| 2477 | appStatus[i].appState = (AppState) rilAppStatus[i].app_state; |
| 2478 | appStatus[i].persoSubstate = (PersoSubstate) rilAppStatus[i].perso_substate; |
| 2479 | appStatus[i].aidPtr = convertCharPtrToHidlString(rilAppStatus[i].aid_ptr); |
| 2480 | appStatus[i].appLabelPtr = convertCharPtrToHidlString( |
| 2481 | rilAppStatus[i].app_label_ptr); |
| 2482 | appStatus[i].pin1Replaced = rilAppStatus[i].pin1_replaced; |
| 2483 | appStatus[i].pin1 = (PinState) rilAppStatus[i].pin1; |
| 2484 | appStatus[i].pin2 = (PinState) rilAppStatus[i].pin2; |
| 2485 | } |
| 2486 | } |
| 2487 | |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2488 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2489 | getIccCardStatusResponse(responseInfo, cardStatus); |
| 2490 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2491 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2492 | RLOGE("getIccCardStatusResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2493 | } |
| 2494 | |
| 2495 | return 0; |
| 2496 | } |
| 2497 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2498 | int radio::supplyIccPinForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2499 | int responseType, int serial, RIL_Errno e, |
| 2500 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2501 | RLOGD("supplyIccPinForAppResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2502 | |
| 2503 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2504 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2505 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2506 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2507 | supplyIccPinForAppResponse(responseInfo, ret); |
| 2508 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2509 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2510 | RLOGE("supplyIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2511 | slotId); |
| 2512 | } |
| 2513 | |
| 2514 | return 0; |
| 2515 | } |
| 2516 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2517 | int radio::supplyIccPukForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2518 | int responseType, int serial, RIL_Errno e, |
| 2519 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2520 | RLOGD("supplyIccPukForAppResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2521 | |
| 2522 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2523 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2524 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2525 | Return<void> retStatus = radioService[slotId]->mRadioResponse->supplyIccPukForAppResponse( |
| 2526 | responseInfo, ret); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2527 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2528 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2529 | RLOGE("supplyIccPukForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2530 | slotId); |
| 2531 | } |
| 2532 | |
| 2533 | return 0; |
| 2534 | } |
| 2535 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2536 | int radio::supplyIccPin2ForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2537 | int responseType, int serial, RIL_Errno e, |
| 2538 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2539 | RLOGD("supplyIccPin2ForAppResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2540 | |
| 2541 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2542 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2543 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2544 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2545 | supplyIccPin2ForAppResponse(responseInfo, ret); |
| 2546 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2547 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2548 | RLOGE("supplyIccPin2ForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2549 | slotId); |
| 2550 | } |
| 2551 | |
| 2552 | return 0; |
| 2553 | } |
| 2554 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2555 | int radio::supplyIccPuk2ForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2556 | int responseType, int serial, RIL_Errno e, |
| 2557 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2558 | RLOGD("supplyIccPuk2ForAppResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2559 | |
| 2560 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2561 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2562 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2563 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2564 | supplyIccPuk2ForAppResponse(responseInfo, ret); |
| 2565 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2566 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2567 | RLOGE("supplyIccPuk2ForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2568 | slotId); |
| 2569 | } |
| 2570 | |
| 2571 | return 0; |
| 2572 | } |
| 2573 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2574 | int radio::changeIccPinForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2575 | int responseType, int serial, RIL_Errno e, |
| 2576 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2577 | RLOGD("changeIccPinForAppResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2578 | |
| 2579 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2580 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2581 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2582 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2583 | changeIccPinForAppResponse(responseInfo, ret); |
| 2584 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2585 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2586 | RLOGE("changeIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2587 | slotId); |
| 2588 | } |
| 2589 | |
| 2590 | return 0; |
| 2591 | } |
| 2592 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2593 | int radio::changeIccPin2ForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2594 | int responseType, int serial, RIL_Errno e, |
| 2595 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2596 | RLOGD("changeIccPin2ForAppResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2597 | |
| 2598 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2599 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2600 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2601 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2602 | changeIccPin2ForAppResponse(responseInfo, ret); |
| 2603 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2604 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2605 | RLOGE("changeIccPin2ForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2606 | slotId); |
| 2607 | } |
| 2608 | |
| 2609 | return 0; |
| 2610 | } |
| 2611 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2612 | int radio::supplyNetworkDepersonalizationResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2613 | int responseType, int serial, RIL_Errno e, |
| 2614 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2615 | RLOGD("supplyNetworkDepersonalizationResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2616 | |
| 2617 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2618 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 2619 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2620 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2621 | supplyNetworkDepersonalizationResponse(responseInfo, ret); |
| 2622 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2623 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2624 | RLOGE("supplyNetworkDepersonalizationResponse: radioService[%d]->mRadioResponse == " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2625 | "NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2626 | } |
| 2627 | |
| 2628 | return 0; |
| 2629 | } |
| 2630 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2631 | int radio::getCurrentCallsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2632 | int responseType, int serial, RIL_Errno e, |
| 2633 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2634 | RLOGD("getCurrentCallsResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2635 | |
| 2636 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2637 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2638 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2639 | |
| 2640 | hidl_vec<Call> calls; |
| 2641 | if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2642 | RLOGE("getCurrentCallsResponse: Invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 2643 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2644 | } else { |
| 2645 | int num = responseLen / sizeof(RIL_Call *); |
| 2646 | calls.resize(num); |
| 2647 | |
| 2648 | for (int i = 0 ; i < num ; i++) { |
| 2649 | RIL_Call *p_cur = ((RIL_Call **) response)[i]; |
| 2650 | /* each call info */ |
| 2651 | calls[i].state = (CallState) p_cur->state; |
| 2652 | calls[i].index = p_cur->index; |
| 2653 | calls[i].toa = p_cur->toa; |
| 2654 | calls[i].isMpty = p_cur->isMpty; |
| 2655 | calls[i].isMT = p_cur->isMT; |
| 2656 | calls[i].als = p_cur->als; |
| 2657 | calls[i].isVoice = p_cur->isVoice; |
| 2658 | calls[i].isVoicePrivacy = p_cur->isVoicePrivacy; |
| 2659 | calls[i].number = convertCharPtrToHidlString(p_cur->number); |
| 2660 | calls[i].numberPresentation = (CallPresentation) p_cur->numberPresentation; |
| 2661 | calls[i].name = convertCharPtrToHidlString(p_cur->name); |
| 2662 | calls[i].namePresentation = (CallPresentation) p_cur->namePresentation; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2663 | if (p_cur->uusInfo != NULL && p_cur->uusInfo->uusData != NULL) { |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2664 | RIL_UUS_Info *uusInfo = p_cur->uusInfo; |
| 2665 | calls[i].uusInfo[0].uusType = (UusType) uusInfo->uusType; |
| 2666 | calls[i].uusInfo[0].uusDcs = (UusDcs) uusInfo->uusDcs; |
| 2667 | // convert uusInfo->uusData to a null-terminated string |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2668 | char *nullTermStr = strndup(uusInfo->uusData, uusInfo->uusLength); |
| 2669 | calls[i].uusInfo[0].uusData = nullTermStr; |
| 2670 | free(nullTermStr); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2671 | } |
| 2672 | } |
| 2673 | } |
| 2674 | |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2675 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 2676 | getCurrentCallsResponse(responseInfo, calls); |
| 2677 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2678 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2679 | RLOGE("getCurrentCallsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2680 | } |
| 2681 | |
| 2682 | return 0; |
| 2683 | } |
| 2684 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2685 | int radio::dialResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2686 | int responseType, int serial, RIL_Errno e, void *response, |
| 2687 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2688 | RLOGD("dialResponse: serial %d", serial); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2689 | |
| 2690 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2691 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2692 | populateResponseInfo(responseInfo, serial, responseType, e); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2693 | Return<void> retStatus = radioService[slotId]->mRadioResponse->dialResponse(responseInfo); |
| 2694 | radioService[slotId]->checkReturnStatus(retStatus); |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2695 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2696 | RLOGE("dialResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2697 | } |
| 2698 | |
| 2699 | return 0; |
| 2700 | } |
| 2701 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2702 | int radio::getIMSIForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2703 | int responseType, int serial, RIL_Errno e, void *response, |
| 2704 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2705 | RLOGD("getIMSIForAppResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2706 | |
| 2707 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2708 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2709 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2710 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getIMSIForAppResponse( |
| 2711 | responseInfo, convertCharPtrToHidlString((char *) response)); |
| 2712 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2713 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2714 | RLOGE("getIMSIForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2715 | slotId); |
| 2716 | } |
| 2717 | |
| 2718 | return 0; |
| 2719 | } |
| 2720 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2721 | int radio::hangupConnectionResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2722 | int responseType, int serial, RIL_Errno e, |
| 2723 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2724 | RLOGD("hangupConnectionResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2725 | |
| 2726 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2727 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2728 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2729 | Return<void> retStatus = radioService[slotId]->mRadioResponse->hangupConnectionResponse( |
| 2730 | responseInfo); |
| 2731 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2732 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2733 | RLOGE("hangupConnectionResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2734 | slotId); |
| 2735 | } |
| 2736 | |
| 2737 | return 0; |
| 2738 | } |
| 2739 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2740 | int radio::hangupWaitingOrBackgroundResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2741 | int responseType, int serial, RIL_Errno e, |
| 2742 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2743 | RLOGD("hangupWaitingOrBackgroundResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2744 | |
| 2745 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2746 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2747 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2748 | Return<void> retStatus = |
| 2749 | radioService[slotId]->mRadioResponse->hangupWaitingOrBackgroundResponse( |
| 2750 | responseInfo); |
| 2751 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2752 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2753 | RLOGE("hangupWaitingOrBackgroundResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2754 | slotId); |
| 2755 | } |
| 2756 | |
| 2757 | return 0; |
| 2758 | } |
| 2759 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2760 | int radio::hangupForegroundResumeBackgroundResponse(int slotId, int responseType, int serial, |
| 2761 | RIL_Errno e, void *response, |
| 2762 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2763 | RLOGD("hangupWaitingOrBackgroundResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2764 | |
| 2765 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2766 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2767 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2768 | Return<void> retStatus = |
| 2769 | radioService[slotId]->mRadioResponse->hangupWaitingOrBackgroundResponse( |
| 2770 | responseInfo); |
| 2771 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2772 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2773 | RLOGE("hangupWaitingOrBackgroundResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2774 | slotId); |
| 2775 | } |
| 2776 | |
| 2777 | return 0; |
| 2778 | } |
| 2779 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2780 | int radio::switchWaitingOrHoldingAndActiveResponse(int slotId, int responseType, int serial, |
| 2781 | RIL_Errno e, void *response, |
| 2782 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2783 | RLOGD("switchWaitingOrHoldingAndActiveResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2784 | |
| 2785 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2786 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2787 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2788 | Return<void> retStatus = |
| 2789 | radioService[slotId]->mRadioResponse->switchWaitingOrHoldingAndActiveResponse( |
| 2790 | responseInfo); |
| 2791 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2792 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2793 | RLOGE("switchWaitingOrHoldingAndActiveResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2794 | "== NULL", slotId); |
| 2795 | } |
| 2796 | |
| 2797 | return 0; |
| 2798 | } |
| 2799 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2800 | int radio::conferenceResponse(int slotId, int responseType, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2801 | int serial, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2802 | RLOGD("conferenceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2803 | |
| 2804 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2805 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2806 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2807 | Return<void> retStatus = radioService[slotId]->mRadioResponse->conferenceResponse( |
| 2808 | responseInfo); |
| 2809 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2810 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2811 | RLOGE("conferenceResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2812 | slotId); |
| 2813 | } |
| 2814 | |
| 2815 | return 0; |
| 2816 | } |
| 2817 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2818 | int radio::rejectCallResponse(int slotId, int responseType, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2819 | int serial, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2820 | RLOGD("rejectCallResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2821 | |
| 2822 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2823 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2824 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 2825 | Return<void> retStatus = radioService[slotId]->mRadioResponse->rejectCallResponse( |
| 2826 | responseInfo); |
| 2827 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2828 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2829 | RLOGE("rejectCallResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2830 | slotId); |
| 2831 | } |
| 2832 | |
| 2833 | return 0; |
| 2834 | } |
| 2835 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2836 | int radio::getLastCallFailCauseResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2837 | int responseType, int serial, RIL_Errno e, void *response, |
| 2838 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2839 | RLOGD("getLastCallFailCauseResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2840 | |
| 2841 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2842 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2843 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 2844 | |
| 2845 | LastCallFailCauseInfo info = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2846 | info.vendorCause = hidl_string(); |
| 2847 | if (response == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2848 | RLOGE("getCurrentCallsResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2849 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2850 | } else if (responseLen == sizeof(int)) { |
| 2851 | int *pInt = (int *) response; |
| 2852 | info.causeCode = (LastCallFailCause) pInt[0]; |
| 2853 | } else if (responseLen == sizeof(RIL_LastCallFailCauseInfo)) { |
| 2854 | RIL_LastCallFailCauseInfo *pFailCauseInfo = (RIL_LastCallFailCauseInfo *) response; |
| 2855 | info.causeCode = (LastCallFailCause) pFailCauseInfo->cause_code; |
| 2856 | info.vendorCause = convertCharPtrToHidlString(pFailCauseInfo->vendor_cause); |
| 2857 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2858 | RLOGE("getCurrentCallsResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2859 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2860 | } |
| 2861 | |
| 2862 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getLastCallFailCauseResponse( |
| 2863 | responseInfo, info); |
| 2864 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2865 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2866 | RLOGE("getLastCallFailCauseResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 2867 | slotId); |
| 2868 | } |
| 2869 | |
| 2870 | return 0; |
| 2871 | } |
| 2872 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 2873 | int radio::getSignalStrengthResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2874 | int responseType, int serial, RIL_Errno e, |
| 2875 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2876 | RLOGD("getSignalStrengthResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2877 | |
| 2878 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 2879 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2880 | populateResponseInfo(responseInfo, serial, responseType, e); |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 2881 | SignalStrength signalStrength = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2882 | if (response == NULL || responseLen != sizeof(RIL_SignalStrength_v10)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2883 | RLOGE("getSignalStrengthResponse: Invalid response"); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2884 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 2885 | } else { |
| 2886 | convertRilSignalStrengthToHal(response, responseLen, signalStrength); |
| 2887 | } |
| 2888 | |
| 2889 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getSignalStrengthResponse( |
| 2890 | responseInfo, signalStrength); |
| 2891 | radioService[slotId]->checkReturnStatus(retStatus); |
| 2892 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 2893 | RLOGE("getSignalStrengthResponse: radioService[%d]->mRadioResponse == NULL", |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 2894 | slotId); |
| 2895 | } |
| 2896 | |
| 2897 | return 0; |
| 2898 | } |
| 2899 | |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 2900 | RIL_CellInfoType getCellInfoTypeRadioTechnology(char *rat) { |
| 2901 | if (rat == NULL) { |
| 2902 | return RIL_CELL_INFO_TYPE_NONE; |
| 2903 | } |
| 2904 | |
| 2905 | int radioTech = atoi(rat); |
| 2906 | |
| 2907 | switch(radioTech) { |
| 2908 | |
| 2909 | case RADIO_TECH_GPRS: |
| 2910 | case RADIO_TECH_EDGE: |
| 2911 | case RADIO_TECH_GSM: { |
| 2912 | return RIL_CELL_INFO_TYPE_GSM; |
| 2913 | } |
| 2914 | |
| 2915 | case RADIO_TECH_UMTS: |
| 2916 | case RADIO_TECH_HSDPA: |
| 2917 | case RADIO_TECH_HSUPA: |
| 2918 | case RADIO_TECH_HSPA: |
| 2919 | case RADIO_TECH_HSPAP: { |
| 2920 | return RIL_CELL_INFO_TYPE_WCDMA; |
| 2921 | } |
| 2922 | |
| 2923 | case RADIO_TECH_IS95A: |
| 2924 | case RADIO_TECH_IS95B: |
| 2925 | case RADIO_TECH_1xRTT: |
| 2926 | case RADIO_TECH_EVDO_0: |
| 2927 | case RADIO_TECH_EVDO_A: |
| 2928 | case RADIO_TECH_EVDO_B: |
| 2929 | case RADIO_TECH_EHRPD: { |
| 2930 | return RIL_CELL_INFO_TYPE_CDMA; |
| 2931 | } |
| 2932 | |
| 2933 | case RADIO_TECH_LTE: |
| 2934 | case RADIO_TECH_LTE_CA: { |
| 2935 | return RIL_CELL_INFO_TYPE_LTE; |
| 2936 | } |
| 2937 | |
| 2938 | case RADIO_TECH_TD_SCDMA: { |
| 2939 | return RIL_CELL_INFO_TYPE_TD_SCDMA; |
| 2940 | } |
| 2941 | |
| 2942 | default: { |
| 2943 | break; |
| 2944 | } |
| 2945 | } |
| 2946 | |
| 2947 | return RIL_CELL_INFO_TYPE_NONE; |
| 2948 | |
| 2949 | } |
| 2950 | |
| 2951 | void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &rilCellIdentity) { |
| 2952 | |
| 2953 | cellIdentity.cellIdentityGsm.resize(0); |
| 2954 | cellIdentity.cellIdentityWcdma.resize(0); |
| 2955 | cellIdentity.cellIdentityCdma.resize(0); |
| 2956 | cellIdentity.cellIdentityTdscdma.resize(0); |
| 2957 | cellIdentity.cellIdentityLte.resize(0); |
| 2958 | cellIdentity.cellInfoType = (CellInfoType)rilCellIdentity.cellInfoType; |
| 2959 | switch(rilCellIdentity.cellInfoType) { |
| 2960 | |
| 2961 | case RIL_CELL_INFO_TYPE_GSM: { |
| 2962 | cellIdentity.cellIdentityGsm.resize(1); |
| 2963 | cellIdentity.cellIdentityGsm[0].mcc = |
| 2964 | std::to_string(rilCellIdentity.cellIdentityGsm.mcc); |
| 2965 | cellIdentity.cellIdentityGsm[0].mnc = |
| 2966 | std::to_string(rilCellIdentity.cellIdentityGsm.mnc); |
| 2967 | cellIdentity.cellIdentityGsm[0].lac = rilCellIdentity.cellIdentityGsm.lac; |
| 2968 | cellIdentity.cellIdentityGsm[0].cid = rilCellIdentity.cellIdentityGsm.cid; |
| 2969 | cellIdentity.cellIdentityGsm[0].arfcn = rilCellIdentity.cellIdentityGsm.arfcn; |
| 2970 | cellIdentity.cellIdentityGsm[0].bsic = rilCellIdentity.cellIdentityGsm.bsic; |
| 2971 | break; |
| 2972 | } |
| 2973 | |
| 2974 | case RIL_CELL_INFO_TYPE_WCDMA: { |
| 2975 | cellIdentity.cellIdentityWcdma.resize(1); |
| 2976 | cellIdentity.cellIdentityWcdma[0].mcc = |
| 2977 | std::to_string(rilCellIdentity.cellIdentityWcdma.mcc); |
| 2978 | cellIdentity.cellIdentityWcdma[0].mnc = |
| 2979 | std::to_string(rilCellIdentity.cellIdentityWcdma.mnc); |
| 2980 | cellIdentity.cellIdentityWcdma[0].lac = rilCellIdentity.cellIdentityWcdma.lac; |
| 2981 | cellIdentity.cellIdentityWcdma[0].cid = rilCellIdentity.cellIdentityWcdma.cid; |
| 2982 | cellIdentity.cellIdentityWcdma[0].psc = rilCellIdentity.cellIdentityWcdma.psc; |
| 2983 | cellIdentity.cellIdentityWcdma[0].uarfcn = rilCellIdentity.cellIdentityWcdma.uarfcn; |
| 2984 | break; |
| 2985 | } |
| 2986 | |
| 2987 | case RIL_CELL_INFO_TYPE_CDMA: { |
| 2988 | cellIdentity.cellIdentityCdma.resize(1); |
| 2989 | cellIdentity.cellIdentityCdma[0].networkId = rilCellIdentity.cellIdentityCdma.networkId; |
| 2990 | cellIdentity.cellIdentityCdma[0].systemId = rilCellIdentity.cellIdentityCdma.systemId; |
| 2991 | cellIdentity.cellIdentityCdma[0].baseStationId = |
| 2992 | rilCellIdentity.cellIdentityCdma.basestationId; |
| 2993 | cellIdentity.cellIdentityCdma[0].longitude = rilCellIdentity.cellIdentityCdma.longitude; |
| 2994 | cellIdentity.cellIdentityCdma[0].latitude = rilCellIdentity.cellIdentityCdma.latitude; |
| 2995 | break; |
| 2996 | } |
| 2997 | |
| 2998 | case RIL_CELL_INFO_TYPE_LTE: { |
| 2999 | cellIdentity.cellIdentityLte.resize(1); |
| 3000 | cellIdentity.cellIdentityLte[0].mcc = |
| 3001 | std::to_string(rilCellIdentity.cellIdentityLte.mcc); |
| 3002 | cellIdentity.cellIdentityLte[0].mnc = |
| 3003 | std::to_string(rilCellIdentity.cellIdentityLte.mnc); |
| 3004 | cellIdentity.cellIdentityLte[0].ci = rilCellIdentity.cellIdentityLte.ci; |
| 3005 | cellIdentity.cellIdentityLte[0].pci = rilCellIdentity.cellIdentityLte.pci; |
| 3006 | cellIdentity.cellIdentityLte[0].tac = rilCellIdentity.cellIdentityLte.tac; |
| 3007 | cellIdentity.cellIdentityLte[0].earfcn = rilCellIdentity.cellIdentityLte.earfcn; |
| 3008 | break; |
| 3009 | } |
| 3010 | |
| 3011 | case RIL_CELL_INFO_TYPE_TD_SCDMA: { |
| 3012 | cellIdentity.cellIdentityTdscdma.resize(1); |
| 3013 | cellIdentity.cellIdentityTdscdma[0].mcc = |
| 3014 | std::to_string(rilCellIdentity.cellIdentityTdscdma.mcc); |
| 3015 | cellIdentity.cellIdentityTdscdma[0].mnc = |
| 3016 | std::to_string(rilCellIdentity.cellIdentityTdscdma.mnc); |
| 3017 | cellIdentity.cellIdentityTdscdma[0].lac = rilCellIdentity.cellIdentityTdscdma.lac; |
| 3018 | cellIdentity.cellIdentityTdscdma[0].cid = rilCellIdentity.cellIdentityTdscdma.cid; |
| 3019 | cellIdentity.cellIdentityTdscdma[0].cpid = rilCellIdentity.cellIdentityTdscdma.cpid; |
| 3020 | break; |
| 3021 | } |
| 3022 | |
| 3023 | default: { |
| 3024 | break; |
| 3025 | } |
| 3026 | } |
| 3027 | } |
| 3028 | |
| 3029 | int convertResponseStringEntryToInt(char **response, int index, int numStrings) { |
| 3030 | if ((response != NULL) && (numStrings > index) && (response[index] != NULL)) { |
| 3031 | return atoi(response[index]); |
| 3032 | } |
| 3033 | |
| 3034 | return -1; |
| 3035 | } |
| 3036 | |
| 3037 | void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity, |
| 3038 | int numStrings, char** response) { |
| 3039 | |
| 3040 | RIL_CellIdentity_v16 rilCellIdentity; |
| 3041 | int32_t *tmp = (int32_t*)&rilCellIdentity; |
| 3042 | |
Nathan Harold | 2593b01 | 2017-03-01 18:57:56 -0800 | [diff] [blame] | 3043 | for (size_t i = 0; i < sizeof(RIL_CellIdentity_v16)/sizeof(int32_t); i++) { |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3044 | tmp[i] = -1; |
| 3045 | } |
| 3046 | |
| 3047 | rilCellIdentity.cellInfoType = getCellInfoTypeRadioTechnology(response[3]); |
| 3048 | switch(rilCellIdentity.cellInfoType) { |
| 3049 | |
| 3050 | case RIL_CELL_INFO_TYPE_GSM: { |
| 3051 | rilCellIdentity.cellIdentityGsm.lac = |
| 3052 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3053 | rilCellIdentity.cellIdentityGsm.cid = |
| 3054 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3055 | break; |
| 3056 | } |
| 3057 | |
| 3058 | case RIL_CELL_INFO_TYPE_WCDMA: { |
| 3059 | rilCellIdentity.cellIdentityWcdma.lac = |
| 3060 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3061 | rilCellIdentity.cellIdentityWcdma.cid = |
| 3062 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3063 | rilCellIdentity.cellIdentityWcdma.psc = |
| 3064 | convertResponseStringEntryToInt(response, 14, numStrings); |
| 3065 | break; |
| 3066 | } |
| 3067 | |
| 3068 | case RIL_CELL_INFO_TYPE_TD_SCDMA:{ |
| 3069 | rilCellIdentity.cellIdentityTdscdma.lac = |
| 3070 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3071 | rilCellIdentity.cellIdentityTdscdma.cid = |
| 3072 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3073 | break; |
| 3074 | } |
| 3075 | |
| 3076 | case RIL_CELL_INFO_TYPE_CDMA:{ |
| 3077 | rilCellIdentity.cellIdentityCdma.basestationId = |
| 3078 | convertResponseStringEntryToInt(response, 4, numStrings); |
| 3079 | rilCellIdentity.cellIdentityCdma.longitude = |
| 3080 | convertResponseStringEntryToInt(response, 5, numStrings); |
| 3081 | rilCellIdentity.cellIdentityCdma.latitude = |
| 3082 | convertResponseStringEntryToInt(response, 6, numStrings); |
| 3083 | rilCellIdentity.cellIdentityCdma.systemId = |
| 3084 | convertResponseStringEntryToInt(response, 8, numStrings); |
| 3085 | rilCellIdentity.cellIdentityCdma.networkId = |
| 3086 | convertResponseStringEntryToInt(response, 9, numStrings); |
| 3087 | break; |
| 3088 | } |
| 3089 | |
Sooraj Sasindran | f28e42a | 2017-03-06 23:07:22 -0800 | [diff] [blame] | 3090 | case RIL_CELL_INFO_TYPE_LTE:{ |
| 3091 | rilCellIdentity.cellIdentityLte.tac = |
| 3092 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3093 | rilCellIdentity.cellIdentityLte.ci = |
| 3094 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3095 | break; |
| 3096 | } |
| 3097 | |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3098 | default: { |
| 3099 | break; |
| 3100 | } |
| 3101 | } |
| 3102 | |
| 3103 | fillCellIdentityResponse(cellIdentity, rilCellIdentity); |
| 3104 | } |
| 3105 | |
| 3106 | void fillCellIdentityFromDataRegStateResponseString(CellIdentity &cellIdentity, |
| 3107 | int numStrings, char** response) { |
| 3108 | |
| 3109 | RIL_CellIdentity_v16 rilCellIdentity; |
| 3110 | int32_t *tmp = (int32_t*)&rilCellIdentity; |
| 3111 | |
Nathan Harold | 2593b01 | 2017-03-01 18:57:56 -0800 | [diff] [blame] | 3112 | for (size_t i = 0; i < sizeof(RIL_CellIdentity_v16)/sizeof(int32_t); i++) { |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3113 | tmp[i] = -1; |
| 3114 | } |
| 3115 | |
| 3116 | rilCellIdentity.cellInfoType = getCellInfoTypeRadioTechnology(response[3]); |
| 3117 | switch(rilCellIdentity.cellInfoType) { |
| 3118 | case RIL_CELL_INFO_TYPE_GSM: { |
| 3119 | rilCellIdentity.cellIdentityGsm.lac = |
| 3120 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3121 | rilCellIdentity.cellIdentityGsm.cid = |
| 3122 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3123 | break; |
| 3124 | } |
| 3125 | case RIL_CELL_INFO_TYPE_WCDMA: { |
| 3126 | rilCellIdentity.cellIdentityWcdma.lac = |
| 3127 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3128 | rilCellIdentity.cellIdentityWcdma.cid = |
| 3129 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3130 | break; |
| 3131 | } |
| 3132 | case RIL_CELL_INFO_TYPE_TD_SCDMA:{ |
| 3133 | rilCellIdentity.cellIdentityTdscdma.lac = |
| 3134 | convertResponseStringEntryToInt(response, 1, numStrings); |
| 3135 | rilCellIdentity.cellIdentityTdscdma.cid = |
| 3136 | convertResponseStringEntryToInt(response, 2, numStrings); |
| 3137 | break; |
| 3138 | } |
| 3139 | case RIL_CELL_INFO_TYPE_LTE: { |
| 3140 | rilCellIdentity.cellIdentityLte.tac = |
| 3141 | convertResponseStringEntryToInt(response, 6, numStrings); |
| 3142 | rilCellIdentity.cellIdentityLte.pci = |
| 3143 | convertResponseStringEntryToInt(response, 7, numStrings); |
| 3144 | rilCellIdentity.cellIdentityLte.ci = |
| 3145 | convertResponseStringEntryToInt(response, 8, numStrings); |
| 3146 | break; |
| 3147 | } |
| 3148 | default: { |
| 3149 | break; |
| 3150 | } |
| 3151 | } |
| 3152 | |
| 3153 | fillCellIdentityResponse(cellIdentity, rilCellIdentity); |
| 3154 | } |
| 3155 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3156 | int radio::getVoiceRegistrationStateResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3157 | int responseType, int serial, RIL_Errno e, |
| 3158 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3159 | RLOGD("getVoiceRegistrationStateResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3160 | |
| 3161 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3162 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3163 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3164 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3165 | VoiceRegStateResult voiceRegResponse = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3166 | int numStrings = responseLen / sizeof(char *); |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3167 | if (response == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3168 | RLOGE("getVoiceRegistrationStateResponse Invalid response: NULL"); |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3169 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3170 | } else if (s_vendorFunctions->version <= 14) { |
| 3171 | if (numStrings != 15) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3172 | RLOGE("getVoiceRegistrationStateResponse Invalid response: NULL"); |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3173 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3174 | } else { |
| 3175 | char **resp = (char **) response; |
| 3176 | voiceRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4); |
| 3177 | voiceRegResponse.rat = ATOI_NULL_HANDLED(resp[3]); |
| 3178 | voiceRegResponse.cssSupported = ATOI_NULL_HANDLED_DEF(resp[7], 0); |
| 3179 | voiceRegResponse.roamingIndicator = ATOI_NULL_HANDLED(resp[10]); |
| 3180 | voiceRegResponse.systemIsInPrl = ATOI_NULL_HANDLED_DEF(resp[11], 0); |
| 3181 | voiceRegResponse.defaultRoamingIndicator = ATOI_NULL_HANDLED_DEF(resp[12], 0); |
| 3182 | voiceRegResponse.reasonForDenial = ATOI_NULL_HANDLED_DEF(resp[13], 0); |
| 3183 | fillCellIdentityFromVoiceRegStateResponseString(voiceRegResponse.cellIdentity, |
| 3184 | numStrings, resp); |
| 3185 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3186 | } else { |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3187 | RIL_VoiceRegistrationStateResponse *voiceRegState = |
| 3188 | (RIL_VoiceRegistrationStateResponse *)response; |
| 3189 | |
| 3190 | if (responseLen != sizeof(RIL_VoiceRegistrationStateResponse)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3191 | RLOGE("getVoiceRegistrationStateResponse Invalid response: NULL"); |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3192 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3193 | } else { |
| 3194 | voiceRegResponse.regState = (RegState) voiceRegState->regState; |
| 3195 | voiceRegResponse.rat = voiceRegState->rat;; |
| 3196 | voiceRegResponse.cssSupported = voiceRegState->cssSupported; |
| 3197 | voiceRegResponse.roamingIndicator = voiceRegState->roamingIndicator; |
| 3198 | voiceRegResponse.systemIsInPrl = voiceRegState->systemIsInPrl; |
| 3199 | voiceRegResponse.defaultRoamingIndicator = voiceRegState->defaultRoamingIndicator; |
| 3200 | voiceRegResponse.reasonForDenial = voiceRegState->reasonForDenial; |
| 3201 | fillCellIdentityResponse(voiceRegResponse.cellIdentity, |
| 3202 | voiceRegState->cellIdentity); |
| 3203 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3204 | } |
| 3205 | |
| 3206 | Return<void> retStatus = |
| 3207 | radioService[slotId]->mRadioResponse->getVoiceRegistrationStateResponse( |
| 3208 | responseInfo, voiceRegResponse); |
| 3209 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3210 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3211 | RLOGE("getVoiceRegistrationStateResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3212 | slotId); |
| 3213 | } |
| 3214 | |
| 3215 | return 0; |
| 3216 | } |
| 3217 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3218 | int radio::getDataRegistrationStateResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3219 | int responseType, int serial, RIL_Errno e, |
| 3220 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3221 | RLOGD("getDataRegistrationStateResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3222 | |
| 3223 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3224 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3225 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3226 | DataRegStateResult dataRegResponse = {}; |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3227 | if (response == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3228 | RLOGE("getDataRegistrationStateResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3229 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3230 | } else if (s_vendorFunctions->version <= 14) { |
| 3231 | int numStrings = responseLen / sizeof(char *); |
| 3232 | if ((numStrings != 6) && (numStrings != 11)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3233 | RLOGE("getDataRegistrationStateResponse Invalid response: NULL"); |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3234 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3235 | } else { |
| 3236 | char **resp = (char **) response; |
| 3237 | dataRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4); |
| 3238 | dataRegResponse.rat = ATOI_NULL_HANDLED_DEF(resp[3], 0); |
| 3239 | dataRegResponse.reasonDataDenied = ATOI_NULL_HANDLED(resp[4]); |
| 3240 | dataRegResponse.maxDataCalls = ATOI_NULL_HANDLED_DEF(resp[5], 1); |
| 3241 | fillCellIdentityFromDataRegStateResponseString(dataRegResponse.cellIdentity, |
| 3242 | numStrings, resp); |
| 3243 | } |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3244 | } else { |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3245 | RIL_DataRegistrationStateResponse *dataRegState = |
| 3246 | (RIL_DataRegistrationStateResponse *)response; |
| 3247 | |
| 3248 | if (responseLen != sizeof(RIL_DataRegistrationStateResponse)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3249 | RLOGE("getDataRegistrationStateResponse Invalid response: NULL"); |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 3250 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3251 | } else { |
| 3252 | dataRegResponse.regState = (RegState) dataRegState->regState; |
| 3253 | dataRegResponse.rat = dataRegState->rat;; |
| 3254 | dataRegResponse.reasonDataDenied = dataRegState->reasonDataDenied; |
| 3255 | dataRegResponse.maxDataCalls = dataRegState->maxDataCalls; |
| 3256 | fillCellIdentityResponse(dataRegResponse.cellIdentity, dataRegState->cellIdentity); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3257 | } |
| 3258 | } |
| 3259 | |
| 3260 | Return<void> retStatus = |
| 3261 | radioService[slotId]->mRadioResponse->getDataRegistrationStateResponse(responseInfo, |
| 3262 | dataRegResponse); |
| 3263 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3264 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3265 | RLOGE("getDataRegistrationStateResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3266 | slotId); |
| 3267 | } |
| 3268 | |
| 3269 | return 0; |
| 3270 | } |
| 3271 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3272 | int radio::getOperatorResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3273 | int responseType, int serial, RIL_Errno e, void *response, |
| 3274 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3275 | RLOGD("getOperatorResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3276 | |
| 3277 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3278 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3279 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3280 | hidl_string longName; |
| 3281 | hidl_string shortName; |
| 3282 | hidl_string numeric; |
| 3283 | int numStrings = responseLen / sizeof(char *); |
| 3284 | if (response == NULL || numStrings != 3) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3285 | RLOGE("getOperatorResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3286 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3287 | |
| 3288 | } else { |
| 3289 | char **resp = (char **) response; |
| 3290 | longName = convertCharPtrToHidlString(resp[0]); |
| 3291 | shortName = convertCharPtrToHidlString(resp[1]); |
| 3292 | numeric = convertCharPtrToHidlString(resp[2]); |
| 3293 | } |
| 3294 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getOperatorResponse( |
| 3295 | responseInfo, longName, shortName, numeric); |
| 3296 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3297 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3298 | RLOGE("getOperatorResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3299 | slotId); |
| 3300 | } |
| 3301 | |
| 3302 | return 0; |
| 3303 | } |
| 3304 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3305 | int radio::setRadioPowerResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3306 | int responseType, int serial, RIL_Errno e, void *response, |
| 3307 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3308 | RLOGD("setRadioPowerResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3309 | |
| 3310 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3311 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3312 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3313 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setRadioPowerResponse( |
| 3314 | responseInfo); |
| 3315 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3316 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3317 | RLOGE("setRadioPowerResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3318 | slotId); |
| 3319 | } |
| 3320 | |
| 3321 | return 0; |
| 3322 | } |
| 3323 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3324 | int radio::sendDtmfResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3325 | int responseType, int serial, RIL_Errno e, void *response, |
| 3326 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3327 | RLOGD("sendDtmfResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3328 | |
| 3329 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3330 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3331 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3332 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendDtmfResponse( |
| 3333 | responseInfo); |
| 3334 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3335 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3336 | RLOGE("sendDtmfResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3337 | slotId); |
| 3338 | } |
| 3339 | |
| 3340 | return 0; |
| 3341 | } |
| 3342 | |
| 3343 | SendSmsResult makeSendSmsResult(RadioResponseInfo& responseInfo, int serial, int responseType, |
| 3344 | RIL_Errno e, void *response, size_t responseLen) { |
| 3345 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3346 | SendSmsResult result = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3347 | |
| 3348 | if (response == NULL || responseLen != sizeof(RIL_SMS_Response)) { |
| 3349 | RLOGE("Invalid response: NULL"); |
| 3350 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3351 | result.ackPDU = hidl_string(); |
| 3352 | } else { |
| 3353 | RIL_SMS_Response *resp = (RIL_SMS_Response *) response; |
| 3354 | result.messageRef = resp->messageRef; |
| 3355 | result.ackPDU = convertCharPtrToHidlString(resp->ackPDU); |
| 3356 | result.errorCode = resp->errorCode; |
| 3357 | } |
| 3358 | return result; |
| 3359 | } |
| 3360 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3361 | int radio::sendSmsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3362 | int responseType, int serial, RIL_Errno e, void *response, |
| 3363 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3364 | RLOGD("sendSmsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3365 | |
| 3366 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3367 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3368 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 3369 | responseLen); |
| 3370 | |
| 3371 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendSmsResponse(responseInfo, |
| 3372 | result); |
| 3373 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3374 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3375 | RLOGE("sendSmsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3376 | } |
| 3377 | |
| 3378 | return 0; |
| 3379 | } |
| 3380 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3381 | int radio::sendSMSExpectMoreResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3382 | int responseType, int serial, RIL_Errno e, void *response, |
| 3383 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3384 | RLOGD("sendSMSExpectMoreResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3385 | |
| 3386 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3387 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3388 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 3389 | responseLen); |
| 3390 | |
| 3391 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendSMSExpectMoreResponse( |
| 3392 | responseInfo, result); |
| 3393 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3394 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3395 | RLOGE("sendSMSExpectMoreResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3396 | } |
| 3397 | |
| 3398 | return 0; |
| 3399 | } |
| 3400 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3401 | int radio::setupDataCallResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3402 | int responseType, int serial, RIL_Errno e, void *response, |
| 3403 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3404 | RLOGD("setupDataCallResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3405 | |
| 3406 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3407 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3408 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3409 | |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3410 | SetupDataCallResult result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3411 | if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3412 | RLOGE("setupDataCallResponse: Invalid response"); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3413 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Jack Yu | 5079e18 | 2017-02-28 15:21:18 -0800 | [diff] [blame] | 3414 | result.status = DataCallFailCause::ERROR_UNSPECIFIED; |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 3415 | result.type = hidl_string(); |
| 3416 | result.ifname = hidl_string(); |
| 3417 | result.addresses = hidl_string(); |
| 3418 | result.dnses = hidl_string(); |
| 3419 | result.gateways = hidl_string(); |
| 3420 | result.pcscf = hidl_string(); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3421 | } else { |
| 3422 | convertRilDataCallToHal((RIL_Data_Call_Response_v11 *) response, result); |
| 3423 | } |
| 3424 | |
| 3425 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setupDataCallResponse( |
| 3426 | responseInfo, result); |
| 3427 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3428 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3429 | RLOGE("setupDataCallResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 3430 | } |
| 3431 | |
| 3432 | return 0; |
| 3433 | } |
| 3434 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3435 | IccIoResult responseIccIo(RadioResponseInfo& responseInfo, int serial, int responseType, |
| 3436 | RIL_Errno e, void *response, size_t responseLen) { |
| 3437 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3438 | IccIoResult result = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3439 | |
| 3440 | if (response == NULL || responseLen != sizeof(RIL_SIM_IO_Response)) { |
| 3441 | RLOGE("Invalid response: NULL"); |
| 3442 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3443 | result.simResponse = hidl_string(); |
| 3444 | } else { |
| 3445 | RIL_SIM_IO_Response *resp = (RIL_SIM_IO_Response *) response; |
| 3446 | result.sw1 = resp->sw1; |
| 3447 | result.sw2 = resp->sw2; |
| 3448 | result.simResponse = convertCharPtrToHidlString(resp->simResponse); |
| 3449 | } |
| 3450 | return result; |
| 3451 | } |
| 3452 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3453 | int radio::iccIOForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3454 | int responseType, int serial, RIL_Errno e, void *response, |
| 3455 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3456 | RLOGD("iccIOForAppResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3457 | |
| 3458 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3459 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3460 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 3461 | responseLen); |
| 3462 | |
| 3463 | Return<void> retStatus = radioService[slotId]->mRadioResponse->iccIOForAppResponse( |
| 3464 | responseInfo, result); |
| 3465 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3466 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3467 | RLOGE("iccIOForAppResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3468 | } |
| 3469 | |
| 3470 | return 0; |
| 3471 | } |
| 3472 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3473 | int radio::sendUssdResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3474 | int responseType, int serial, RIL_Errno e, void *response, |
| 3475 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3476 | RLOGD("sendUssdResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3477 | |
| 3478 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3479 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3480 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3481 | Return<void> retStatus = radioService[slotId]->mRadioResponse->sendUssdResponse( |
| 3482 | responseInfo); |
| 3483 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3484 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3485 | RLOGE("sendUssdResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3486 | slotId); |
| 3487 | } |
| 3488 | |
| 3489 | return 0; |
| 3490 | } |
| 3491 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3492 | int radio::cancelPendingUssdResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3493 | int responseType, int serial, RIL_Errno e, void *response, |
| 3494 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3495 | RLOGD("cancelPendingUssdResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3496 | |
| 3497 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3498 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3499 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3500 | Return<void> retStatus = radioService[slotId]->mRadioResponse->cancelPendingUssdResponse( |
| 3501 | responseInfo); |
| 3502 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3503 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3504 | RLOGE("cancelPendingUssdResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3505 | slotId); |
| 3506 | } |
| 3507 | |
| 3508 | return 0; |
| 3509 | } |
| 3510 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3511 | int radio::getClirResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3512 | int responseType, int serial, RIL_Errno e, void *response, |
| 3513 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3514 | RLOGD("getClirResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3515 | |
| 3516 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3517 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3518 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3519 | int n = -1, m = -1; |
| 3520 | int numInts = responseLen / sizeof(int); |
| 3521 | if (response == NULL || numInts != 2) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3522 | RLOGE("getClirResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3523 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3524 | } else { |
| 3525 | int *pInt = (int *) response; |
| 3526 | n = pInt[0]; |
| 3527 | m = pInt[1]; |
| 3528 | } |
| 3529 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getClirResponse(responseInfo, |
| 3530 | n, m); |
| 3531 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3532 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3533 | RLOGE("getClirResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3534 | } |
| 3535 | |
| 3536 | return 0; |
| 3537 | } |
| 3538 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3539 | int radio::setClirResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3540 | int responseType, int serial, RIL_Errno e, void *response, |
| 3541 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3542 | RLOGD("setClirResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3543 | |
| 3544 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3545 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3546 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3547 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setClirResponse( |
| 3548 | responseInfo); |
| 3549 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3550 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3551 | RLOGE("setClirResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3552 | } |
| 3553 | |
| 3554 | return 0; |
| 3555 | } |
| 3556 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3557 | int radio::getCallForwardStatusResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3558 | int responseType, int serial, RIL_Errno e, |
| 3559 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3560 | RLOGD("getCallForwardStatusResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3561 | |
| 3562 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3563 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3564 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3565 | hidl_vec<CallForwardInfo> callForwardInfos; |
| 3566 | |
| 3567 | if (response == NULL || responseLen % sizeof(RIL_CallForwardInfo *) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3568 | RLOGE("getCallForwardStatusResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3569 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3570 | } else { |
| 3571 | int num = responseLen / sizeof(RIL_CallForwardInfo *); |
| 3572 | callForwardInfos.resize(num); |
| 3573 | for (int i = 0 ; i < num; i++) { |
| 3574 | RIL_CallForwardInfo *resp = ((RIL_CallForwardInfo **) response)[i]; |
| 3575 | callForwardInfos[i].status = (CallForwardInfoStatus) resp->status; |
| 3576 | callForwardInfos[i].reason = resp->reason; |
| 3577 | callForwardInfos[i].serviceClass = resp->serviceClass; |
| 3578 | callForwardInfos[i].toa = resp->toa; |
| 3579 | callForwardInfos[i].number = convertCharPtrToHidlString(resp->number); |
| 3580 | callForwardInfos[i].timeSeconds = resp->timeSeconds; |
| 3581 | } |
| 3582 | } |
| 3583 | |
| 3584 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getCallForwardStatusResponse( |
| 3585 | responseInfo, callForwardInfos); |
| 3586 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3587 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3588 | RLOGE("getCallForwardStatusResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3589 | slotId); |
| 3590 | } |
| 3591 | |
| 3592 | return 0; |
| 3593 | } |
| 3594 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3595 | int radio::setCallForwardResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3596 | int responseType, int serial, RIL_Errno e, void *response, |
| 3597 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3598 | RLOGD("setCallForwardResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3599 | |
| 3600 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3601 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3602 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3603 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setCallForwardResponse( |
| 3604 | responseInfo); |
| 3605 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3606 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3607 | RLOGE("setCallForwardResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3608 | } |
| 3609 | |
| 3610 | return 0; |
| 3611 | } |
| 3612 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3613 | int radio::getCallWaitingResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3614 | int responseType, int serial, RIL_Errno e, void *response, |
| 3615 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3616 | RLOGD("getCallWaitingResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3617 | |
| 3618 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3619 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3620 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3621 | bool enable = false; |
| 3622 | int serviceClass = -1; |
| 3623 | int numInts = responseLen / sizeof(int); |
| 3624 | if (response == NULL || numInts != 2) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3625 | RLOGE("getCallWaitingResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3626 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3627 | } else { |
| 3628 | int *pInt = (int *) response; |
| 3629 | enable = pInt[0] == 1 ? true : false; |
| 3630 | serviceClass = pInt[1]; |
| 3631 | } |
Sanket Padawe | 5375bfa | 2017-03-07 17:21:05 -0800 | [diff] [blame] | 3632 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getCallWaitingResponse( |
| 3633 | responseInfo, enable, serviceClass); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3634 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3635 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3636 | RLOGE("getCallWaitingResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3637 | } |
| 3638 | |
| 3639 | return 0; |
| 3640 | } |
| 3641 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3642 | int radio::setCallWaitingResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3643 | int responseType, int serial, RIL_Errno e, void *response, |
| 3644 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3645 | RLOGD("setCallWaitingResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3646 | |
| 3647 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3648 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3649 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3650 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setCallWaitingResponse( |
| 3651 | responseInfo); |
| 3652 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3653 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3654 | RLOGE("setCallWaitingResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3655 | } |
| 3656 | |
| 3657 | return 0; |
| 3658 | } |
| 3659 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3660 | int radio::acknowledgeLastIncomingGsmSmsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3661 | int responseType, int serial, RIL_Errno e, |
| 3662 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3663 | RLOGD("acknowledgeLastIncomingGsmSmsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3664 | |
| 3665 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3666 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3667 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3668 | Return<void> retStatus = |
| 3669 | radioService[slotId]->mRadioResponse->acknowledgeLastIncomingGsmSmsResponse( |
| 3670 | responseInfo); |
| 3671 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3672 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3673 | RLOGE("acknowledgeLastIncomingGsmSmsResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3674 | "== NULL", slotId); |
| 3675 | } |
| 3676 | |
| 3677 | return 0; |
| 3678 | } |
| 3679 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3680 | int radio::acceptCallResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3681 | int responseType, int serial, RIL_Errno e, |
| 3682 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3683 | RLOGD("acceptCallResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3684 | |
| 3685 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3686 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3687 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3688 | Return<void> retStatus = radioService[slotId]->mRadioResponse->acceptCallResponse( |
| 3689 | responseInfo); |
| 3690 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3691 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3692 | RLOGE("acceptCallResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3693 | slotId); |
| 3694 | } |
| 3695 | |
| 3696 | return 0; |
| 3697 | } |
| 3698 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3699 | int radio::deactivateDataCallResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3700 | int responseType, int serial, RIL_Errno e, |
| 3701 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3702 | RLOGD("deactivateDataCallResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3703 | |
| 3704 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3705 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3706 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3707 | Return<void> retStatus = radioService[slotId]->mRadioResponse->deactivateDataCallResponse( |
| 3708 | responseInfo); |
| 3709 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3710 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3711 | RLOGE("deactivateDataCallResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3712 | slotId); |
| 3713 | } |
| 3714 | |
| 3715 | return 0; |
| 3716 | } |
| 3717 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3718 | int radio::getFacilityLockForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3719 | int responseType, int serial, RIL_Errno e, |
| 3720 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3721 | RLOGD("getFacilityLockForAppResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3722 | |
| 3723 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3724 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3725 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 3726 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 3727 | getFacilityLockForAppResponse(responseInfo, ret); |
| 3728 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3729 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3730 | RLOGE("getFacilityLockForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3731 | slotId); |
| 3732 | } |
| 3733 | |
| 3734 | return 0; |
| 3735 | } |
| 3736 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3737 | int radio::setFacilityLockForAppResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3738 | int responseType, int serial, RIL_Errno e, |
| 3739 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3740 | RLOGD("setFacilityLockForAppResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3741 | |
| 3742 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3743 | RadioResponseInfo responseInfo = {}; |
Naveen Kalla | 346bbc0 | 2017-03-16 12:55:55 -0700 | [diff] [blame] | 3744 | int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3745 | Return<void> retStatus |
| 3746 | = radioService[slotId]->mRadioResponse->setFacilityLockForAppResponse(responseInfo, |
| 3747 | ret); |
| 3748 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3749 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3750 | RLOGE("setFacilityLockForAppResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3751 | slotId); |
| 3752 | } |
| 3753 | |
| 3754 | return 0; |
| 3755 | } |
| 3756 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3757 | int radio::setBarringPasswordResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3758 | int responseType, int serial, RIL_Errno e, |
| 3759 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3760 | RLOGD("acceptCallResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3761 | |
| 3762 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3763 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3764 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3765 | Return<void> retStatus |
| 3766 | = radioService[slotId]->mRadioResponse->setBarringPasswordResponse(responseInfo); |
| 3767 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3768 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3769 | RLOGE("setBarringPasswordResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3770 | slotId); |
| 3771 | } |
| 3772 | |
| 3773 | return 0; |
| 3774 | } |
| 3775 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3776 | int radio::getNetworkSelectionModeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3777 | int responseType, int serial, RIL_Errno e, void *response, |
| 3778 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3779 | RLOGD("getNetworkSelectionModeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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 | bool manual = false; |
| 3785 | int serviceClass; |
| 3786 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3787 | RLOGE("getNetworkSelectionModeResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3788 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3789 | } else { |
| 3790 | int *pInt = (int *) response; |
| 3791 | manual = pInt[0] == 1 ? true : false; |
| 3792 | } |
| 3793 | Return<void> retStatus |
| 3794 | = radioService[slotId]->mRadioResponse->getNetworkSelectionModeResponse( |
| 3795 | responseInfo, |
| 3796 | manual); |
| 3797 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3798 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3799 | RLOGE("getNetworkSelectionModeResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3800 | slotId); |
| 3801 | } |
| 3802 | |
| 3803 | return 0; |
| 3804 | } |
| 3805 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3806 | int radio::setNetworkSelectionModeAutomaticResponse(int slotId, int responseType, int serial, |
| 3807 | RIL_Errno e, void *response, |
| 3808 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3809 | RLOGD("setNetworkSelectionModeAutomaticResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3810 | |
| 3811 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3812 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3813 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3814 | Return<void> retStatus |
| 3815 | = radioService[slotId]->mRadioResponse->setNetworkSelectionModeAutomaticResponse( |
| 3816 | responseInfo); |
| 3817 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3818 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3819 | RLOGE("setNetworkSelectionModeAutomaticResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3820 | "== NULL", slotId); |
| 3821 | } |
| 3822 | |
| 3823 | return 0; |
| 3824 | } |
| 3825 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3826 | int radio::setNetworkSelectionModeManualResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3827 | int responseType, int serial, RIL_Errno e, |
| 3828 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3829 | RLOGD("setNetworkSelectionModeManualResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3830 | |
| 3831 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3832 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3833 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3834 | Return<void> retStatus |
| 3835 | = radioService[slotId]->mRadioResponse->setNetworkSelectionModeManualResponse( |
| 3836 | responseInfo); |
| 3837 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3838 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3839 | RLOGE("acceptCallResponse: radioService[%d]->setNetworkSelectionModeManualResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3840 | "== NULL", slotId); |
| 3841 | } |
| 3842 | |
| 3843 | return 0; |
| 3844 | } |
| 3845 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3846 | int convertOperatorStatusToInt(const char *str) { |
| 3847 | if (strncmp("unknown", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3848 | return (int) OperatorStatus::UNKNOWN; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3849 | } else if (strncmp("available", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3850 | return (int) OperatorStatus::AVAILABLE; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3851 | } else if (strncmp("current", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3852 | return (int) OperatorStatus::CURRENT; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3853 | } else if (strncmp("forbidden", str, 9) == 0) { |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3854 | return (int) OperatorStatus::FORBIDDEN; |
| 3855 | } else { |
| 3856 | return -1; |
| 3857 | } |
| 3858 | } |
| 3859 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3860 | int radio::getAvailableNetworksResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3861 | int responseType, int serial, RIL_Errno e, void *response, |
| 3862 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3863 | RLOGD("getAvailableNetworksResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3864 | |
| 3865 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3866 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3867 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3868 | hidl_vec<OperatorInfo> networks; |
| 3869 | if (response == NULL || responseLen % (4 * sizeof(char *))!= 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3870 | RLOGE("getAvailableNetworksResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3871 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3872 | } else { |
| 3873 | char **resp = (char **) response; |
| 3874 | int numStrings = responseLen / sizeof(char *); |
| 3875 | networks.resize(numStrings/4); |
Jayachandran C | e0d755c | 2017-03-01 18:26:50 -0800 | [diff] [blame] | 3876 | for (int i = 0, j = 0; i < numStrings; i = i + 4, j++) { |
| 3877 | networks[j].alphaLong = convertCharPtrToHidlString(resp[i]); |
| 3878 | networks[j].alphaShort = convertCharPtrToHidlString(resp[i + 1]); |
| 3879 | networks[j].operatorNumeric = convertCharPtrToHidlString(resp[i + 2]); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3880 | int status = convertOperatorStatusToInt(resp[i + 3]); |
| 3881 | if (status == -1) { |
| 3882 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 3883 | } else { |
Jayachandran C | e0d755c | 2017-03-01 18:26:50 -0800 | [diff] [blame] | 3884 | networks[j].status = (OperatorStatus) status; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3885 | } |
| 3886 | } |
| 3887 | } |
| 3888 | Return<void> retStatus |
| 3889 | = radioService[slotId]->mRadioResponse->getAvailableNetworksResponse(responseInfo, |
| 3890 | networks); |
| 3891 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3892 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3893 | RLOGE("getAvailableNetworksResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3894 | slotId); |
| 3895 | } |
| 3896 | |
| 3897 | return 0; |
| 3898 | } |
| 3899 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3900 | int radio::startDtmfResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3901 | int responseType, int serial, RIL_Errno e, |
| 3902 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3903 | RLOGD("startDtmfResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3904 | |
| 3905 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3906 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3907 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3908 | Return<void> retStatus |
| 3909 | = radioService[slotId]->mRadioResponse->startDtmfResponse(responseInfo); |
| 3910 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3911 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3912 | RLOGE("startDtmfResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3913 | } |
| 3914 | |
| 3915 | return 0; |
| 3916 | } |
| 3917 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3918 | int radio::stopDtmfResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3919 | int responseType, int serial, RIL_Errno e, |
| 3920 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3921 | RLOGD("stopDtmfResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3922 | |
| 3923 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3924 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3925 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3926 | Return<void> retStatus |
| 3927 | = radioService[slotId]->mRadioResponse->stopDtmfResponse(responseInfo); |
| 3928 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3929 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3930 | RLOGE("stopDtmfResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3931 | } |
| 3932 | |
| 3933 | return 0; |
| 3934 | } |
| 3935 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3936 | int radio::getBasebandVersionResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3937 | int responseType, int serial, RIL_Errno e, |
| 3938 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3939 | RLOGD("getBasebandVersionResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3940 | |
| 3941 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3942 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3943 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3944 | Return<void> retStatus |
| 3945 | = radioService[slotId]->mRadioResponse->getBasebandVersionResponse(responseInfo, |
| 3946 | convertCharPtrToHidlString((char *) response)); |
| 3947 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3948 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3949 | RLOGE("getBasebandVersionResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3950 | } |
| 3951 | |
| 3952 | return 0; |
| 3953 | } |
| 3954 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3955 | int radio::separateConnectionResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3956 | int responseType, int serial, RIL_Errno e, |
| 3957 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3958 | RLOGD("separateConnectionResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3959 | |
| 3960 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3961 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3962 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3963 | Return<void> retStatus |
| 3964 | = radioService[slotId]->mRadioResponse->separateConnectionResponse(responseInfo); |
| 3965 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3966 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3967 | RLOGE("separateConnectionResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3968 | slotId); |
| 3969 | } |
| 3970 | |
| 3971 | return 0; |
| 3972 | } |
| 3973 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3974 | int radio::setMuteResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3975 | int responseType, int serial, RIL_Errno e, |
| 3976 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3977 | RLOGD("setMuteResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3978 | |
| 3979 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3980 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3981 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 3982 | Return<void> retStatus |
| 3983 | = radioService[slotId]->mRadioResponse->setMuteResponse(responseInfo); |
| 3984 | radioService[slotId]->checkReturnStatus(retStatus); |
| 3985 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3986 | RLOGE("setMuteResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3987 | } |
| 3988 | |
| 3989 | return 0; |
| 3990 | } |
| 3991 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 3992 | int radio::getMuteResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3993 | int responseType, int serial, RIL_Errno e, void *response, |
| 3994 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 3995 | RLOGD("getMuteResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3996 | |
| 3997 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 3998 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 3999 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4000 | bool enable = false; |
| 4001 | int serviceClass; |
| 4002 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4003 | RLOGE("getMuteResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4004 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4005 | } else { |
| 4006 | int *pInt = (int *) response; |
| 4007 | enable = pInt[0] == 1 ? true : false; |
| 4008 | } |
| 4009 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getMuteResponse(responseInfo, |
| 4010 | enable); |
| 4011 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4012 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4013 | RLOGE("getMuteResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4014 | } |
| 4015 | |
| 4016 | return 0; |
| 4017 | } |
| 4018 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4019 | int radio::getClipResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4020 | int responseType, int serial, RIL_Errno e, |
| 4021 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4022 | RLOGD("getClipResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4023 | |
| 4024 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4025 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4026 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4027 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getClipResponse(responseInfo, |
| 4028 | (ClipStatus) ret); |
| 4029 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4030 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4031 | RLOGE("getClipResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4032 | } |
| 4033 | |
| 4034 | return 0; |
| 4035 | } |
| 4036 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4037 | int radio::getDataCallListResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4038 | int responseType, int serial, RIL_Errno e, |
| 4039 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4040 | RLOGD("getDataCallListResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4041 | |
| 4042 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 4043 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4044 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4045 | |
| 4046 | hidl_vec<SetupDataCallResult> ret; |
| 4047 | if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4048 | RLOGE("getDataCallListResponse: invalid response"); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4049 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4050 | } else { |
| 4051 | convertRilDataCallListToHal(response, responseLen, ret); |
| 4052 | } |
| 4053 | |
| 4054 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getDataCallListResponse( |
| 4055 | responseInfo, ret); |
| 4056 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4057 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4058 | RLOGE("getDataCallListResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 4059 | } |
| 4060 | |
| 4061 | return 0; |
| 4062 | } |
| 4063 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4064 | int radio::setSuppServiceNotificationsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4065 | int responseType, int serial, RIL_Errno e, |
| 4066 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4067 | RLOGD("setSuppServiceNotificationsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4068 | |
| 4069 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4070 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4071 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4072 | Return<void> retStatus |
| 4073 | = radioService[slotId]->mRadioResponse->setSuppServiceNotificationsResponse( |
| 4074 | responseInfo); |
| 4075 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4076 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4077 | RLOGE("setSuppServiceNotificationsResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4078 | "== NULL", slotId); |
| 4079 | } |
| 4080 | |
| 4081 | return 0; |
| 4082 | } |
| 4083 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4084 | int radio::deleteSmsOnSimResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4085 | int responseType, int serial, RIL_Errno e, |
| 4086 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4087 | RLOGD("deleteSmsOnSimResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4088 | |
| 4089 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4090 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4091 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4092 | Return<void> retStatus |
| 4093 | = radioService[slotId]->mRadioResponse->deleteSmsOnSimResponse(responseInfo); |
| 4094 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4095 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4096 | RLOGE("deleteSmsOnSimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4097 | } |
| 4098 | |
| 4099 | return 0; |
| 4100 | } |
| 4101 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4102 | int radio::setBandModeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4103 | int responseType, int serial, RIL_Errno e, |
| 4104 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4105 | RLOGD("setBandModeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4106 | |
| 4107 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4108 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4109 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4110 | Return<void> retStatus |
| 4111 | = radioService[slotId]->mRadioResponse->setBandModeResponse(responseInfo); |
| 4112 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4113 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4114 | RLOGE("setBandModeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4115 | } |
| 4116 | |
| 4117 | return 0; |
| 4118 | } |
| 4119 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4120 | int radio::writeSmsToSimResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4121 | int responseType, int serial, RIL_Errno e, |
| 4122 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4123 | RLOGD("writeSmsToSimResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4124 | |
| 4125 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4126 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4127 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4128 | Return<void> retStatus |
| 4129 | = radioService[slotId]->mRadioResponse->writeSmsToSimResponse(responseInfo, ret); |
| 4130 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4131 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4132 | RLOGE("writeSmsToSimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4133 | } |
| 4134 | |
| 4135 | return 0; |
| 4136 | } |
| 4137 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4138 | int radio::getAvailableBandModesResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4139 | int responseType, int serial, RIL_Errno e, void *response, |
| 4140 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4141 | RLOGD("getAvailableBandModesResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4142 | |
| 4143 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4144 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4145 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4146 | hidl_vec<RadioBandMode> modes; |
| 4147 | if (response == NULL || responseLen % sizeof(int) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4148 | RLOGE("getAvailableBandModesResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4149 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4150 | } else { |
| 4151 | int *pInt = (int *) response; |
| 4152 | int numInts = responseLen / sizeof(int); |
| 4153 | modes.resize(numInts); |
| 4154 | for (int i = 0; i < numInts; i++) { |
| 4155 | modes[i] = (RadioBandMode) pInt[i]; |
| 4156 | } |
| 4157 | } |
| 4158 | Return<void> retStatus |
| 4159 | = radioService[slotId]->mRadioResponse->getAvailableBandModesResponse(responseInfo, |
| 4160 | modes); |
| 4161 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4162 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4163 | RLOGE("getAvailableBandModesResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4164 | slotId); |
| 4165 | } |
| 4166 | |
| 4167 | return 0; |
| 4168 | } |
| 4169 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4170 | int radio::sendEnvelopeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4171 | int responseType, int serial, RIL_Errno e, |
| 4172 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4173 | RLOGD("sendEnvelopeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4174 | |
| 4175 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4176 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4177 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4178 | Return<void> retStatus |
| 4179 | = radioService[slotId]->mRadioResponse->sendEnvelopeResponse(responseInfo, |
| 4180 | convertCharPtrToHidlString((char *) response)); |
| 4181 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4182 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4183 | RLOGE("sendEnvelopeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4184 | } |
| 4185 | |
| 4186 | return 0; |
| 4187 | } |
| 4188 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4189 | int radio::sendTerminalResponseToSimResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4190 | int responseType, int serial, RIL_Errno e, |
| 4191 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4192 | RLOGD("sendTerminalResponseToSimResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4193 | |
| 4194 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4195 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4196 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4197 | Return<void> retStatus |
| 4198 | = radioService[slotId]->mRadioResponse->sendTerminalResponseToSimResponse( |
| 4199 | responseInfo); |
| 4200 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4201 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4202 | RLOGE("sendTerminalResponseToSimResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4203 | slotId); |
| 4204 | } |
| 4205 | |
| 4206 | return 0; |
| 4207 | } |
| 4208 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4209 | int radio::handleStkCallSetupRequestFromSimResponse(int slotId, |
| 4210 | int responseType, int serial, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4211 | RIL_Errno e, void *response, |
| 4212 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4213 | RLOGD("handleStkCallSetupRequestFromSimResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4214 | |
| 4215 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4216 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4217 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4218 | Return<void> retStatus |
| 4219 | = radioService[slotId]->mRadioResponse->handleStkCallSetupRequestFromSimResponse( |
| 4220 | responseInfo); |
| 4221 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4222 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4223 | RLOGE("handleStkCallSetupRequestFromSimResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4224 | "== NULL", slotId); |
| 4225 | } |
| 4226 | |
| 4227 | return 0; |
| 4228 | } |
| 4229 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4230 | int radio::explicitCallTransferResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4231 | int responseType, int serial, RIL_Errno e, |
| 4232 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4233 | RLOGD("explicitCallTransferResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4234 | |
| 4235 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4236 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4237 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4238 | Return<void> retStatus |
| 4239 | = radioService[slotId]->mRadioResponse->explicitCallTransferResponse(responseInfo); |
| 4240 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4241 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4242 | RLOGE("explicitCallTransferResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4243 | slotId); |
| 4244 | } |
| 4245 | |
| 4246 | return 0; |
| 4247 | } |
| 4248 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4249 | int radio::setPreferredNetworkTypeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4250 | int responseType, int serial, RIL_Errno e, |
| 4251 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4252 | RLOGD("setPreferredNetworkTypeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4253 | |
| 4254 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4255 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4256 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4257 | Return<void> retStatus |
| 4258 | = radioService[slotId]->mRadioResponse->setPreferredNetworkTypeResponse( |
| 4259 | responseInfo); |
| 4260 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4261 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4262 | RLOGE("setPreferredNetworkTypeResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4263 | slotId); |
| 4264 | } |
| 4265 | |
| 4266 | return 0; |
| 4267 | } |
| 4268 | |
| 4269 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4270 | int radio::getPreferredNetworkTypeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4271 | int responseType, int serial, RIL_Errno e, |
| 4272 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4273 | RLOGD("getPreferredNetworkTypeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4274 | |
| 4275 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4276 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4277 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4278 | Return<void> retStatus |
| 4279 | = radioService[slotId]->mRadioResponse->getPreferredNetworkTypeResponse( |
| 4280 | responseInfo, (PreferredNetworkType) ret); |
| 4281 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4282 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4283 | RLOGE("getPreferredNetworkTypeResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4284 | slotId); |
| 4285 | } |
| 4286 | |
| 4287 | return 0; |
| 4288 | } |
| 4289 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4290 | int radio::getNeighboringCidsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4291 | int responseType, int serial, RIL_Errno e, |
| 4292 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4293 | RLOGD("getNeighboringCidsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4294 | |
| 4295 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4296 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4297 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4298 | hidl_vec<NeighboringCell> cells; |
| 4299 | |
| 4300 | if (response == NULL || responseLen % sizeof(RIL_NeighboringCell *) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4301 | RLOGE("getNeighboringCidsResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4302 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4303 | } else { |
| 4304 | int num = responseLen / sizeof(RIL_NeighboringCell *); |
| 4305 | cells.resize(num); |
| 4306 | for (int i = 0 ; i < num; i++) { |
| 4307 | RIL_NeighboringCell *resp = ((RIL_NeighboringCell **) response)[i]; |
| 4308 | cells[i].cid = convertCharPtrToHidlString(resp->cid); |
| 4309 | cells[i].rssi = resp->rssi; |
| 4310 | } |
| 4311 | } |
| 4312 | |
| 4313 | Return<void> retStatus |
| 4314 | = radioService[slotId]->mRadioResponse->getNeighboringCidsResponse(responseInfo, |
| 4315 | cells); |
| 4316 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4317 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4318 | RLOGE("getNeighboringCidsResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4319 | slotId); |
| 4320 | } |
| 4321 | |
| 4322 | return 0; |
| 4323 | } |
| 4324 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4325 | int radio::setLocationUpdatesResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4326 | int responseType, int serial, RIL_Errno e, |
| 4327 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4328 | RLOGD("setLocationUpdatesResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4329 | |
| 4330 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4331 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4332 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4333 | Return<void> retStatus |
| 4334 | = radioService[slotId]->mRadioResponse->setLocationUpdatesResponse(responseInfo); |
| 4335 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4336 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4337 | RLOGE("setLocationUpdatesResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4338 | slotId); |
| 4339 | } |
| 4340 | |
| 4341 | return 0; |
| 4342 | } |
| 4343 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4344 | int radio::setCdmaSubscriptionSourceResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4345 | int responseType, int serial, RIL_Errno e, |
| 4346 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4347 | RLOGD("setCdmaSubscriptionSourceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4348 | |
| 4349 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4350 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4351 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4352 | Return<void> retStatus |
| 4353 | = radioService[slotId]->mRadioResponse->setCdmaSubscriptionSourceResponse( |
| 4354 | responseInfo); |
| 4355 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4356 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4357 | RLOGE("setCdmaSubscriptionSourceResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4358 | slotId); |
| 4359 | } |
| 4360 | |
| 4361 | return 0; |
| 4362 | } |
| 4363 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4364 | int radio::setCdmaRoamingPreferenceResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4365 | int responseType, int serial, RIL_Errno e, |
| 4366 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4367 | RLOGD("setCdmaRoamingPreferenceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4368 | |
| 4369 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4370 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4371 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4372 | Return<void> retStatus |
| 4373 | = radioService[slotId]->mRadioResponse->setCdmaRoamingPreferenceResponse( |
| 4374 | responseInfo); |
| 4375 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4376 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4377 | RLOGE("setCdmaRoamingPreferenceResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4378 | slotId); |
| 4379 | } |
| 4380 | |
| 4381 | return 0; |
| 4382 | } |
| 4383 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4384 | int radio::getCdmaRoamingPreferenceResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4385 | int responseType, int serial, RIL_Errno e, |
| 4386 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4387 | RLOGD("getCdmaRoamingPreferenceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4388 | |
| 4389 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4390 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4391 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4392 | Return<void> retStatus |
| 4393 | = radioService[slotId]->mRadioResponse->getCdmaRoamingPreferenceResponse( |
| 4394 | responseInfo, (CdmaRoamingType) ret); |
| 4395 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4396 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4397 | RLOGE("getCdmaRoamingPreferenceResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4398 | slotId); |
| 4399 | } |
| 4400 | |
| 4401 | return 0; |
| 4402 | } |
| 4403 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4404 | int radio::setTTYModeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4405 | int responseType, int serial, RIL_Errno e, |
| 4406 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4407 | RLOGD("setTTYModeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4408 | |
| 4409 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4410 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4411 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4412 | Return<void> retStatus |
| 4413 | = radioService[slotId]->mRadioResponse->setTTYModeResponse(responseInfo); |
| 4414 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4415 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4416 | RLOGE("setTTYModeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4417 | } |
| 4418 | |
| 4419 | return 0; |
| 4420 | } |
| 4421 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4422 | int radio::getTTYModeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4423 | int responseType, int serial, RIL_Errno e, |
| 4424 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4425 | RLOGD("getTTYModeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4426 | |
| 4427 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4428 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4429 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4430 | Return<void> retStatus |
| 4431 | = radioService[slotId]->mRadioResponse->getTTYModeResponse(responseInfo, |
| 4432 | (TtyMode) ret); |
| 4433 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4434 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4435 | RLOGE("getTTYModeResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4436 | } |
| 4437 | |
| 4438 | return 0; |
| 4439 | } |
| 4440 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4441 | int radio::setPreferredVoicePrivacyResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4442 | int responseType, int serial, RIL_Errno e, |
| 4443 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4444 | RLOGD("setPreferredVoicePrivacyResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4445 | |
| 4446 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4447 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4448 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4449 | Return<void> retStatus |
| 4450 | = radioService[slotId]->mRadioResponse->setPreferredVoicePrivacyResponse( |
| 4451 | responseInfo); |
| 4452 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4453 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4454 | RLOGE("setPreferredVoicePrivacyResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4455 | slotId); |
| 4456 | } |
| 4457 | |
| 4458 | return 0; |
| 4459 | } |
| 4460 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4461 | int radio::getPreferredVoicePrivacyResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4462 | int responseType, int serial, RIL_Errno e, |
| 4463 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4464 | RLOGD("getPreferredVoicePrivacyResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4465 | |
| 4466 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4467 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4468 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4469 | bool enable = false; |
| 4470 | int numInts = responseLen / sizeof(int); |
| 4471 | if (response == NULL || numInts != 1) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4472 | RLOGE("getPreferredVoicePrivacyResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4473 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4474 | } else { |
| 4475 | int *pInt = (int *) response; |
| 4476 | enable = pInt[0] == 1 ? true : false; |
| 4477 | } |
| 4478 | Return<void> retStatus |
| 4479 | = radioService[slotId]->mRadioResponse->getPreferredVoicePrivacyResponse( |
| 4480 | responseInfo, enable); |
| 4481 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4482 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4483 | RLOGE("getPreferredVoicePrivacyResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4484 | slotId); |
| 4485 | } |
| 4486 | |
| 4487 | return 0; |
| 4488 | } |
| 4489 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4490 | int radio::sendCDMAFeatureCodeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4491 | int responseType, int serial, RIL_Errno e, |
| 4492 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4493 | RLOGD("sendCDMAFeatureCodeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4494 | |
| 4495 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4496 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4497 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4498 | Return<void> retStatus |
| 4499 | = radioService[slotId]->mRadioResponse->sendCDMAFeatureCodeResponse(responseInfo); |
| 4500 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4501 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4502 | RLOGE("sendCDMAFeatureCodeResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4503 | slotId); |
| 4504 | } |
| 4505 | |
| 4506 | return 0; |
| 4507 | } |
| 4508 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4509 | int radio::sendBurstDtmfResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4510 | int responseType, int serial, RIL_Errno e, |
| 4511 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4512 | RLOGD("sendBurstDtmfResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4513 | |
| 4514 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4515 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4516 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4517 | Return<void> retStatus |
| 4518 | = radioService[slotId]->mRadioResponse->sendBurstDtmfResponse(responseInfo); |
| 4519 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4520 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4521 | RLOGE("sendBurstDtmfResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4522 | } |
| 4523 | |
| 4524 | return 0; |
| 4525 | } |
| 4526 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4527 | int radio::sendCdmaSmsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4528 | int responseType, int serial, RIL_Errno e, void *response, |
| 4529 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4530 | RLOGD("sendCdmaSmsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4531 | |
| 4532 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4533 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4534 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 4535 | responseLen); |
| 4536 | |
| 4537 | Return<void> retStatus |
| 4538 | = radioService[slotId]->mRadioResponse->sendCdmaSmsResponse(responseInfo, result); |
| 4539 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4540 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4541 | RLOGE("sendCdmaSmsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4542 | } |
| 4543 | |
| 4544 | return 0; |
| 4545 | } |
| 4546 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4547 | int radio::acknowledgeLastIncomingCdmaSmsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4548 | int responseType, int serial, RIL_Errno e, |
| 4549 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4550 | RLOGD("acknowledgeLastIncomingCdmaSmsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4551 | |
| 4552 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4553 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4554 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4555 | Return<void> retStatus |
| 4556 | = radioService[slotId]->mRadioResponse->acknowledgeLastIncomingCdmaSmsResponse( |
| 4557 | responseInfo); |
| 4558 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4559 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4560 | RLOGE("acknowledgeLastIncomingCdmaSmsResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4561 | "== NULL", slotId); |
| 4562 | } |
| 4563 | |
| 4564 | return 0; |
| 4565 | } |
| 4566 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4567 | int radio::getGsmBroadcastConfigResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4568 | int responseType, int serial, RIL_Errno e, |
| 4569 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4570 | RLOGD("getGsmBroadcastConfigResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4571 | |
| 4572 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4573 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4574 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4575 | hidl_vec<GsmBroadcastSmsConfigInfo> configs; |
| 4576 | |
| 4577 | if (response == NULL || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4578 | RLOGE("getGsmBroadcastConfigResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4579 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4580 | } else { |
| 4581 | int num = responseLen / sizeof(RIL_GSM_BroadcastSmsConfigInfo *); |
| 4582 | configs.resize(num); |
| 4583 | for (int i = 0 ; i < num; i++) { |
| 4584 | RIL_GSM_BroadcastSmsConfigInfo *resp = |
| 4585 | ((RIL_GSM_BroadcastSmsConfigInfo **) response)[i]; |
| 4586 | configs[i].fromServiceId = resp->fromServiceId; |
| 4587 | configs[i].toServiceId = resp->toServiceId; |
| 4588 | configs[i].fromCodeScheme = resp->fromCodeScheme; |
| 4589 | configs[i].toCodeScheme = resp->toCodeScheme; |
| 4590 | configs[i].selected = resp->selected == 1 ? true : false; |
| 4591 | } |
| 4592 | } |
| 4593 | |
| 4594 | Return<void> retStatus |
| 4595 | = radioService[slotId]->mRadioResponse->getGsmBroadcastConfigResponse(responseInfo, |
| 4596 | configs); |
| 4597 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4598 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4599 | RLOGE("getGsmBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4600 | slotId); |
| 4601 | } |
| 4602 | |
| 4603 | return 0; |
| 4604 | } |
| 4605 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4606 | int radio::setGsmBroadcastConfigResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4607 | int responseType, int serial, RIL_Errno e, |
| 4608 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4609 | RLOGD("setGsmBroadcastConfigResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4610 | |
| 4611 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4612 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4613 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4614 | Return<void> retStatus |
| 4615 | = radioService[slotId]->mRadioResponse->setGsmBroadcastConfigResponse(responseInfo); |
| 4616 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4617 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4618 | RLOGE("setGsmBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4619 | slotId); |
| 4620 | } |
| 4621 | |
| 4622 | return 0; |
| 4623 | } |
| 4624 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4625 | int radio::setGsmBroadcastActivationResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4626 | int responseType, int serial, RIL_Errno e, |
| 4627 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4628 | RLOGD("setGsmBroadcastActivationResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4629 | |
| 4630 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4631 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4632 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4633 | Return<void> retStatus |
| 4634 | = radioService[slotId]->mRadioResponse->setGsmBroadcastActivationResponse( |
| 4635 | responseInfo); |
| 4636 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4637 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4638 | RLOGE("setGsmBroadcastActivationResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4639 | slotId); |
| 4640 | } |
| 4641 | |
| 4642 | return 0; |
| 4643 | } |
| 4644 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4645 | int radio::getCdmaBroadcastConfigResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4646 | int responseType, int serial, RIL_Errno e, |
| 4647 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4648 | RLOGD("getCdmaBroadcastConfigResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4649 | |
| 4650 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4651 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4652 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4653 | hidl_vec<CdmaBroadcastSmsConfigInfo> configs; |
| 4654 | |
| 4655 | if (response == NULL || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4656 | RLOGE("getCdmaBroadcastConfigResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4657 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4658 | } else { |
| 4659 | int num = responseLen / sizeof(RIL_CDMA_BroadcastSmsConfigInfo *); |
| 4660 | configs.resize(num); |
| 4661 | for (int i = 0 ; i < num; i++) { |
| 4662 | RIL_CDMA_BroadcastSmsConfigInfo *resp = |
| 4663 | ((RIL_CDMA_BroadcastSmsConfigInfo **) response)[i]; |
| 4664 | configs[i].serviceCategory = resp->service_category; |
| 4665 | configs[i].language = resp->language; |
| 4666 | configs[i].selected = resp->selected == 1 ? true : false; |
| 4667 | } |
| 4668 | } |
| 4669 | |
| 4670 | Return<void> retStatus |
| 4671 | = radioService[slotId]->mRadioResponse->getCdmaBroadcastConfigResponse(responseInfo, |
| 4672 | configs); |
| 4673 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4674 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4675 | RLOGE("getCdmaBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4676 | slotId); |
| 4677 | } |
| 4678 | |
| 4679 | return 0; |
| 4680 | } |
| 4681 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4682 | int radio::setCdmaBroadcastConfigResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4683 | int responseType, int serial, RIL_Errno e, |
| 4684 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4685 | RLOGD("setCdmaBroadcastConfigResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4686 | |
| 4687 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4688 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4689 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4690 | Return<void> retStatus |
| 4691 | = radioService[slotId]->mRadioResponse->setCdmaBroadcastConfigResponse( |
| 4692 | responseInfo); |
| 4693 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4694 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4695 | RLOGE("setCdmaBroadcastConfigResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4696 | slotId); |
| 4697 | } |
| 4698 | |
| 4699 | return 0; |
| 4700 | } |
| 4701 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4702 | int radio::setCdmaBroadcastActivationResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4703 | int responseType, int serial, RIL_Errno e, |
| 4704 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4705 | RLOGD("setCdmaBroadcastActivationResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4706 | |
| 4707 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4708 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4709 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4710 | Return<void> retStatus |
| 4711 | = radioService[slotId]->mRadioResponse->setCdmaBroadcastActivationResponse( |
| 4712 | responseInfo); |
| 4713 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4714 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4715 | RLOGE("setCdmaBroadcastActivationResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4716 | slotId); |
| 4717 | } |
| 4718 | |
| 4719 | return 0; |
| 4720 | } |
| 4721 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4722 | int radio::getCDMASubscriptionResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4723 | int responseType, int serial, RIL_Errno e, void *response, |
| 4724 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4725 | RLOGD("getCDMASubscriptionResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4726 | |
| 4727 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4728 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4729 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4730 | |
| 4731 | int numStrings = responseLen / sizeof(char *); |
| 4732 | hidl_string emptyString; |
| 4733 | if (response == NULL || numStrings != 5) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4734 | RLOGE("getOperatorResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4735 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4736 | Return<void> retStatus |
| 4737 | = radioService[slotId]->mRadioResponse->getCDMASubscriptionResponse( |
| 4738 | responseInfo, emptyString, emptyString, emptyString, emptyString, emptyString); |
| 4739 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4740 | } else { |
| 4741 | char **resp = (char **) response; |
| 4742 | Return<void> retStatus |
| 4743 | = radioService[slotId]->mRadioResponse->getCDMASubscriptionResponse( |
| 4744 | responseInfo, |
| 4745 | convertCharPtrToHidlString(resp[0]), |
| 4746 | convertCharPtrToHidlString(resp[1]), |
| 4747 | convertCharPtrToHidlString(resp[2]), |
| 4748 | convertCharPtrToHidlString(resp[3]), |
| 4749 | convertCharPtrToHidlString(resp[4])); |
| 4750 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4751 | } |
| 4752 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4753 | RLOGE("getCDMASubscriptionResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4754 | slotId); |
| 4755 | } |
| 4756 | |
| 4757 | return 0; |
| 4758 | } |
| 4759 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4760 | int radio::writeSmsToRuimResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4761 | int responseType, int serial, RIL_Errno e, |
| 4762 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4763 | RLOGD("writeSmsToRuimResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4764 | |
| 4765 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4766 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4767 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4768 | Return<void> retStatus |
| 4769 | = radioService[slotId]->mRadioResponse->writeSmsToRuimResponse(responseInfo, ret); |
| 4770 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4771 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4772 | RLOGE("writeSmsToRuimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4773 | } |
| 4774 | |
| 4775 | return 0; |
| 4776 | } |
| 4777 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4778 | int radio::deleteSmsOnRuimResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4779 | int responseType, int serial, RIL_Errno e, |
| 4780 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4781 | RLOGD("deleteSmsOnRuimResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4782 | |
| 4783 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4784 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4785 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4786 | Return<void> retStatus |
| 4787 | = radioService[slotId]->mRadioResponse->deleteSmsOnRuimResponse(responseInfo); |
| 4788 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4789 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4790 | RLOGE("deleteSmsOnRuimResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4791 | } |
| 4792 | |
| 4793 | return 0; |
| 4794 | } |
| 4795 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4796 | int radio::getDeviceIdentityResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4797 | int responseType, int serial, RIL_Errno e, void *response, |
| 4798 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4799 | RLOGD("getDeviceIdentityResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4800 | |
| 4801 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4802 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4803 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4804 | |
| 4805 | int numStrings = responseLen / sizeof(char *); |
| 4806 | hidl_string emptyString; |
| 4807 | if (response == NULL || numStrings != 4) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4808 | RLOGE("getDeviceIdentityResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4809 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 4810 | Return<void> retStatus |
| 4811 | = radioService[slotId]->mRadioResponse->getDeviceIdentityResponse(responseInfo, |
| 4812 | emptyString, emptyString, emptyString, emptyString); |
| 4813 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4814 | } else { |
| 4815 | char **resp = (char **) response; |
| 4816 | Return<void> retStatus |
| 4817 | = radioService[slotId]->mRadioResponse->getDeviceIdentityResponse(responseInfo, |
| 4818 | convertCharPtrToHidlString(resp[0]), |
| 4819 | convertCharPtrToHidlString(resp[1]), |
| 4820 | convertCharPtrToHidlString(resp[2]), |
| 4821 | convertCharPtrToHidlString(resp[3])); |
| 4822 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4823 | } |
| 4824 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4825 | RLOGE("getDeviceIdentityResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4826 | slotId); |
| 4827 | } |
| 4828 | |
| 4829 | return 0; |
| 4830 | } |
| 4831 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4832 | int radio::exitEmergencyCallbackModeResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4833 | int responseType, int serial, RIL_Errno e, |
| 4834 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4835 | RLOGD("exitEmergencyCallbackModeResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4836 | |
| 4837 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4838 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4839 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4840 | Return<void> retStatus |
| 4841 | = radioService[slotId]->mRadioResponse->exitEmergencyCallbackModeResponse( |
| 4842 | responseInfo); |
| 4843 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4844 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4845 | RLOGE("exitEmergencyCallbackModeResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4846 | slotId); |
| 4847 | } |
| 4848 | |
| 4849 | return 0; |
| 4850 | } |
| 4851 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4852 | int radio::getSmscAddressResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4853 | int responseType, int serial, RIL_Errno e, |
| 4854 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4855 | RLOGD("getSmscAddressResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4856 | |
| 4857 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4858 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4859 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4860 | Return<void> retStatus |
| 4861 | = radioService[slotId]->mRadioResponse->getSmscAddressResponse(responseInfo, |
| 4862 | convertCharPtrToHidlString((char *) response)); |
| 4863 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4864 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4865 | RLOGE("getSmscAddressResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4866 | } |
| 4867 | |
| 4868 | return 0; |
| 4869 | } |
| 4870 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4871 | int radio::setSmscAddressResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4872 | int responseType, int serial, RIL_Errno e, |
| 4873 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4874 | RLOGD("setSmscAddressResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4875 | |
| 4876 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4877 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4878 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4879 | Return<void> retStatus |
| 4880 | = radioService[slotId]->mRadioResponse->setSmscAddressResponse(responseInfo); |
| 4881 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4882 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4883 | RLOGE("setSmscAddressResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4884 | } |
| 4885 | |
| 4886 | return 0; |
| 4887 | } |
| 4888 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4889 | int radio::reportSmsMemoryStatusResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4890 | int responseType, int serial, RIL_Errno e, |
| 4891 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4892 | RLOGD("reportSmsMemoryStatusResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4893 | |
| 4894 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4895 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4896 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4897 | Return<void> retStatus |
| 4898 | = radioService[slotId]->mRadioResponse->reportSmsMemoryStatusResponse(responseInfo); |
| 4899 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4900 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4901 | RLOGE("reportSmsMemoryStatusResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4902 | slotId); |
| 4903 | } |
| 4904 | |
| 4905 | return 0; |
| 4906 | } |
| 4907 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4908 | int radio::reportStkServiceIsRunningResponse(int slotId, |
Amit Mahajan | 5007ffa | 2017-01-31 17:14:42 -0800 | [diff] [blame] | 4909 | int responseType, int serial, RIL_Errno e, |
| 4910 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4911 | RLOGD("reportStkServiceIsRunningResponse: serial %d", serial); |
Amit Mahajan | 5007ffa | 2017-01-31 17:14:42 -0800 | [diff] [blame] | 4912 | |
| 4913 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 4914 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 5007ffa | 2017-01-31 17:14:42 -0800 | [diff] [blame] | 4915 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4916 | Return<void> retStatus = radioService[slotId]->mRadioResponse-> |
| 4917 | reportStkServiceIsRunningResponse(responseInfo); |
| 4918 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4919 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4920 | RLOGE("reportStkServiceIsRunningResponse: radioService[%d]->mRadioResponse == NULL", |
Amit Mahajan | 5007ffa | 2017-01-31 17:14:42 -0800 | [diff] [blame] | 4921 | slotId); |
| 4922 | } |
| 4923 | |
| 4924 | return 0; |
| 4925 | } |
| 4926 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4927 | int radio::getCdmaSubscriptionSourceResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4928 | int responseType, int serial, RIL_Errno e, |
| 4929 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4930 | RLOGD("getCdmaSubscriptionSourceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4931 | |
| 4932 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4933 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4934 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 4935 | Return<void> retStatus |
| 4936 | = radioService[slotId]->mRadioResponse->getCdmaSubscriptionSourceResponse( |
| 4937 | responseInfo, (CdmaSubscriptionSource) ret); |
| 4938 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4939 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4940 | RLOGE("getCdmaSubscriptionSourceResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4941 | slotId); |
| 4942 | } |
| 4943 | |
| 4944 | return 0; |
| 4945 | } |
| 4946 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4947 | int radio::requestIsimAuthenticationResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4948 | int responseType, int serial, RIL_Errno e, |
| 4949 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4950 | RLOGD("requestIsimAuthenticationResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4951 | |
| 4952 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4953 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4954 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4955 | Return<void> retStatus |
| 4956 | = radioService[slotId]->mRadioResponse->requestIsimAuthenticationResponse( |
| 4957 | responseInfo, |
| 4958 | convertCharPtrToHidlString((char *) response)); |
| 4959 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4960 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4961 | RLOGE("requestIsimAuthenticationResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4962 | slotId); |
| 4963 | } |
| 4964 | |
| 4965 | return 0; |
| 4966 | } |
| 4967 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4968 | int radio::acknowledgeIncomingGsmSmsWithPduResponse(int slotId, |
| 4969 | int responseType, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4970 | int serial, RIL_Errno e, void *response, |
| 4971 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4972 | RLOGD("acknowledgeIncomingGsmSmsWithPduResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4973 | |
| 4974 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4975 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4976 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 4977 | Return<void> retStatus |
| 4978 | = radioService[slotId]->mRadioResponse->acknowledgeIncomingGsmSmsWithPduResponse( |
| 4979 | responseInfo); |
| 4980 | radioService[slotId]->checkReturnStatus(retStatus); |
| 4981 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4982 | RLOGE("acknowledgeIncomingGsmSmsWithPduResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4983 | "== NULL", slotId); |
| 4984 | } |
| 4985 | |
| 4986 | return 0; |
| 4987 | } |
| 4988 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 4989 | int radio::sendEnvelopeWithStatusResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4990 | int responseType, int serial, RIL_Errno e, void *response, |
| 4991 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 4992 | RLOGD("sendEnvelopeWithStatusResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4993 | |
| 4994 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 4995 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 4996 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, |
| 4997 | response, responseLen); |
| 4998 | |
| 4999 | Return<void> retStatus |
| 5000 | = radioService[slotId]->mRadioResponse->sendEnvelopeWithStatusResponse(responseInfo, |
| 5001 | result); |
| 5002 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5003 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5004 | RLOGE("sendEnvelopeWithStatusResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5005 | slotId); |
| 5006 | } |
| 5007 | |
| 5008 | return 0; |
| 5009 | } |
| 5010 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5011 | int radio::getVoiceRadioTechnologyResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5012 | int responseType, int serial, RIL_Errno e, |
| 5013 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5014 | RLOGD("getVoiceRadioTechnologyResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5015 | |
| 5016 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5017 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5018 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 5019 | Return<void> retStatus |
| 5020 | = radioService[slotId]->mRadioResponse->getVoiceRadioTechnologyResponse( |
| 5021 | responseInfo, (RadioTechnology) ret); |
| 5022 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5023 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5024 | RLOGE("getVoiceRadioTechnologyResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5025 | slotId); |
| 5026 | } |
| 5027 | |
| 5028 | return 0; |
| 5029 | } |
| 5030 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5031 | int radio::getCellInfoListResponse(int slotId, |
| 5032 | int responseType, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5033 | int serial, RIL_Errno e, void *response, |
| 5034 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5035 | RLOGD("getCellInfoListResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5036 | |
| 5037 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5038 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5039 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5040 | |
| 5041 | hidl_vec<CellInfo> ret; |
| 5042 | if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5043 | RLOGE("getCellInfoListResponse: Invalid response"); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5044 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5045 | } else { |
| 5046 | convertRilCellInfoListToHal(response, responseLen, ret); |
| 5047 | } |
| 5048 | |
| 5049 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getCellInfoListResponse( |
| 5050 | responseInfo, ret); |
| 5051 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5052 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5053 | RLOGE("getCellInfoListResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5054 | } |
| 5055 | |
| 5056 | return 0; |
| 5057 | } |
| 5058 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5059 | int radio::setCellInfoListRateResponse(int slotId, |
| 5060 | int responseType, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5061 | int serial, RIL_Errno e, void *response, |
| 5062 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5063 | RLOGD("setCellInfoListRateResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5064 | |
| 5065 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5066 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5067 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5068 | Return<void> retStatus |
| 5069 | = radioService[slotId]->mRadioResponse->setCellInfoListRateResponse(responseInfo); |
| 5070 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5071 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5072 | RLOGE("setCellInfoListRateResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5073 | slotId); |
| 5074 | } |
| 5075 | |
| 5076 | return 0; |
| 5077 | } |
| 5078 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5079 | int radio::setInitialAttachApnResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5080 | int responseType, int serial, RIL_Errno e, |
| 5081 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5082 | RLOGD("setInitialAttachApnResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5083 | |
| 5084 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5085 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5086 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5087 | Return<void> retStatus |
| 5088 | = radioService[slotId]->mRadioResponse->setInitialAttachApnResponse(responseInfo); |
| 5089 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5090 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5091 | RLOGE("setInitialAttachApnResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5092 | slotId); |
| 5093 | } |
| 5094 | |
| 5095 | return 0; |
| 5096 | } |
| 5097 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5098 | int radio::getImsRegistrationStateResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5099 | int responseType, int serial, RIL_Errno e, |
| 5100 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5101 | RLOGD("getImsRegistrationStateResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 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 | bool isRegistered = false; |
| 5107 | int ratFamily = 0; |
| 5108 | int numInts = responseLen / sizeof(int); |
| 5109 | if (response == NULL || numInts != 2) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5110 | RLOGE("getImsRegistrationStateResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5111 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5112 | } else { |
| 5113 | int *pInt = (int *) response; |
| 5114 | isRegistered = pInt[0] == 1 ? true : false; |
| 5115 | ratFamily = pInt[1]; |
| 5116 | } |
| 5117 | Return<void> retStatus |
| 5118 | = radioService[slotId]->mRadioResponse->getImsRegistrationStateResponse( |
| 5119 | responseInfo, isRegistered, (RadioTechnologyFamily) ratFamily); |
| 5120 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5121 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5122 | RLOGE("getImsRegistrationStateResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5123 | slotId); |
| 5124 | } |
| 5125 | |
| 5126 | return 0; |
| 5127 | } |
| 5128 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5129 | int radio::sendImsSmsResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5130 | int responseType, int serial, RIL_Errno e, void *response, |
| 5131 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5132 | RLOGD("sendImsSmsResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5133 | |
| 5134 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5135 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5136 | SendSmsResult result = makeSendSmsResult(responseInfo, serial, responseType, e, response, |
| 5137 | responseLen); |
| 5138 | |
| 5139 | Return<void> retStatus |
| 5140 | = radioService[slotId]->mRadioResponse->sendImsSmsResponse(responseInfo, result); |
| 5141 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5142 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5143 | RLOGE("sendSmsResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5144 | } |
| 5145 | |
| 5146 | return 0; |
| 5147 | } |
| 5148 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5149 | int radio::iccTransmitApduBasicChannelResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5150 | int responseType, int serial, RIL_Errno e, |
| 5151 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5152 | RLOGD("iccTransmitApduBasicChannelResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5153 | |
| 5154 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5155 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5156 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 5157 | responseLen); |
| 5158 | |
| 5159 | Return<void> retStatus |
| 5160 | = radioService[slotId]->mRadioResponse->iccTransmitApduBasicChannelResponse( |
| 5161 | responseInfo, result); |
| 5162 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5163 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5164 | RLOGE("iccTransmitApduBasicChannelResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5165 | "== NULL", slotId); |
| 5166 | } |
| 5167 | |
| 5168 | return 0; |
| 5169 | } |
| 5170 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5171 | int radio::iccOpenLogicalChannelResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5172 | int responseType, int serial, RIL_Errno e, void *response, |
| 5173 | size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5174 | RLOGD("iccOpenLogicalChannelResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5175 | |
| 5176 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5177 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5178 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5179 | int channelId = -1; |
| 5180 | hidl_vec<int8_t> selectResponse; |
| 5181 | int numInts = responseLen / sizeof(int); |
| 5182 | if (response == NULL || responseLen % sizeof(int) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5183 | RLOGE("iccOpenLogicalChannelResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5184 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5185 | } else { |
| 5186 | int *pInt = (int *) response; |
| 5187 | channelId = pInt[0]; |
| 5188 | selectResponse.resize(numInts - 1); |
| 5189 | for (int i = 1; i < numInts; i++) { |
| 5190 | selectResponse[i - 1] = (int8_t) pInt[i]; |
| 5191 | } |
| 5192 | } |
| 5193 | Return<void> retStatus |
| 5194 | = radioService[slotId]->mRadioResponse->iccOpenLogicalChannelResponse(responseInfo, |
| 5195 | channelId, selectResponse); |
| 5196 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5197 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5198 | RLOGE("iccOpenLogicalChannelResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5199 | slotId); |
| 5200 | } |
| 5201 | |
| 5202 | return 0; |
| 5203 | } |
| 5204 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5205 | int radio::iccCloseLogicalChannelResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5206 | int responseType, int serial, RIL_Errno e, |
| 5207 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5208 | RLOGD("iccCloseLogicalChannelResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5209 | |
| 5210 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5211 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5212 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5213 | Return<void> retStatus |
| 5214 | = radioService[slotId]->mRadioResponse->iccCloseLogicalChannelResponse( |
| 5215 | responseInfo); |
| 5216 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5217 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5218 | RLOGE("iccCloseLogicalChannelResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5219 | slotId); |
| 5220 | } |
| 5221 | |
| 5222 | return 0; |
| 5223 | } |
| 5224 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5225 | int radio::iccTransmitApduLogicalChannelResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5226 | int responseType, int serial, RIL_Errno e, |
| 5227 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5228 | RLOGD("iccTransmitApduLogicalChannelResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5229 | |
| 5230 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5231 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5232 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 5233 | responseLen); |
| 5234 | |
| 5235 | Return<void> retStatus |
| 5236 | = radioService[slotId]->mRadioResponse->iccTransmitApduLogicalChannelResponse( |
| 5237 | responseInfo, result); |
| 5238 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5239 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5240 | RLOGE("iccTransmitApduLogicalChannelResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5241 | "== NULL", slotId); |
| 5242 | } |
| 5243 | |
| 5244 | return 0; |
| 5245 | } |
| 5246 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5247 | int radio::nvReadItemResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5248 | int responseType, int serial, RIL_Errno e, |
| 5249 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5250 | RLOGD("nvReadItemResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5251 | |
| 5252 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5253 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5254 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5255 | Return<void> retStatus = radioService[slotId]->mRadioResponse->nvReadItemResponse( |
| 5256 | responseInfo, |
| 5257 | convertCharPtrToHidlString((char *) response)); |
| 5258 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5259 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5260 | RLOGE("nvReadItemResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5261 | } |
| 5262 | |
| 5263 | return 0; |
| 5264 | } |
| 5265 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5266 | int radio::nvWriteItemResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5267 | int responseType, int serial, RIL_Errno e, |
| 5268 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5269 | RLOGD("nvWriteItemResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5270 | |
| 5271 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5272 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5273 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5274 | Return<void> retStatus |
| 5275 | = radioService[slotId]->mRadioResponse->nvWriteItemResponse(responseInfo); |
| 5276 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5277 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5278 | RLOGE("nvWriteItemResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5279 | } |
| 5280 | |
| 5281 | return 0; |
| 5282 | } |
| 5283 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5284 | int radio::nvWriteCdmaPrlResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5285 | int responseType, int serial, RIL_Errno e, |
| 5286 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5287 | RLOGD("nvWriteCdmaPrlResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5288 | |
| 5289 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5290 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5291 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5292 | Return<void> retStatus |
| 5293 | = radioService[slotId]->mRadioResponse->nvWriteCdmaPrlResponse(responseInfo); |
| 5294 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5295 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5296 | RLOGE("nvWriteCdmaPrlResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5297 | } |
| 5298 | |
| 5299 | return 0; |
| 5300 | } |
| 5301 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5302 | int radio::nvResetConfigResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5303 | int responseType, int serial, RIL_Errno e, |
| 5304 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5305 | RLOGD("nvResetConfigResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5306 | |
| 5307 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5308 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5309 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5310 | Return<void> retStatus |
| 5311 | = radioService[slotId]->mRadioResponse->nvResetConfigResponse(responseInfo); |
| 5312 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5313 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5314 | RLOGE("nvResetConfigResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5315 | } |
| 5316 | |
| 5317 | return 0; |
| 5318 | } |
| 5319 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5320 | int radio::setUiccSubscriptionResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5321 | int responseType, int serial, RIL_Errno e, |
| 5322 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5323 | RLOGD("setUiccSubscriptionResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5324 | |
| 5325 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5326 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5327 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5328 | Return<void> retStatus |
| 5329 | = radioService[slotId]->mRadioResponse->setUiccSubscriptionResponse(responseInfo); |
| 5330 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5331 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5332 | RLOGE("setUiccSubscriptionResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5333 | slotId); |
| 5334 | } |
| 5335 | |
| 5336 | return 0; |
| 5337 | } |
| 5338 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5339 | int radio::setDataAllowedResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5340 | int responseType, int serial, RIL_Errno e, |
| 5341 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5342 | RLOGD("setDataAllowedResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5343 | |
| 5344 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5345 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5346 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5347 | Return<void> retStatus |
| 5348 | = radioService[slotId]->mRadioResponse->setDataAllowedResponse(responseInfo); |
| 5349 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5350 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5351 | RLOGE("setDataAllowedResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5352 | } |
| 5353 | |
| 5354 | return 0; |
| 5355 | } |
| 5356 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5357 | int radio::getHardwareConfigResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5358 | int responseType, int serial, RIL_Errno e, |
| 5359 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5360 | RLOGD("getHardwareConfigResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5361 | |
| 5362 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5363 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5364 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5365 | |
| 5366 | hidl_vec<HardwareConfig> result; |
| 5367 | if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5368 | RLOGE("hardwareConfigChangedInd: invalid response"); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5369 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5370 | } else { |
| 5371 | convertRilHardwareConfigListToHal(response, responseLen, result); |
| 5372 | } |
| 5373 | |
| 5374 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getHardwareConfigResponse( |
| 5375 | responseInfo, result); |
| 5376 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5377 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5378 | RLOGE("getHardwareConfigResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5379 | } |
| 5380 | |
| 5381 | return 0; |
| 5382 | } |
| 5383 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5384 | int radio::requestIccSimAuthenticationResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5385 | int responseType, int serial, RIL_Errno e, |
| 5386 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5387 | RLOGD("requestIccSimAuthenticationResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5388 | |
| 5389 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5390 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5391 | IccIoResult result = responseIccIo(responseInfo, serial, responseType, e, response, |
| 5392 | responseLen); |
| 5393 | |
| 5394 | Return<void> retStatus |
| 5395 | = radioService[slotId]->mRadioResponse->requestIccSimAuthenticationResponse( |
| 5396 | responseInfo, result); |
| 5397 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5398 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5399 | RLOGE("requestIccSimAuthenticationResponse: radioService[%d]->mRadioResponse " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5400 | "== NULL", slotId); |
| 5401 | } |
| 5402 | |
| 5403 | return 0; |
| 5404 | } |
| 5405 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5406 | int radio::setDataProfileResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5407 | int responseType, int serial, RIL_Errno e, |
| 5408 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5409 | RLOGD("setDataProfileResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5410 | |
| 5411 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5412 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5413 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5414 | Return<void> retStatus |
| 5415 | = radioService[slotId]->mRadioResponse->setDataProfileResponse(responseInfo); |
| 5416 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5417 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5418 | RLOGE("setDataProfileResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5419 | } |
| 5420 | |
| 5421 | return 0; |
| 5422 | } |
| 5423 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5424 | int radio::requestShutdownResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5425 | int responseType, int serial, RIL_Errno e, |
| 5426 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5427 | RLOGD("requestShutdownResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5428 | |
| 5429 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5430 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5431 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5432 | Return<void> retStatus |
| 5433 | = radioService[slotId]->mRadioResponse->requestShutdownResponse(responseInfo); |
| 5434 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5435 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5436 | RLOGE("requestShutdownResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5437 | } |
| 5438 | |
| 5439 | return 0; |
| 5440 | } |
| 5441 | |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5442 | void responseRadioCapability(RadioResponseInfo& responseInfo, int serial, |
| 5443 | int responseType, RIL_Errno e, void *response, size_t responseLen, RadioCapability& rc) { |
| 5444 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5445 | |
Amit Mahajan | 1fbff08 | 2017-02-24 11:24:39 -0800 | [diff] [blame] | 5446 | if (response == NULL || responseLen != sizeof(RIL_RadioCapability)) { |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5447 | RLOGE("responseRadioCapability: Invalid response"); |
| 5448 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5449 | rc.logicalModemUuid = hidl_string(); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5450 | } else { |
| 5451 | convertRilRadioCapabilityToHal(response, responseLen, rc); |
| 5452 | } |
| 5453 | } |
| 5454 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5455 | int radio::getRadioCapabilityResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5456 | int responseType, int serial, RIL_Errno e, |
| 5457 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5458 | RLOGD("getRadioCapabilityResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5459 | |
| 5460 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5461 | RadioResponseInfo responseInfo = {}; |
| 5462 | RadioCapability result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5463 | responseRadioCapability(responseInfo, serial, responseType, e, response, responseLen, |
| 5464 | result); |
| 5465 | Return<void> retStatus = radioService[slotId]->mRadioResponse->getRadioCapabilityResponse( |
| 5466 | responseInfo, result); |
| 5467 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5468 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5469 | RLOGE("getRadioCapabilityResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5470 | } |
| 5471 | |
| 5472 | return 0; |
| 5473 | } |
| 5474 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5475 | int radio::setRadioCapabilityResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5476 | int responseType, int serial, RIL_Errno e, |
| 5477 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5478 | RLOGD("setRadioCapabilityResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5479 | |
| 5480 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5481 | RadioResponseInfo responseInfo = {}; |
| 5482 | RadioCapability result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5483 | responseRadioCapability(responseInfo, serial, responseType, e, response, responseLen, |
| 5484 | result); |
| 5485 | Return<void> retStatus = radioService[slotId]->mRadioResponse->setRadioCapabilityResponse( |
| 5486 | responseInfo, result); |
| 5487 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5488 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5489 | RLOGE("setRadioCapabilityResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5490 | } |
| 5491 | |
| 5492 | return 0; |
| 5493 | } |
| 5494 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5495 | LceStatusInfo responseLceStatusInfo(RadioResponseInfo& responseInfo, int serial, int responseType, |
| 5496 | RIL_Errno e, void *response, size_t responseLen) { |
| 5497 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5498 | LceStatusInfo result = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5499 | |
| 5500 | if (response == NULL || responseLen != sizeof(RIL_LceStatusInfo)) { |
| 5501 | RLOGE("Invalid response: NULL"); |
| 5502 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5503 | } else { |
| 5504 | RIL_LceStatusInfo *resp = (RIL_LceStatusInfo *) response; |
| 5505 | result.lceStatus = (LceStatus) resp->lce_status; |
| 5506 | result.actualIntervalMs = (uint8_t) resp->actual_interval_ms; |
| 5507 | } |
| 5508 | return result; |
| 5509 | } |
| 5510 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5511 | int radio::startLceServiceResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5512 | int responseType, int serial, RIL_Errno e, |
| 5513 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5514 | RLOGD("startLceServiceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5515 | |
| 5516 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5517 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5518 | LceStatusInfo result = responseLceStatusInfo(responseInfo, serial, responseType, e, |
| 5519 | response, responseLen); |
| 5520 | |
| 5521 | Return<void> retStatus |
| 5522 | = radioService[slotId]->mRadioResponse->startLceServiceResponse(responseInfo, |
| 5523 | result); |
| 5524 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5525 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5526 | RLOGE("startLceServiceResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5527 | } |
| 5528 | |
| 5529 | return 0; |
| 5530 | } |
| 5531 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5532 | int radio::stopLceServiceResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5533 | int responseType, int serial, RIL_Errno e, |
| 5534 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5535 | RLOGD("stopLceServiceResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5536 | |
| 5537 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5538 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5539 | LceStatusInfo result = responseLceStatusInfo(responseInfo, serial, responseType, e, |
| 5540 | response, responseLen); |
| 5541 | |
| 5542 | Return<void> retStatus |
| 5543 | = radioService[slotId]->mRadioResponse->stopLceServiceResponse(responseInfo, |
| 5544 | result); |
| 5545 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5546 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5547 | RLOGE("stopLceServiceResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5548 | } |
| 5549 | |
| 5550 | return 0; |
| 5551 | } |
| 5552 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5553 | int radio::pullLceDataResponse(int slotId, |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5554 | int responseType, int serial, RIL_Errno e, |
| 5555 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5556 | RLOGD("pullLceDataResponse: serial %d", serial); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5557 | |
| 5558 | if (radioService[slotId]->mRadioResponse != NULL) { |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5559 | RadioResponseInfo responseInfo = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5560 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5561 | |
Amit Mahajan | 3da9ac0 | 2017-02-13 13:41:28 -0800 | [diff] [blame] | 5562 | LceDataInfo result = {}; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5563 | if (response == NULL || responseLen != sizeof(RIL_LceDataInfo)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5564 | RLOGE("pullLceDataResponse: Invalid response"); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5565 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5566 | } else { |
| 5567 | convertRilLceDataInfoToHal(response, responseLen, result); |
| 5568 | } |
| 5569 | |
| 5570 | Return<void> retStatus = radioService[slotId]->mRadioResponse->pullLceDataResponse( |
| 5571 | responseInfo, result); |
| 5572 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5573 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5574 | RLOGE("pullLceDataResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Amit Mahajan | 3df6291 | 2017-02-10 01:35:55 +0000 | [diff] [blame] | 5575 | } |
| 5576 | |
| 5577 | return 0; |
| 5578 | } |
| 5579 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5580 | int radio::getModemActivityInfoResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5581 | int responseType, int serial, RIL_Errno e, |
| 5582 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5583 | RLOGD("getModemActivityInfoResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5584 | |
| 5585 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5586 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5587 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5588 | ActivityStatsInfo info; |
| 5589 | if (response == NULL || responseLen != sizeof(RIL_ActivityStatsInfo)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5590 | RLOGE("getModemActivityInfoResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5591 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5592 | } else { |
| 5593 | RIL_ActivityStatsInfo *resp = (RIL_ActivityStatsInfo *)response; |
| 5594 | info.sleepModeTimeMs = resp->sleep_mode_time_ms; |
| 5595 | info.idleModeTimeMs = resp->idle_mode_time_ms; |
| 5596 | for(int i = 0; i < RIL_NUM_TX_POWER_LEVELS; i++) { |
| 5597 | info.txmModetimeMs[i] = resp->tx_mode_time_ms[i]; |
| 5598 | } |
| 5599 | info.rxModeTimeMs = resp->rx_mode_time_ms; |
| 5600 | } |
| 5601 | |
| 5602 | Return<void> retStatus |
| 5603 | = radioService[slotId]->mRadioResponse->getModemActivityInfoResponse(responseInfo, |
| 5604 | info); |
| 5605 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5606 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5607 | RLOGE("getModemActivityInfoResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5608 | slotId); |
| 5609 | } |
| 5610 | |
| 5611 | return 0; |
| 5612 | } |
| 5613 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5614 | int radio::setAllowedCarriersResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5615 | int responseType, int serial, RIL_Errno e, |
| 5616 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5617 | RLOGD("setAllowedCarriersResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5618 | |
| 5619 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5620 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5621 | int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); |
| 5622 | Return<void> retStatus |
| 5623 | = radioService[slotId]->mRadioResponse->setAllowedCarriersResponse(responseInfo, |
| 5624 | ret); |
| 5625 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5626 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5627 | RLOGE("setAllowedCarriersResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5628 | slotId); |
| 5629 | } |
| 5630 | |
| 5631 | return 0; |
| 5632 | } |
| 5633 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5634 | int radio::getAllowedCarriersResponse(int slotId, |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5635 | int responseType, int serial, RIL_Errno e, |
| 5636 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5637 | RLOGD("getAllowedCarriersResponse: serial %d", serial); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5638 | |
| 5639 | if (radioService[slotId]->mRadioResponse != NULL) { |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5640 | RadioResponseInfo responseInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5641 | populateResponseInfo(responseInfo, serial, responseType, e); |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 5642 | CarrierRestrictions carrierInfo = {}; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5643 | bool allAllowed = true; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5644 | if (response == NULL || responseLen != sizeof(RIL_CarrierRestrictions)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5645 | RLOGE("getAllowedCarriersResponse Invalid response: NULL"); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5646 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5647 | } else { |
| 5648 | RIL_CarrierRestrictions *pCr = (RIL_CarrierRestrictions *)response; |
| 5649 | if (pCr->len_allowed_carriers > 0 || pCr->len_excluded_carriers > 0) { |
| 5650 | allAllowed = false; |
| 5651 | } |
| 5652 | |
| 5653 | carrierInfo.allowedCarriers.resize(pCr->len_allowed_carriers); |
| 5654 | for(int i = 0; i < pCr->len_allowed_carriers; i++) { |
| 5655 | RIL_Carrier *carrier = pCr->allowed_carriers + i; |
| 5656 | carrierInfo.allowedCarriers[i].mcc = convertCharPtrToHidlString(carrier->mcc); |
| 5657 | carrierInfo.allowedCarriers[i].mnc = convertCharPtrToHidlString(carrier->mnc); |
| 5658 | carrierInfo.allowedCarriers[i].matchType = (CarrierMatchType) carrier->match_type; |
| 5659 | carrierInfo.allowedCarriers[i].matchData = |
| 5660 | convertCharPtrToHidlString(carrier->match_data); |
| 5661 | } |
| 5662 | |
| 5663 | carrierInfo.excludedCarriers.resize(pCr->len_excluded_carriers); |
| 5664 | for(int i = 0; i < pCr->len_excluded_carriers; i++) { |
| 5665 | RIL_Carrier *carrier = pCr->excluded_carriers + i; |
| 5666 | carrierInfo.excludedCarriers[i].mcc = convertCharPtrToHidlString(carrier->mcc); |
| 5667 | carrierInfo.excludedCarriers[i].mnc = convertCharPtrToHidlString(carrier->mnc); |
| 5668 | carrierInfo.excludedCarriers[i].matchType = (CarrierMatchType) carrier->match_type; |
| 5669 | carrierInfo.excludedCarriers[i].matchData = |
| 5670 | convertCharPtrToHidlString(carrier->match_data); |
| 5671 | } |
| 5672 | } |
| 5673 | |
| 5674 | Return<void> retStatus |
| 5675 | = radioService[slotId]->mRadioResponse->getAllowedCarriersResponse(responseInfo, |
| 5676 | allAllowed, carrierInfo); |
| 5677 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5678 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5679 | RLOGE("getAllowedCarriersResponse: radioService[%d]->mRadioResponse == NULL", |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5680 | slotId); |
| 5681 | } |
| 5682 | |
| 5683 | return 0; |
| 5684 | } |
| 5685 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5686 | int radio::sendDeviceStateResponse(int slotId, |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 5687 | int responseType, int serial, RIL_Errno e, |
| 5688 | void *response, size_t responselen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5689 | RLOGD("sendDeviceStateResponse: serial %d", serial); |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 5690 | |
| 5691 | if (radioService[slotId]->mRadioResponse != NULL) { |
| 5692 | RadioResponseInfo responseInfo = {}; |
| 5693 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5694 | Return<void> retStatus |
| 5695 | = radioService[slotId]->mRadioResponse->sendDeviceStateResponse(responseInfo); |
| 5696 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5697 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5698 | RLOGE("sendDeviceStateResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 5699 | } |
| 5700 | |
| 5701 | return 0; |
| 5702 | } |
| 5703 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5704 | int radio::setIndicationFilterResponse(int slotId, |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 5705 | int responseType, int serial, RIL_Errno e, |
| 5706 | void *response, size_t responselen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5707 | RLOGD("setIndicationFilterResponse: serial %d", serial); |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 5708 | |
| 5709 | if (radioService[slotId]->mRadioResponse != NULL) { |
| 5710 | RadioResponseInfo responseInfo = {}; |
| 5711 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5712 | Return<void> retStatus |
| 5713 | = radioService[slotId]->mRadioResponse->setIndicationFilterResponse(responseInfo); |
| 5714 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5715 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5716 | RLOGE("setIndicationFilterResponse: radioService[%d]->mRadioResponse == NULL", |
Jack Yu | 11ab404 | 2017-02-21 17:08:01 -0800 | [diff] [blame] | 5717 | slotId); |
| 5718 | } |
| 5719 | |
| 5720 | return 0; |
| 5721 | } |
| 5722 | |
| 5723 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5724 | int radio::setSimCardPowerResponse(int slotId, |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 5725 | int responseType, int serial, RIL_Errno e, |
| 5726 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5727 | RLOGD("setSimCardPowerResponse: serial %d", serial); |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 5728 | |
| 5729 | if (radioService[slotId]->mRadioResponse != NULL) { |
| 5730 | RadioResponseInfo responseInfo = {}; |
| 5731 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5732 | Return<void> retStatus |
| 5733 | = radioService[slotId]->mRadioResponse->setSimCardPowerResponse(responseInfo); |
| 5734 | radioService[slotId]->checkReturnStatus(retStatus); |
| 5735 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5736 | RLOGE("setSimCardPowerResponse: radioService[%d]->mRadioResponse == NULL", slotId); |
Wileen Chiu | 718c0bf | 2017-01-04 11:37:19 -0800 | [diff] [blame] | 5737 | } |
| 5738 | |
| 5739 | return 0; |
| 5740 | } |
| 5741 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5742 | int radio::sendRequestRawResponse(int slotId, |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5743 | int responseType, int serial, RIL_Errno e, |
| 5744 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5745 | RLOGD("sendRequestRawResponse: serial %d", serial); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5746 | |
| 5747 | if (oemHookService[slotId]->mOemHookResponse != NULL) { |
| 5748 | RadioResponseInfo responseInfo = {}; |
| 5749 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5750 | hidl_vec<uint8_t> data; |
| 5751 | |
| 5752 | if (response == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5753 | RLOGE("sendRequestRawResponse: Invalid response"); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5754 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5755 | } else { |
| 5756 | data.setToExternal((uint8_t *) response, responseLen); |
| 5757 | } |
| 5758 | Return<void> retStatus = oemHookService[slotId]->mOemHookResponse-> |
| 5759 | sendRequestRawResponse(responseInfo, data); |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 5760 | checkReturnStatus(slotId, retStatus, false); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5761 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5762 | RLOGE("sendRequestRawResponse: oemHookService[%d]->mOemHookResponse == NULL", |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5763 | slotId); |
| 5764 | } |
| 5765 | |
| 5766 | return 0; |
| 5767 | } |
| 5768 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5769 | int radio::sendRequestStringsResponse(int slotId, |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5770 | int responseType, int serial, RIL_Errno e, |
| 5771 | void *response, size_t responseLen) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5772 | RLOGD("sendRequestStringsResponse: serial %d", serial); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5773 | |
| 5774 | if (oemHookService[slotId]->mOemHookResponse != NULL) { |
| 5775 | RadioResponseInfo responseInfo = {}; |
| 5776 | populateResponseInfo(responseInfo, serial, responseType, e); |
| 5777 | hidl_vec<hidl_string> data; |
| 5778 | |
| 5779 | if (response == NULL || responseLen % sizeof(char *) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5780 | RLOGE("sendRequestStringsResponse Invalid response: NULL"); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5781 | if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; |
| 5782 | } else { |
| 5783 | char **resp = (char **) response; |
| 5784 | int numStrings = responseLen / sizeof(char *); |
| 5785 | data.resize(numStrings); |
| 5786 | for (int i = 0; i < numStrings; i++) { |
| 5787 | data[i] = convertCharPtrToHidlString(resp[i]); |
| 5788 | } |
| 5789 | } |
| 5790 | Return<void> retStatus |
| 5791 | = oemHookService[slotId]->mOemHookResponse->sendRequestStringsResponse( |
| 5792 | responseInfo, data); |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 5793 | checkReturnStatus(slotId, retStatus, false); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5794 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5795 | RLOGE("sendRequestStringsResponse: oemHookService[%d]->mOemHookResponse == " |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 5796 | "NULL", slotId); |
| 5797 | } |
| 5798 | |
| 5799 | return 0; |
| 5800 | } |
| 5801 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 5802 | // Radio Indication functions |
| 5803 | |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5804 | RadioIndicationType convertIntToRadioIndicationType(int indicationType) { |
| 5805 | return indicationType == RESPONSE_UNSOLICITED ? (RadioIndicationType::UNSOLICITED) : |
| 5806 | (RadioIndicationType::UNSOLICITED_ACK_EXP); |
| 5807 | } |
| 5808 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5809 | int radio::radioStateChangedInd(int slotId, |
Amit Mahajan | 1f65269 | 2017-03-01 12:08:46 -0800 | [diff] [blame] | 5810 | int indicationType, int token, RIL_Errno e, void *response, |
| 5811 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5812 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1f65269 | 2017-03-01 12:08:46 -0800 | [diff] [blame] | 5813 | RadioState radioState = (RadioState) s_vendorFunctions->onStateRequest(); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5814 | RLOGD("radioStateChangedInd: radioState %d", radioState); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5815 | Return<void> retStatus = radioService[slotId]->mRadioIndication->radioStateChanged( |
Amit Mahajan | 1f65269 | 2017-03-01 12:08:46 -0800 | [diff] [blame] | 5816 | convertIntToRadioIndicationType(indicationType), radioState); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5817 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 5818 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5819 | RLOGE("radioStateChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 5820 | } |
Amit Mahajan | 1f65269 | 2017-03-01 12:08:46 -0800 | [diff] [blame] | 5821 | |
| 5822 | return 0; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 5823 | } |
| 5824 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5825 | int radio::callStateChangedInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5826 | int indicationType, int token, RIL_Errno e, void *response, |
| 5827 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5828 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5829 | RLOGD("callStateChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5830 | Return<void> retStatus = radioService[slotId]->mRadioIndication->callStateChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5831 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5832 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5833 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5834 | RLOGE("callStateChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5835 | } |
| 5836 | |
| 5837 | return 0; |
| 5838 | } |
| 5839 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5840 | int radio::networkStateChangedInd(int slotId, |
Amit Mahajan | 1f65269 | 2017-03-01 12:08:46 -0800 | [diff] [blame] | 5841 | int indicationType, int token, RIL_Errno e, void *response, |
| 5842 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5843 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5844 | RLOGD("networkStateChangedInd"); |
Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 5845 | Return<void> retStatus = radioService[slotId]->mRadioIndication->networkStateChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5846 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5847 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5848 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5849 | RLOGE("networkStateChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 5850 | slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5851 | } |
| 5852 | |
| 5853 | return 0; |
| 5854 | } |
| 5855 | |
| 5856 | uint8_t hexCharToInt(uint8_t c) { |
| 5857 | if (c >= '0' && c <= '9') return (c - '0'); |
| 5858 | if (c >= 'A' && c <= 'F') return (c - 'A' + 10); |
| 5859 | if (c >= 'a' && c <= 'f') return (c - 'a' + 10); |
| 5860 | |
| 5861 | return INVALID_HEX_CHAR; |
| 5862 | } |
| 5863 | |
| 5864 | uint8_t * convertHexStringToBytes(void *response, size_t responseLen) { |
| 5865 | if (responseLen % 2 != 0) { |
| 5866 | return NULL; |
| 5867 | } |
| 5868 | |
| 5869 | uint8_t *bytes = (uint8_t *)calloc(responseLen/2, sizeof(uint8_t)); |
| 5870 | if (bytes == NULL) { |
| 5871 | RLOGE("convertHexStringToBytes: cannot allocate memory for bytes string"); |
| 5872 | return NULL; |
| 5873 | } |
| 5874 | uint8_t *hexString = (uint8_t *)response; |
| 5875 | |
Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame] | 5876 | for (size_t i = 0; i < responseLen; i += 2) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5877 | uint8_t hexChar1 = hexCharToInt(hexString[i]); |
| 5878 | uint8_t hexChar2 = hexCharToInt(hexString[i + 1]); |
| 5879 | |
| 5880 | if (hexChar1 == INVALID_HEX_CHAR || hexChar2 == INVALID_HEX_CHAR) { |
| 5881 | RLOGE("convertHexStringToBytes: invalid hex char %d %d", |
| 5882 | hexString[i], hexString[i + 1]); |
| 5883 | free(bytes); |
| 5884 | return NULL; |
| 5885 | } |
| 5886 | bytes[i/2] = ((hexChar1 << 4) | hexChar2); |
| 5887 | } |
| 5888 | |
| 5889 | return bytes; |
| 5890 | } |
| 5891 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5892 | int radio::newSmsInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5893 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5894 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5895 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5896 | RLOGE("newSmsInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5897 | return 0; |
| 5898 | } |
| 5899 | |
| 5900 | uint8_t *bytes = convertHexStringToBytes(response, responseLen); |
| 5901 | if (bytes == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5902 | RLOGE("newSmsInd: convertHexStringToBytes failed"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5903 | return 0; |
| 5904 | } |
| 5905 | |
| 5906 | hidl_vec<uint8_t> pdu; |
| 5907 | pdu.setToExternal(bytes, responseLen/2); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5908 | RLOGD("newSmsInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5909 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newSms( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5910 | convertIntToRadioIndicationType(indicationType), pdu); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5911 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5912 | free(bytes); |
| 5913 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5914 | RLOGE("newSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5915 | } |
| 5916 | |
| 5917 | return 0; |
| 5918 | } |
| 5919 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5920 | int radio::newSmsStatusReportInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5921 | int indicationType, int token, RIL_Errno e, void *response, |
| 5922 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5923 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5924 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5925 | RLOGE("newSmsStatusReportInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5926 | return 0; |
| 5927 | } |
| 5928 | |
| 5929 | uint8_t *bytes = convertHexStringToBytes(response, responseLen); |
| 5930 | if (bytes == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5931 | RLOGE("newSmsStatusReportInd: convertHexStringToBytes failed"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5932 | return 0; |
| 5933 | } |
| 5934 | |
| 5935 | hidl_vec<uint8_t> pdu; |
| 5936 | pdu.setToExternal(bytes, responseLen/2); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5937 | RLOGD("newSmsStatusReportInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5938 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newSmsStatusReport( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5939 | convertIntToRadioIndicationType(indicationType), pdu); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5940 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5941 | free(bytes); |
| 5942 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5943 | RLOGE("newSmsStatusReportInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5944 | } |
| 5945 | |
| 5946 | return 0; |
| 5947 | } |
| 5948 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5949 | int radio::newSmsOnSimInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5950 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5951 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5952 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5953 | RLOGE("newSmsOnSimInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5954 | return 0; |
| 5955 | } |
| 5956 | int32_t recordNumber = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5957 | RLOGD("newSmsOnSimInd: slotIndex %d", recordNumber); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5958 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newSmsOnSim( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5959 | convertIntToRadioIndicationType(indicationType), recordNumber); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5960 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5961 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5962 | RLOGE("newSmsOnSimInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5963 | } |
| 5964 | |
| 5965 | return 0; |
| 5966 | } |
| 5967 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5968 | int radio::onUssdInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5969 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5970 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5971 | if (response == NULL || responseLen != 2 * sizeof(char *)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5972 | RLOGE("onUssdInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5973 | return 0; |
| 5974 | } |
| 5975 | char **strings = (char **) response; |
| 5976 | char *mode = strings[0]; |
| 5977 | hidl_string msg = convertCharPtrToHidlString(strings[1]); |
| 5978 | UssdModeType modeType = (UssdModeType) atoi(mode); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5979 | RLOGD("onUssdInd: mode %s", mode); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5980 | Return<void> retStatus = radioService[slotId]->mRadioIndication->onUssd( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5981 | convertIntToRadioIndicationType(indicationType), modeType, msg); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 5982 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5983 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5984 | RLOGE("onUssdInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5985 | } |
| 5986 | |
| 5987 | return 0; |
| 5988 | } |
| 5989 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 5990 | int radio::nitzTimeReceivedInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5991 | int indicationType, int token, RIL_Errno e, void *response, |
| 5992 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 5993 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5994 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 5995 | RLOGE("nitzTimeReceivedInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 5996 | return 0; |
| 5997 | } |
| 5998 | hidl_string nitzTime = convertCharPtrToHidlString((char *) response); |
| 5999 | int64_t timeReceived = android::elapsedRealtime(); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6000 | RLOGD("nitzTimeReceivedInd: nitzTime %s receivedTime %" PRId64, nitzTime.c_str(), |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6001 | timeReceived); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6002 | Return<void> retStatus = radioService[slotId]->mRadioIndication->nitzTimeReceived( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6003 | convertIntToRadioIndicationType(indicationType), nitzTime, timeReceived); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6004 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6005 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6006 | RLOGE("nitzTimeReceivedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Weilun Du | d2c3093 | 2017-02-09 12:32:42 -0800 | [diff] [blame] | 6007 | return -1; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6008 | } |
| 6009 | |
| 6010 | return 0; |
| 6011 | } |
| 6012 | |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6013 | void convertRilSignalStrengthToHal(void *response, size_t responseLen, |
| 6014 | SignalStrength& signalStrength) { |
| 6015 | RIL_SignalStrength_v10 *rilSignalStrength = (RIL_SignalStrength_v10 *) response; |
| 6016 | |
| 6017 | // Fixup LTE for backwards compatibility |
| 6018 | // signalStrength: -1 -> 99 |
| 6019 | if (rilSignalStrength->LTE_SignalStrength.signalStrength == -1) { |
| 6020 | rilSignalStrength->LTE_SignalStrength.signalStrength = 99; |
| 6021 | } |
| 6022 | // rsrp: -1 -> INT_MAX all other negative value to positive. |
| 6023 | // So remap here |
| 6024 | if (rilSignalStrength->LTE_SignalStrength.rsrp == -1) { |
| 6025 | rilSignalStrength->LTE_SignalStrength.rsrp = INT_MAX; |
| 6026 | } else if (rilSignalStrength->LTE_SignalStrength.rsrp < -1) { |
| 6027 | rilSignalStrength->LTE_SignalStrength.rsrp = -rilSignalStrength->LTE_SignalStrength.rsrp; |
| 6028 | } |
| 6029 | // rsrq: -1 -> INT_MAX |
| 6030 | if (rilSignalStrength->LTE_SignalStrength.rsrq == -1) { |
| 6031 | rilSignalStrength->LTE_SignalStrength.rsrq = INT_MAX; |
| 6032 | } |
| 6033 | // Not remapping rssnr is already using INT_MAX |
| 6034 | // cqi: -1 -> INT_MAX |
| 6035 | if (rilSignalStrength->LTE_SignalStrength.cqi == -1) { |
| 6036 | rilSignalStrength->LTE_SignalStrength.cqi = INT_MAX; |
| 6037 | } |
| 6038 | |
| 6039 | signalStrength.gw.signalStrength = rilSignalStrength->GW_SignalStrength.signalStrength; |
| 6040 | signalStrength.gw.bitErrorRate = rilSignalStrength->GW_SignalStrength.bitErrorRate; |
| 6041 | signalStrength.cdma.dbm = rilSignalStrength->CDMA_SignalStrength.dbm; |
| 6042 | signalStrength.cdma.ecio = rilSignalStrength->CDMA_SignalStrength.ecio; |
| 6043 | signalStrength.evdo.dbm = rilSignalStrength->EVDO_SignalStrength.dbm; |
| 6044 | signalStrength.evdo.ecio = rilSignalStrength->EVDO_SignalStrength.ecio; |
| 6045 | signalStrength.evdo.signalNoiseRatio = |
| 6046 | rilSignalStrength->EVDO_SignalStrength.signalNoiseRatio; |
| 6047 | signalStrength.lte.signalStrength = rilSignalStrength->LTE_SignalStrength.signalStrength; |
| 6048 | signalStrength.lte.rsrp = rilSignalStrength->LTE_SignalStrength.rsrp; |
| 6049 | signalStrength.lte.rsrq = rilSignalStrength->LTE_SignalStrength.rsrq; |
| 6050 | signalStrength.lte.rssnr = rilSignalStrength->LTE_SignalStrength.rssnr; |
| 6051 | signalStrength.lte.cqi = rilSignalStrength->LTE_SignalStrength.cqi; |
| 6052 | signalStrength.lte.timingAdvance = rilSignalStrength->LTE_SignalStrength.timingAdvance; |
| 6053 | signalStrength.tdScdma.rscp = rilSignalStrength->TD_SCDMA_SignalStrength.rscp; |
| 6054 | } |
| 6055 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6056 | int radio::currentSignalStrengthInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6057 | int indicationType, int token, RIL_Errno e, |
| 6058 | void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6059 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6060 | if (response == NULL || responseLen != sizeof(RIL_SignalStrength_v10)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6061 | RLOGE("currentSignalStrengthInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6062 | return 0; |
| 6063 | } |
| 6064 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6065 | SignalStrength signalStrength = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6066 | convertRilSignalStrengthToHal(response, responseLen, signalStrength); |
| 6067 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6068 | RLOGD("currentSignalStrengthInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6069 | Return<void> retStatus = radioService[slotId]->mRadioIndication->currentSignalStrength( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6070 | convertIntToRadioIndicationType(indicationType), signalStrength); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6071 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6072 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6073 | RLOGE("currentSignalStrengthInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6074 | slotId); |
| 6075 | } |
| 6076 | |
| 6077 | return 0; |
| 6078 | } |
| 6079 | |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6080 | void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse, |
| 6081 | SetupDataCallResult& dcResult) { |
Jack Yu | 5079e18 | 2017-02-28 15:21:18 -0800 | [diff] [blame] | 6082 | dcResult.status = (DataCallFailCause) dcResponse->status; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6083 | dcResult.suggestedRetryTime = dcResponse->suggestedRetryTime; |
| 6084 | dcResult.cid = dcResponse->cid; |
| 6085 | dcResult.active = dcResponse->active; |
| 6086 | dcResult.type = convertCharPtrToHidlString(dcResponse->type); |
| 6087 | dcResult.ifname = convertCharPtrToHidlString(dcResponse->ifname); |
| 6088 | dcResult.addresses = convertCharPtrToHidlString(dcResponse->addresses); |
| 6089 | dcResult.dnses = convertCharPtrToHidlString(dcResponse->dnses); |
| 6090 | dcResult.gateways = convertCharPtrToHidlString(dcResponse->gateways); |
| 6091 | dcResult.pcscf = convertCharPtrToHidlString(dcResponse->pcscf); |
| 6092 | dcResult.mtu = dcResponse->mtu; |
| 6093 | } |
| 6094 | |
| 6095 | void convertRilDataCallListToHal(void *response, size_t responseLen, |
| 6096 | hidl_vec<SetupDataCallResult>& dcResultList) { |
| 6097 | int num = responseLen / sizeof(RIL_Data_Call_Response_v11); |
| 6098 | |
| 6099 | RIL_Data_Call_Response_v11 *dcResponse = (RIL_Data_Call_Response_v11 *) response; |
| 6100 | dcResultList.resize(num); |
| 6101 | for (int i = 0; i < num; i++) { |
| 6102 | convertRilDataCallToHal(&dcResponse[i], dcResultList[i]); |
| 6103 | } |
| 6104 | } |
| 6105 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6106 | int radio::dataCallListChangedInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6107 | int indicationType, int token, RIL_Errno e, void *response, |
| 6108 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6109 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6110 | if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6111 | RLOGE("dataCallListChangedInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6112 | return 0; |
| 6113 | } |
| 6114 | hidl_vec<SetupDataCallResult> dcList; |
| 6115 | convertRilDataCallListToHal(response, responseLen, dcList); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6116 | RLOGD("dataCallListChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6117 | Return<void> retStatus = radioService[slotId]->mRadioIndication->dataCallListChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6118 | convertIntToRadioIndicationType(indicationType), dcList); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6119 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6120 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6121 | RLOGE("dataCallListChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6122 | } |
| 6123 | |
| 6124 | return 0; |
| 6125 | } |
| 6126 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6127 | int radio::suppSvcNotifyInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6128 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6129 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6130 | if (response == NULL || responseLen != sizeof(RIL_SuppSvcNotification)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6131 | RLOGE("suppSvcNotifyInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6132 | return 0; |
| 6133 | } |
| 6134 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6135 | SuppSvcNotification suppSvc = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6136 | RIL_SuppSvcNotification *ssn = (RIL_SuppSvcNotification *) response; |
| 6137 | suppSvc.isMT = ssn->notificationType; |
| 6138 | suppSvc.code = ssn->code; |
| 6139 | suppSvc.index = ssn->index; |
| 6140 | suppSvc.type = ssn->type; |
| 6141 | suppSvc.number = convertCharPtrToHidlString(ssn->number); |
| 6142 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6143 | RLOGD("suppSvcNotifyInd: isMT %d code %d index %d type %d", |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6144 | suppSvc.isMT, suppSvc.code, suppSvc.index, suppSvc.type); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6145 | Return<void> retStatus = radioService[slotId]->mRadioIndication->suppSvcNotify( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6146 | convertIntToRadioIndicationType(indicationType), suppSvc); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6147 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6148 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6149 | RLOGE("suppSvcNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6150 | } |
| 6151 | |
| 6152 | return 0; |
| 6153 | } |
| 6154 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6155 | int radio::stkSessionEndInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6156 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6157 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6158 | RLOGD("stkSessionEndInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6159 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkSessionEnd( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6160 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6161 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6162 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6163 | RLOGE("stkSessionEndInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6164 | } |
| 6165 | |
| 6166 | return 0; |
| 6167 | } |
| 6168 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6169 | int radio::stkProactiveCommandInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6170 | int indicationType, int token, RIL_Errno e, void *response, |
| 6171 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6172 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6173 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6174 | RLOGE("stkProactiveCommandInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6175 | return 0; |
| 6176 | } |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6177 | RLOGD("stkProactiveCommandInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6178 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkProactiveCommand( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6179 | convertIntToRadioIndicationType(indicationType), |
| 6180 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6181 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6182 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6183 | RLOGE("stkProactiveCommandInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6184 | } |
| 6185 | |
| 6186 | return 0; |
| 6187 | } |
| 6188 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6189 | int radio::stkEventNotifyInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6190 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6191 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6192 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6193 | RLOGE("stkEventNotifyInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6194 | return 0; |
| 6195 | } |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6196 | RLOGD("stkEventNotifyInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6197 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkEventNotify( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6198 | convertIntToRadioIndicationType(indicationType), |
| 6199 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6200 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6201 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6202 | RLOGE("stkEventNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6203 | } |
| 6204 | |
| 6205 | return 0; |
| 6206 | } |
| 6207 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6208 | int radio::stkCallSetupInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6209 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6210 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6211 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6212 | RLOGE("stkCallSetupInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6213 | return 0; |
| 6214 | } |
| 6215 | int32_t timeout = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6216 | RLOGD("stkCallSetupInd: timeout %d", timeout); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6217 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkCallSetup( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6218 | convertIntToRadioIndicationType(indicationType), timeout); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6219 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6220 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6221 | RLOGE("stkCallSetupInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6222 | } |
| 6223 | |
| 6224 | return 0; |
| 6225 | } |
| 6226 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6227 | int radio::simSmsStorageFullInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6228 | int indicationType, int token, RIL_Errno e, void *response, |
| 6229 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6230 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6231 | RLOGD("simSmsStorageFullInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6232 | Return<void> retStatus = radioService[slotId]->mRadioIndication->simSmsStorageFull( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6233 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6234 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6235 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6236 | RLOGE("simSmsStorageFullInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6237 | } |
| 6238 | |
| 6239 | return 0; |
| 6240 | } |
| 6241 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6242 | int radio::simRefreshInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6243 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6244 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6245 | if (response == NULL || responseLen != sizeof(RIL_SimRefreshResponse_v7)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6246 | RLOGE("simRefreshInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6247 | return 0; |
| 6248 | } |
| 6249 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6250 | SimRefreshResult refreshResult = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6251 | RIL_SimRefreshResponse_v7 *simRefreshResponse = ((RIL_SimRefreshResponse_v7 *) response); |
| 6252 | refreshResult.type = |
| 6253 | (android::hardware::radio::V1_0::SimRefreshType) simRefreshResponse->result; |
| 6254 | refreshResult.efId = simRefreshResponse->ef_id; |
| 6255 | refreshResult.aid = convertCharPtrToHidlString(simRefreshResponse->aid); |
| 6256 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6257 | RLOGD("simRefreshInd: type %d efId %d", refreshResult.type, refreshResult.efId); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6258 | Return<void> retStatus = radioService[slotId]->mRadioIndication->simRefresh( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6259 | convertIntToRadioIndicationType(indicationType), refreshResult); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6260 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6261 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6262 | RLOGE("simRefreshInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6263 | } |
| 6264 | |
| 6265 | return 0; |
| 6266 | } |
| 6267 | |
| 6268 | void convertRilCdmaSignalInfoRecordToHal(RIL_CDMA_SignalInfoRecord *signalInfoRecord, |
| 6269 | CdmaSignalInfoRecord& record) { |
| 6270 | record.isPresent = signalInfoRecord->isPresent; |
| 6271 | record.signalType = signalInfoRecord->signalType; |
| 6272 | record.alertPitch = signalInfoRecord->alertPitch; |
| 6273 | record.signal = signalInfoRecord->signal; |
| 6274 | } |
| 6275 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6276 | int radio::callRingInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6277 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6278 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6279 | bool isGsm; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6280 | CdmaSignalInfoRecord record = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6281 | if (response == NULL || responseLen == 0) { |
| 6282 | isGsm = true; |
| 6283 | } else { |
| 6284 | isGsm = false; |
| 6285 | if (responseLen != sizeof (RIL_CDMA_SignalInfoRecord)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6286 | RLOGE("callRingInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6287 | return 0; |
| 6288 | } |
| 6289 | convertRilCdmaSignalInfoRecordToHal((RIL_CDMA_SignalInfoRecord *) response, record); |
| 6290 | } |
| 6291 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6292 | RLOGD("callRingInd: isGsm %d", isGsm); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6293 | Return<void> retStatus = radioService[slotId]->mRadioIndication->callRing( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6294 | convertIntToRadioIndicationType(indicationType), isGsm, record); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6295 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6296 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6297 | RLOGE("callRingInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6298 | } |
| 6299 | |
| 6300 | return 0; |
| 6301 | } |
| 6302 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6303 | int radio::simStatusChangedInd(int slotId, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6304 | int indicationType, int token, RIL_Errno e, void *response, |
| 6305 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6306 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6307 | RLOGD("simStatusChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6308 | Return<void> retStatus = radioService[slotId]->mRadioIndication->simStatusChanged( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6309 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6310 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6311 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6312 | RLOGE("simStatusChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6313 | } |
| 6314 | |
| 6315 | return 0; |
| 6316 | } |
| 6317 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6318 | int radio::cdmaNewSmsInd(int slotId, int indicationType, |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6319 | int token, RIL_Errno e, void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6320 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6321 | if (response == NULL || responseLen != sizeof(RIL_CDMA_SMS_Message)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6322 | RLOGE("cdmaNewSmsInd: invalid response"); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6323 | return 0; |
| 6324 | } |
| 6325 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6326 | CdmaSmsMessage msg = {}; |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6327 | RIL_CDMA_SMS_Message *rilMsg = (RIL_CDMA_SMS_Message *) response; |
| 6328 | msg.teleserviceId = rilMsg->uTeleserviceID; |
| 6329 | msg.isServicePresent = rilMsg->bIsServicePresent; |
| 6330 | msg.serviceCategory = rilMsg->uServicecategory; |
| 6331 | msg.address.digitMode = |
| 6332 | (android::hardware::radio::V1_0::CdmaSmsDigitMode) rilMsg->sAddress.digit_mode; |
| 6333 | msg.address.numberMode = |
| 6334 | (android::hardware::radio::V1_0::CdmaSmsNumberMode) rilMsg->sAddress.number_mode; |
| 6335 | msg.address.numberType = |
| 6336 | (android::hardware::radio::V1_0::CdmaSmsNumberType) rilMsg->sAddress.number_type; |
| 6337 | msg.address.numberPlan = |
| 6338 | (android::hardware::radio::V1_0::CdmaSmsNumberPlan) rilMsg->sAddress.number_plan; |
| 6339 | |
| 6340 | int digitLimit = MIN((rilMsg->sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX); |
| 6341 | msg.address.digits.setToExternal(rilMsg->sAddress.digits, digitLimit); |
| 6342 | |
| 6343 | msg.subAddress.subaddressType = (android::hardware::radio::V1_0::CdmaSmsSubaddressType) |
| 6344 | rilMsg->sSubAddress.subaddressType; |
| 6345 | msg.subAddress.odd = rilMsg->sSubAddress.odd; |
| 6346 | |
| 6347 | digitLimit= MIN((rilMsg->sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX); |
| 6348 | msg.subAddress.digits.setToExternal(rilMsg->sSubAddress.digits, digitLimit); |
| 6349 | |
| 6350 | digitLimit = MIN((rilMsg->uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX); |
| 6351 | msg.bearerData.setToExternal(rilMsg->aBearerData, digitLimit); |
| 6352 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6353 | RLOGD("cdmaNewSmsInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6354 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaNewSms( |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6355 | convertIntToRadioIndicationType(indicationType), msg); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6356 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6357 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6358 | RLOGE("cdmaNewSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 6359 | } |
| 6360 | |
| 6361 | return 0; |
| 6362 | } |
| 6363 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6364 | int radio::newBroadcastSmsInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6365 | int indicationType, int token, RIL_Errno e, void *response, |
| 6366 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6367 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6368 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6369 | RLOGE("newBroadcastSmsInd: invalid response"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6370 | return 0; |
| 6371 | } |
| 6372 | |
| 6373 | hidl_vec<uint8_t> data; |
| 6374 | data.setToExternal((uint8_t *) response, responseLen); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6375 | RLOGD("newBroadcastSmsInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6376 | Return<void> retStatus = radioService[slotId]->mRadioIndication->newBroadcastSms( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6377 | convertIntToRadioIndicationType(indicationType), data); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6378 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6379 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6380 | RLOGE("newBroadcastSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6381 | } |
| 6382 | |
| 6383 | return 0; |
| 6384 | } |
| 6385 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6386 | int radio::cdmaRuimSmsStorageFullInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6387 | int indicationType, int token, RIL_Errno e, void *response, |
| 6388 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6389 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6390 | RLOGD("cdmaRuimSmsStorageFullInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6391 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaRuimSmsStorageFull( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6392 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6393 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6394 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6395 | RLOGE("cdmaRuimSmsStorageFullInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6396 | slotId); |
| 6397 | } |
| 6398 | |
| 6399 | return 0; |
| 6400 | } |
| 6401 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6402 | int radio::restrictedStateChangedInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6403 | int indicationType, int token, RIL_Errno e, void *response, |
| 6404 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6405 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6406 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6407 | RLOGE("restrictedStateChangedInd: invalid response"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6408 | return 0; |
| 6409 | } |
| 6410 | int32_t state = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6411 | RLOGD("restrictedStateChangedInd: state %d", state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6412 | Return<void> retStatus = radioService[slotId]->mRadioIndication->restrictedStateChanged( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6413 | convertIntToRadioIndicationType(indicationType), (PhoneRestrictedState) state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6414 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6415 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6416 | RLOGE("restrictedStateChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6417 | slotId); |
| 6418 | } |
| 6419 | |
| 6420 | return 0; |
| 6421 | } |
| 6422 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6423 | int radio::enterEmergencyCallbackModeInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6424 | int indicationType, int token, RIL_Errno e, void *response, |
| 6425 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6426 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6427 | RLOGD("enterEmergencyCallbackModeInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6428 | Return<void> retStatus = radioService[slotId]->mRadioIndication->enterEmergencyCallbackMode( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6429 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6430 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6431 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6432 | RLOGE("enterEmergencyCallbackModeInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6433 | slotId); |
| 6434 | } |
| 6435 | |
| 6436 | return 0; |
| 6437 | } |
| 6438 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6439 | int radio::cdmaCallWaitingInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6440 | int indicationType, int token, RIL_Errno e, void *response, |
| 6441 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6442 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6443 | if (response == NULL || responseLen != sizeof(RIL_CDMA_CallWaiting_v6)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6444 | RLOGE("cdmaCallWaitingInd: invalid response"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6445 | return 0; |
| 6446 | } |
| 6447 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6448 | CdmaCallWaiting callWaitingRecord = {}; |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6449 | RIL_CDMA_CallWaiting_v6 *callWaitingRil = ((RIL_CDMA_CallWaiting_v6 *) response); |
| 6450 | callWaitingRecord.number = convertCharPtrToHidlString(callWaitingRil->number); |
| 6451 | callWaitingRecord.numberPresentation = |
| 6452 | (CdmaCallWaitingNumberPresentation) callWaitingRil->numberPresentation; |
| 6453 | callWaitingRecord.name = convertCharPtrToHidlString(callWaitingRil->name); |
| 6454 | convertRilCdmaSignalInfoRecordToHal(&callWaitingRil->signalInfoRecord, |
| 6455 | callWaitingRecord.signalInfoRecord); |
| 6456 | callWaitingRecord.numberType = (CdmaCallWaitingNumberType) callWaitingRil->number_type; |
| 6457 | callWaitingRecord.numberPlan = (CdmaCallWaitingNumberPlan) callWaitingRil->number_plan; |
| 6458 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6459 | RLOGD("cdmaCallWaitingInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6460 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaCallWaiting( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6461 | convertIntToRadioIndicationType(indicationType), callWaitingRecord); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6462 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6463 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6464 | RLOGE("cdmaCallWaitingInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6465 | } |
| 6466 | |
| 6467 | return 0; |
| 6468 | } |
| 6469 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6470 | int radio::cdmaOtaProvisionStatusInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6471 | int indicationType, int token, RIL_Errno e, void *response, |
| 6472 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6473 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6474 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6475 | RLOGE("cdmaOtaProvisionStatusInd: invalid response"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6476 | return 0; |
| 6477 | } |
| 6478 | int32_t status = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6479 | RLOGD("cdmaOtaProvisionStatusInd: status %d", status); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6480 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaOtaProvisionStatus( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6481 | convertIntToRadioIndicationType(indicationType), (CdmaOtaProvisionStatus) status); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6482 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6483 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6484 | RLOGE("cdmaOtaProvisionStatusInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6485 | slotId); |
| 6486 | } |
| 6487 | |
| 6488 | return 0; |
| 6489 | } |
| 6490 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6491 | int radio::cdmaInfoRecInd(int slotId, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6492 | int indicationType, int token, RIL_Errno e, void *response, |
| 6493 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6494 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6495 | if (response == NULL || responseLen != sizeof(RIL_CDMA_InformationRecords)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6496 | RLOGE("cdmaInfoRecInd: invalid response"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6497 | return 0; |
| 6498 | } |
| 6499 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 6500 | CdmaInformationRecords records = {}; |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6501 | RIL_CDMA_InformationRecords *recordsRil = (RIL_CDMA_InformationRecords *) response; |
| 6502 | |
| 6503 | char* string8 = NULL; |
| 6504 | int num = MIN(recordsRil->numberOfInfoRecs, RIL_CDMA_MAX_NUMBER_OF_INFO_RECS); |
| 6505 | if (recordsRil->numberOfInfoRecs > RIL_CDMA_MAX_NUMBER_OF_INFO_RECS) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6506 | RLOGE("cdmaInfoRecInd: received %d recs which is more than %d, dropping " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6507 | "additional ones", recordsRil->numberOfInfoRecs, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6508 | RIL_CDMA_MAX_NUMBER_OF_INFO_RECS); |
| 6509 | } |
| 6510 | records.infoRec.resize(num); |
| 6511 | for (int i = 0 ; i < num ; i++) { |
| 6512 | CdmaInformationRecord *record = &records.infoRec[i]; |
| 6513 | RIL_CDMA_InformationRecord *infoRec = &recordsRil->infoRec[i]; |
| 6514 | record->name = (CdmaInfoRecName) infoRec->name; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6515 | // All vectors should be size 0 except one which will be size 1. Set everything to |
| 6516 | // size 0 initially. |
| 6517 | record->display.resize(0); |
| 6518 | record->number.resize(0); |
| 6519 | record->signal.resize(0); |
| 6520 | record->redir.resize(0); |
| 6521 | record->lineCtrl.resize(0); |
| 6522 | record->clir.resize(0); |
| 6523 | record->audioCtrl.resize(0); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6524 | switch (infoRec->name) { |
| 6525 | case RIL_CDMA_DISPLAY_INFO_REC: |
| 6526 | case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: { |
| 6527 | if (infoRec->rec.display.alpha_len > CDMA_ALPHA_INFO_BUFFER_LENGTH) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6528 | RLOGE("cdmaInfoRecInd: invalid display info response length %d " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6529 | "expected not more than %d", (int) infoRec->rec.display.alpha_len, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6530 | CDMA_ALPHA_INFO_BUFFER_LENGTH); |
| 6531 | return 0; |
| 6532 | } |
| 6533 | string8 = (char*) malloc((infoRec->rec.display.alpha_len + 1) * sizeof(char)); |
| 6534 | if (string8 == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6535 | RLOGE("cdmaInfoRecInd: Memory allocation failed for " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6536 | "responseCdmaInformationRecords"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6537 | return 0; |
| 6538 | } |
| 6539 | memcpy(string8, infoRec->rec.display.alpha_buf, infoRec->rec.display.alpha_len); |
| 6540 | string8[(int)infoRec->rec.display.alpha_len] = '\0'; |
| 6541 | |
| 6542 | record->display.resize(1); |
| 6543 | record->display[0].alphaBuf = string8; |
| 6544 | free(string8); |
| 6545 | string8 = NULL; |
| 6546 | break; |
| 6547 | } |
| 6548 | |
| 6549 | case RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: |
| 6550 | case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: |
| 6551 | case RIL_CDMA_CONNECTED_NUMBER_INFO_REC: { |
| 6552 | if (infoRec->rec.number.len > CDMA_NUMBER_INFO_BUFFER_LENGTH) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6553 | RLOGE("cdmaInfoRecInd: invalid display info response length %d " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6554 | "expected not more than %d", (int) infoRec->rec.number.len, |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6555 | CDMA_NUMBER_INFO_BUFFER_LENGTH); |
| 6556 | return 0; |
| 6557 | } |
| 6558 | string8 = (char*) malloc((infoRec->rec.number.len + 1) * sizeof(char)); |
| 6559 | if (string8 == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6560 | RLOGE("cdmaInfoRecInd: Memory allocation failed for " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6561 | "responseCdmaInformationRecords"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6562 | return 0; |
| 6563 | } |
| 6564 | memcpy(string8, infoRec->rec.number.buf, infoRec->rec.number.len); |
| 6565 | string8[(int)infoRec->rec.number.len] = '\0'; |
| 6566 | |
| 6567 | record->number.resize(1); |
| 6568 | record->number[0].number = string8; |
| 6569 | free(string8); |
| 6570 | string8 = NULL; |
| 6571 | record->number[0].numberType = infoRec->rec.number.number_type; |
| 6572 | record->number[0].numberPlan = infoRec->rec.number.number_plan; |
| 6573 | record->number[0].pi = infoRec->rec.number.pi; |
| 6574 | record->number[0].si = infoRec->rec.number.si; |
| 6575 | break; |
| 6576 | } |
| 6577 | |
| 6578 | case RIL_CDMA_SIGNAL_INFO_REC: { |
| 6579 | record->signal.resize(1); |
| 6580 | record->signal[0].isPresent = infoRec->rec.signal.isPresent; |
| 6581 | record->signal[0].signalType = infoRec->rec.signal.signalType; |
| 6582 | record->signal[0].alertPitch = infoRec->rec.signal.alertPitch; |
| 6583 | record->signal[0].signal = infoRec->rec.signal.signal; |
| 6584 | break; |
| 6585 | } |
| 6586 | |
| 6587 | case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: { |
| 6588 | if (infoRec->rec.redir.redirectingNumber.len > |
| 6589 | CDMA_NUMBER_INFO_BUFFER_LENGTH) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6590 | RLOGE("cdmaInfoRecInd: invalid display info response length %d " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6591 | "expected not more than %d\n", |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6592 | (int)infoRec->rec.redir.redirectingNumber.len, |
| 6593 | CDMA_NUMBER_INFO_BUFFER_LENGTH); |
| 6594 | return 0; |
| 6595 | } |
| 6596 | string8 = (char*) malloc((infoRec->rec.redir.redirectingNumber.len + 1) * |
| 6597 | sizeof(char)); |
| 6598 | if (string8 == NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6599 | RLOGE("cdmaInfoRecInd: Memory allocation failed for " |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6600 | "responseCdmaInformationRecords"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6601 | return 0; |
| 6602 | } |
| 6603 | memcpy(string8, infoRec->rec.redir.redirectingNumber.buf, |
| 6604 | infoRec->rec.redir.redirectingNumber.len); |
| 6605 | string8[(int)infoRec->rec.redir.redirectingNumber.len] = '\0'; |
| 6606 | |
| 6607 | record->redir.resize(1); |
| 6608 | record->redir[0].redirectingNumber.number = string8; |
| 6609 | free(string8); |
| 6610 | string8 = NULL; |
| 6611 | record->redir[0].redirectingNumber.numberType = |
| 6612 | infoRec->rec.redir.redirectingNumber.number_type; |
| 6613 | record->redir[0].redirectingNumber.numberPlan = |
| 6614 | infoRec->rec.redir.redirectingNumber.number_plan; |
| 6615 | record->redir[0].redirectingNumber.pi = infoRec->rec.redir.redirectingNumber.pi; |
| 6616 | record->redir[0].redirectingNumber.si = infoRec->rec.redir.redirectingNumber.si; |
| 6617 | record->redir[0].redirectingReason = |
| 6618 | (CdmaRedirectingReason) infoRec->rec.redir.redirectingReason; |
| 6619 | break; |
| 6620 | } |
| 6621 | |
| 6622 | case RIL_CDMA_LINE_CONTROL_INFO_REC: { |
| 6623 | record->lineCtrl.resize(1); |
| 6624 | record->lineCtrl[0].lineCtrlPolarityIncluded = |
| 6625 | infoRec->rec.lineCtrl.lineCtrlPolarityIncluded; |
| 6626 | record->lineCtrl[0].lineCtrlToggle = infoRec->rec.lineCtrl.lineCtrlToggle; |
| 6627 | record->lineCtrl[0].lineCtrlReverse = infoRec->rec.lineCtrl.lineCtrlReverse; |
| 6628 | record->lineCtrl[0].lineCtrlPowerDenial = |
| 6629 | infoRec->rec.lineCtrl.lineCtrlPowerDenial; |
| 6630 | break; |
| 6631 | } |
| 6632 | |
| 6633 | case RIL_CDMA_T53_CLIR_INFO_REC: { |
| 6634 | record->clir.resize(1); |
| 6635 | record->clir[0].cause = infoRec->rec.clir.cause; |
| 6636 | break; |
| 6637 | } |
| 6638 | |
| 6639 | case RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: { |
| 6640 | record->audioCtrl.resize(1); |
| 6641 | record->audioCtrl[0].upLink = infoRec->rec.audioCtrl.upLink; |
| 6642 | record->audioCtrl[0].downLink = infoRec->rec.audioCtrl.downLink; |
| 6643 | break; |
| 6644 | } |
| 6645 | |
| 6646 | case RIL_CDMA_T53_RELEASE_INFO_REC: |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6647 | RLOGE("cdmaInfoRecInd: RIL_CDMA_T53_RELEASE_INFO_REC: INVALID"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6648 | return 0; |
| 6649 | |
| 6650 | default: |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6651 | RLOGE("cdmaInfoRecInd: Incorrect name value"); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6652 | return 0; |
| 6653 | } |
| 6654 | } |
| 6655 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6656 | RLOGD("cdmaInfoRecInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6657 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaInfoRec( |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6658 | convertIntToRadioIndicationType(indicationType), records); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6659 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6660 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6661 | RLOGE("cdmaInfoRecInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 6662 | } |
| 6663 | |
| 6664 | return 0; |
| 6665 | } |
| 6666 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6667 | int radio::indicateRingbackToneInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6668 | int indicationType, int token, RIL_Errno e, void *response, |
| 6669 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6670 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6671 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6672 | RLOGE("indicateRingbackToneInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6673 | return 0; |
| 6674 | } |
| 6675 | bool start = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6676 | RLOGD("indicateRingbackToneInd: start %d", start); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6677 | Return<void> retStatus = radioService[slotId]->mRadioIndication->indicateRingbackTone( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6678 | convertIntToRadioIndicationType(indicationType), start); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6679 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6680 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6681 | RLOGE("indicateRingbackToneInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6682 | } |
| 6683 | |
| 6684 | return 0; |
| 6685 | } |
| 6686 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6687 | int radio::resendIncallMuteInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6688 | int indicationType, int token, RIL_Errno e, void *response, |
| 6689 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6690 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6691 | RLOGD("resendIncallMuteInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6692 | Return<void> retStatus = radioService[slotId]->mRadioIndication->resendIncallMute( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6693 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6694 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6695 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6696 | RLOGE("resendIncallMuteInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6697 | } |
| 6698 | |
| 6699 | return 0; |
| 6700 | } |
| 6701 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6702 | int radio::cdmaSubscriptionSourceChangedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6703 | int indicationType, int token, RIL_Errno e, |
| 6704 | void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6705 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6706 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6707 | RLOGE("cdmaSubscriptionSourceChangedInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6708 | return 0; |
| 6709 | } |
| 6710 | int32_t cdmaSource = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6711 | RLOGD("cdmaSubscriptionSourceChangedInd: cdmaSource %d", cdmaSource); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6712 | Return<void> retStatus = radioService[slotId]->mRadioIndication-> |
| 6713 | cdmaSubscriptionSourceChanged(convertIntToRadioIndicationType(indicationType), |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6714 | (CdmaSubscriptionSource) cdmaSource); |
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 { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6717 | RLOGE("cdmaSubscriptionSourceChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6718 | slotId); |
| 6719 | } |
| 6720 | |
| 6721 | return 0; |
| 6722 | } |
| 6723 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6724 | int radio::cdmaPrlChangedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6725 | int indicationType, int token, RIL_Errno e, void *response, |
| 6726 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6727 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6728 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6729 | RLOGE("cdmaPrlChangedInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6730 | return 0; |
| 6731 | } |
| 6732 | int32_t version = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6733 | RLOGD("cdmaPrlChangedInd: version %d", version); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6734 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaPrlChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6735 | convertIntToRadioIndicationType(indicationType), version); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6736 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6737 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6738 | RLOGE("cdmaPrlChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6739 | } |
| 6740 | |
| 6741 | return 0; |
| 6742 | } |
| 6743 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6744 | int radio::exitEmergencyCallbackModeInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6745 | int indicationType, int token, RIL_Errno e, void *response, |
| 6746 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6747 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6748 | RLOGD("exitEmergencyCallbackModeInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6749 | Return<void> retStatus = radioService[slotId]->mRadioIndication->exitEmergencyCallbackMode( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6750 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6751 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6752 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6753 | RLOGE("exitEmergencyCallbackModeInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6754 | slotId); |
| 6755 | } |
| 6756 | |
| 6757 | return 0; |
| 6758 | } |
| 6759 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6760 | int radio::rilConnectedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6761 | int indicationType, int token, RIL_Errno e, void *response, |
| 6762 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6763 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6764 | RLOGD("rilConnectedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6765 | Return<void> retStatus = radioService[slotId]->mRadioIndication->rilConnected( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6766 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6767 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6768 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6769 | RLOGE("rilConnectedInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6770 | } |
| 6771 | |
| 6772 | return 0; |
| 6773 | } |
| 6774 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6775 | int radio::voiceRadioTechChangedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6776 | int indicationType, int token, RIL_Errno e, void *response, |
| 6777 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6778 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6779 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6780 | RLOGE("voiceRadioTechChangedInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6781 | return 0; |
| 6782 | } |
| 6783 | int32_t rat = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6784 | RLOGD("voiceRadioTechChangedInd: rat %d", rat); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6785 | Return<void> retStatus = radioService[slotId]->mRadioIndication->voiceRadioTechChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6786 | convertIntToRadioIndicationType(indicationType), (RadioTechnology) rat); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6787 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6788 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6789 | RLOGE("voiceRadioTechChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6790 | slotId); |
| 6791 | } |
| 6792 | |
| 6793 | return 0; |
| 6794 | } |
| 6795 | |
| 6796 | void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<CellInfo>& records) { |
| 6797 | int num = responseLen / sizeof(RIL_CellInfo_v12); |
| 6798 | records.resize(num); |
| 6799 | |
| 6800 | RIL_CellInfo_v12 *rillCellInfo = (RIL_CellInfo_v12 *) response; |
| 6801 | for (int i = 0; i < num; i++) { |
| 6802 | records[i].cellInfoType = (CellInfoType) rillCellInfo->cellInfoType; |
| 6803 | records[i].registered = rillCellInfo->registered; |
| 6804 | records[i].timeStampType = (TimeStampType) rillCellInfo->timeStampType; |
| 6805 | records[i].timeStamp = rillCellInfo->timeStamp; |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 6806 | // All vectors should be size 0 except one which will be size 1. Set everything to |
| 6807 | // size 0 initially. |
| 6808 | records[i].gsm.resize(0); |
| 6809 | records[i].wcdma.resize(0); |
| 6810 | records[i].cdma.resize(0); |
| 6811 | records[i].lte.resize(0); |
| 6812 | records[i].tdscdma.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6813 | switch(rillCellInfo->cellInfoType) { |
| 6814 | case RIL_CELL_INFO_TYPE_GSM: { |
| 6815 | records[i].gsm.resize(1); |
| 6816 | CellInfoGsm *cellInfoGsm = &records[i].gsm[0]; |
| 6817 | cellInfoGsm->cellIdentityGsm.mcc = |
| 6818 | std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mcc); |
| 6819 | cellInfoGsm->cellIdentityGsm.mnc = |
| 6820 | std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mnc); |
| 6821 | cellInfoGsm->cellIdentityGsm.lac = |
| 6822 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.lac; |
| 6823 | cellInfoGsm->cellIdentityGsm.cid = |
| 6824 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.cid; |
| 6825 | cellInfoGsm->cellIdentityGsm.arfcn = |
| 6826 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.arfcn; |
| 6827 | cellInfoGsm->cellIdentityGsm.bsic = |
| 6828 | rillCellInfo->CellInfo.gsm.cellIdentityGsm.bsic; |
| 6829 | cellInfoGsm->signalStrengthGsm.signalStrength = |
| 6830 | rillCellInfo->CellInfo.gsm.signalStrengthGsm.signalStrength; |
| 6831 | cellInfoGsm->signalStrengthGsm.bitErrorRate = |
| 6832 | rillCellInfo->CellInfo.gsm.signalStrengthGsm.bitErrorRate; |
| 6833 | cellInfoGsm->signalStrengthGsm.timingAdvance = |
| 6834 | rillCellInfo->CellInfo.gsm.signalStrengthGsm.timingAdvance; |
| 6835 | break; |
| 6836 | } |
| 6837 | |
| 6838 | case RIL_CELL_INFO_TYPE_WCDMA: { |
| 6839 | records[i].wcdma.resize(1); |
| 6840 | CellInfoWcdma *cellInfoWcdma = &records[i].wcdma[0]; |
| 6841 | cellInfoWcdma->cellIdentityWcdma.mcc = |
| 6842 | std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mcc); |
| 6843 | cellInfoWcdma->cellIdentityWcdma.mnc = |
| 6844 | std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mnc); |
| 6845 | cellInfoWcdma->cellIdentityWcdma.lac = |
| 6846 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.lac; |
| 6847 | cellInfoWcdma->cellIdentityWcdma.cid = |
| 6848 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.cid; |
| 6849 | cellInfoWcdma->cellIdentityWcdma.psc = |
| 6850 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.psc; |
| 6851 | cellInfoWcdma->cellIdentityWcdma.uarfcn = |
| 6852 | rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.uarfcn; |
| 6853 | cellInfoWcdma->signalStrengthWcdma.signalStrength = |
| 6854 | rillCellInfo->CellInfo.wcdma.signalStrengthWcdma.signalStrength; |
| 6855 | cellInfoWcdma->signalStrengthWcdma.bitErrorRate = |
| 6856 | rillCellInfo->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate; |
| 6857 | break; |
| 6858 | } |
| 6859 | |
| 6860 | case RIL_CELL_INFO_TYPE_CDMA: { |
| 6861 | records[i].cdma.resize(1); |
| 6862 | CellInfoCdma *cellInfoCdma = &records[i].cdma[0]; |
| 6863 | cellInfoCdma->cellIdentityCdma.networkId = |
| 6864 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.networkId; |
| 6865 | cellInfoCdma->cellIdentityCdma.systemId = |
| 6866 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.systemId; |
| 6867 | cellInfoCdma->cellIdentityCdma.baseStationId = |
| 6868 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.basestationId; |
| 6869 | cellInfoCdma->cellIdentityCdma.longitude = |
| 6870 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.longitude; |
| 6871 | cellInfoCdma->cellIdentityCdma.latitude = |
| 6872 | rillCellInfo->CellInfo.cdma.cellIdentityCdma.latitude; |
| 6873 | cellInfoCdma->signalStrengthCdma.dbm = |
| 6874 | rillCellInfo->CellInfo.cdma.signalStrengthCdma.dbm; |
| 6875 | cellInfoCdma->signalStrengthCdma.ecio = |
| 6876 | rillCellInfo->CellInfo.cdma.signalStrengthCdma.ecio; |
| 6877 | cellInfoCdma->signalStrengthEvdo.dbm = |
| 6878 | rillCellInfo->CellInfo.cdma.signalStrengthEvdo.dbm; |
| 6879 | cellInfoCdma->signalStrengthEvdo.ecio = |
| 6880 | rillCellInfo->CellInfo.cdma.signalStrengthEvdo.ecio; |
| 6881 | cellInfoCdma->signalStrengthEvdo.signalNoiseRatio = |
| 6882 | rillCellInfo->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio; |
| 6883 | break; |
| 6884 | } |
| 6885 | |
| 6886 | case RIL_CELL_INFO_TYPE_LTE: { |
| 6887 | records[i].lte.resize(1); |
| 6888 | CellInfoLte *cellInfoLte = &records[i].lte[0]; |
| 6889 | cellInfoLte->cellIdentityLte.mcc = |
| 6890 | std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mcc); |
| 6891 | cellInfoLte->cellIdentityLte.mnc = |
| 6892 | std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mnc); |
| 6893 | cellInfoLte->cellIdentityLte.ci = |
| 6894 | rillCellInfo->CellInfo.lte.cellIdentityLte.ci; |
| 6895 | cellInfoLte->cellIdentityLte.pci = |
| 6896 | rillCellInfo->CellInfo.lte.cellIdentityLte.pci; |
| 6897 | cellInfoLte->cellIdentityLte.tac = |
| 6898 | rillCellInfo->CellInfo.lte.cellIdentityLte.tac; |
| 6899 | cellInfoLte->cellIdentityLte.earfcn = |
| 6900 | rillCellInfo->CellInfo.lte.cellIdentityLte.earfcn; |
| 6901 | cellInfoLte->signalStrengthLte.signalStrength = |
| 6902 | rillCellInfo->CellInfo.lte.signalStrengthLte.signalStrength; |
| 6903 | cellInfoLte->signalStrengthLte.rsrp = |
| 6904 | rillCellInfo->CellInfo.lte.signalStrengthLte.rsrp; |
| 6905 | cellInfoLte->signalStrengthLte.rsrq = |
| 6906 | rillCellInfo->CellInfo.lte.signalStrengthLte.rsrq; |
| 6907 | cellInfoLte->signalStrengthLte.rssnr = |
| 6908 | rillCellInfo->CellInfo.lte.signalStrengthLte.rssnr; |
| 6909 | cellInfoLte->signalStrengthLte.cqi = |
| 6910 | rillCellInfo->CellInfo.lte.signalStrengthLte.cqi; |
| 6911 | cellInfoLte->signalStrengthLte.timingAdvance = |
| 6912 | rillCellInfo->CellInfo.lte.signalStrengthLte.timingAdvance; |
| 6913 | break; |
| 6914 | } |
| 6915 | |
| 6916 | case RIL_CELL_INFO_TYPE_TD_SCDMA: { |
| 6917 | records[i].tdscdma.resize(1); |
| 6918 | CellInfoTdscdma *cellInfoTdscdma = &records[i].tdscdma[0]; |
| 6919 | cellInfoTdscdma->cellIdentityTdscdma.mcc = |
| 6920 | std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mcc); |
| 6921 | cellInfoTdscdma->cellIdentityTdscdma.mnc = |
| 6922 | std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mnc); |
| 6923 | cellInfoTdscdma->cellIdentityTdscdma.lac = |
| 6924 | rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.lac; |
| 6925 | cellInfoTdscdma->cellIdentityTdscdma.cid = |
| 6926 | rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.cid; |
| 6927 | cellInfoTdscdma->cellIdentityTdscdma.cpid = |
| 6928 | rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.cpid; |
| 6929 | cellInfoTdscdma->signalStrengthTdscdma.rscp = |
| 6930 | rillCellInfo->CellInfo.tdscdma.signalStrengthTdscdma.rscp; |
| 6931 | break; |
| 6932 | } |
Sooraj Sasindran | d8db60c | 2016-11-30 18:36:03 -0800 | [diff] [blame] | 6933 | default: { |
| 6934 | break; |
| 6935 | } |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6936 | } |
| 6937 | rillCellInfo += 1; |
| 6938 | } |
| 6939 | } |
| 6940 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6941 | int radio::cellInfoListInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6942 | int indicationType, int token, RIL_Errno e, void *response, |
| 6943 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6944 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6945 | if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6946 | RLOGE("cellInfoListInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6947 | return 0; |
| 6948 | } |
| 6949 | |
| 6950 | hidl_vec<CellInfo> records; |
| 6951 | convertRilCellInfoListToHal(response, responseLen, records); |
| 6952 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6953 | RLOGD("cellInfoListInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6954 | Return<void> retStatus = radioService[slotId]->mRadioIndication->cellInfoList( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6955 | convertIntToRadioIndicationType(indicationType), records); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6956 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6957 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6958 | RLOGE("cellInfoListInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6959 | } |
| 6960 | |
| 6961 | return 0; |
| 6962 | } |
| 6963 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6964 | int radio::imsNetworkStateChangedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6965 | int indicationType, int token, RIL_Errno e, void *response, |
| 6966 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6967 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6968 | RLOGD("imsNetworkStateChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6969 | Return<void> retStatus = radioService[slotId]->mRadioIndication->imsNetworkStateChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6970 | convertIntToRadioIndicationType(indicationType)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6971 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6972 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6973 | RLOGE("imsNetworkStateChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6974 | slotId); |
| 6975 | } |
| 6976 | |
| 6977 | return 0; |
| 6978 | } |
| 6979 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 6980 | int radio::subscriptionStatusChangedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6981 | int indicationType, int token, RIL_Errno e, void *response, |
| 6982 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 6983 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6984 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6985 | RLOGE("subscriptionStatusChangedInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6986 | return 0; |
| 6987 | } |
| 6988 | bool activate = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6989 | RLOGD("subscriptionStatusChangedInd: activate %d", activate); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6990 | Return<void> retStatus = radioService[slotId]->mRadioIndication->subscriptionStatusChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6991 | convertIntToRadioIndicationType(indicationType), activate); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 6992 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6993 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 6994 | RLOGE("subscriptionStatusChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 6995 | slotId); |
| 6996 | } |
| 6997 | |
| 6998 | return 0; |
| 6999 | } |
| 7000 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7001 | int radio::srvccStateNotifyInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7002 | int indicationType, int token, RIL_Errno e, void *response, |
| 7003 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7004 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7005 | if (response == NULL || responseLen != sizeof(int)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7006 | RLOGE("srvccStateNotifyInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7007 | return 0; |
| 7008 | } |
| 7009 | int32_t state = ((int32_t *) response)[0]; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7010 | RLOGD("srvccStateNotifyInd: rat %d", state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7011 | Return<void> retStatus = radioService[slotId]->mRadioIndication->srvccStateNotify( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7012 | convertIntToRadioIndicationType(indicationType), (SrvccState) state); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7013 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7014 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7015 | RLOGE("srvccStateNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7016 | } |
| 7017 | |
| 7018 | return 0; |
| 7019 | } |
| 7020 | |
| 7021 | void convertRilHardwareConfigListToHal(void *response, size_t responseLen, |
| 7022 | hidl_vec<HardwareConfig>& records) { |
| 7023 | int num = responseLen / sizeof(RIL_HardwareConfig); |
| 7024 | records.resize(num); |
| 7025 | |
| 7026 | RIL_HardwareConfig *rilHardwareConfig = (RIL_HardwareConfig *) response; |
| 7027 | for (int i = 0; i < num; i++) { |
| 7028 | records[i].type = (HardwareConfigType) rilHardwareConfig[i].type; |
| 7029 | records[i].uuid = convertCharPtrToHidlString(rilHardwareConfig[i].uuid); |
| 7030 | records[i].state = (HardwareConfigState) rilHardwareConfig[i].state; |
| 7031 | switch (rilHardwareConfig[i].type) { |
| 7032 | case RIL_HARDWARE_CONFIG_MODEM: { |
| 7033 | records[i].modem.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 7034 | records[i].sim.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7035 | HardwareConfigModem *hwConfigModem = &records[i].modem[0]; |
| 7036 | hwConfigModem->rat = rilHardwareConfig[i].cfg.modem.rat; |
| 7037 | hwConfigModem->maxVoice = rilHardwareConfig[i].cfg.modem.maxVoice; |
| 7038 | hwConfigModem->maxData = rilHardwareConfig[i].cfg.modem.maxData; |
| 7039 | hwConfigModem->maxStandby = rilHardwareConfig[i].cfg.modem.maxStandby; |
| 7040 | break; |
| 7041 | } |
| 7042 | |
| 7043 | case RIL_HARDWARE_CONFIG_SIM: { |
| 7044 | records[i].sim.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 7045 | records[i].modem.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7046 | records[i].sim[0].modemUuid = |
| 7047 | convertCharPtrToHidlString(rilHardwareConfig[i].cfg.sim.modemUuid); |
| 7048 | break; |
| 7049 | } |
| 7050 | } |
| 7051 | } |
| 7052 | } |
| 7053 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7054 | int radio::hardwareConfigChangedInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7055 | int indicationType, int token, RIL_Errno e, void *response, |
| 7056 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7057 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7058 | if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7059 | RLOGE("hardwareConfigChangedInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7060 | return 0; |
| 7061 | } |
| 7062 | |
| 7063 | hidl_vec<HardwareConfig> configs; |
| 7064 | convertRilHardwareConfigListToHal(response, responseLen, configs); |
| 7065 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7066 | RLOGD("hardwareConfigChangedInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7067 | Return<void> retStatus = radioService[slotId]->mRadioIndication->hardwareConfigChanged( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7068 | convertIntToRadioIndicationType(indicationType), configs); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7069 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7070 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7071 | RLOGE("hardwareConfigChangedInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7072 | slotId); |
| 7073 | } |
| 7074 | |
| 7075 | return 0; |
| 7076 | } |
| 7077 | |
| 7078 | void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc) { |
| 7079 | RIL_RadioCapability *rilRadioCapability = (RIL_RadioCapability *) response; |
| 7080 | rc.session = rilRadioCapability->session; |
| 7081 | rc.phase = (android::hardware::radio::V1_0::RadioCapabilityPhase) rilRadioCapability->phase; |
| 7082 | rc.raf = rilRadioCapability->rat; |
| 7083 | rc.logicalModemUuid = convertCharPtrToHidlString(rilRadioCapability->logicalModemUuid); |
| 7084 | rc.status = (android::hardware::radio::V1_0::RadioCapabilityStatus) rilRadioCapability->status; |
| 7085 | } |
| 7086 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7087 | int radio::radioCapabilityIndicationInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7088 | int indicationType, int token, RIL_Errno e, void *response, |
| 7089 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7090 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7091 | if (response == NULL || responseLen != sizeof(RIL_RadioCapability)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7092 | RLOGE("radioCapabilityIndicationInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7093 | return 0; |
| 7094 | } |
| 7095 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 7096 | RadioCapability rc = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7097 | convertRilRadioCapabilityToHal(response, responseLen, rc); |
| 7098 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7099 | RLOGD("radioCapabilityIndicationInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7100 | Return<void> retStatus = radioService[slotId]->mRadioIndication->radioCapabilityIndication( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7101 | convertIntToRadioIndicationType(indicationType), rc); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7102 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7103 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7104 | RLOGE("radioCapabilityIndicationInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7105 | slotId); |
| 7106 | } |
| 7107 | |
| 7108 | return 0; |
| 7109 | } |
| 7110 | |
| 7111 | bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType) { |
| 7112 | if ((reqType == SS_INTERROGATION) && |
| 7113 | (serType == SS_CFU || |
| 7114 | serType == SS_CF_BUSY || |
| 7115 | serType == SS_CF_NO_REPLY || |
| 7116 | serType == SS_CF_NOT_REACHABLE || |
| 7117 | serType == SS_CF_ALL || |
| 7118 | serType == SS_CF_ALL_CONDITIONAL)) { |
| 7119 | return true; |
| 7120 | } |
| 7121 | return false; |
| 7122 | } |
| 7123 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7124 | int radio::onSupplementaryServiceIndicationInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7125 | int indicationType, int token, RIL_Errno e, |
| 7126 | void *response, size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7127 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7128 | if (response == NULL || responseLen != sizeof(RIL_StkCcUnsolSsResponse)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7129 | RLOGE("onSupplementaryServiceIndicationInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7130 | return 0; |
| 7131 | } |
| 7132 | |
| 7133 | RIL_StkCcUnsolSsResponse *rilSsResponse = (RIL_StkCcUnsolSsResponse *) response; |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 7134 | StkCcUnsolSsResult ss = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7135 | ss.serviceType = (SsServiceType) rilSsResponse->serviceType; |
| 7136 | ss.requestType = (SsRequestType) rilSsResponse->requestType; |
| 7137 | ss.teleserviceType = (SsTeleserviceType) rilSsResponse->teleserviceType; |
| 7138 | ss.serviceClass = rilSsResponse->serviceClass; |
| 7139 | ss.result = (RadioError) rilSsResponse->result; |
| 7140 | |
| 7141 | if (isServiceTypeCfQuery(rilSsResponse->serviceType, rilSsResponse->requestType)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7142 | RLOGD("onSupplementaryServiceIndicationInd CF type, num of Cf elements %d", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7143 | rilSsResponse->cfData.numValidIndexes); |
| 7144 | if (rilSsResponse->cfData.numValidIndexes > NUM_SERVICE_CLASSES) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7145 | RLOGE("onSupplementaryServiceIndicationInd numValidIndexes is greater than " |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7146 | "max value %d, truncating it to max value", NUM_SERVICE_CLASSES); |
| 7147 | rilSsResponse->cfData.numValidIndexes = NUM_SERVICE_CLASSES; |
| 7148 | } |
| 7149 | |
| 7150 | ss.cfData.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 7151 | ss.ssInfo.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7152 | |
| 7153 | /* number of call info's */ |
| 7154 | ss.cfData[0].cfInfo.resize(rilSsResponse->cfData.numValidIndexes); |
| 7155 | |
| 7156 | for (int i = 0; i < rilSsResponse->cfData.numValidIndexes; i++) { |
| 7157 | RIL_CallForwardInfo cf = rilSsResponse->cfData.cfInfo[i]; |
| 7158 | CallForwardInfo *cfInfo = &ss.cfData[0].cfInfo[i]; |
| 7159 | |
| 7160 | cfInfo->status = (CallForwardInfoStatus) cf.status; |
| 7161 | cfInfo->reason = cf.reason; |
| 7162 | cfInfo->serviceClass = cf.serviceClass; |
| 7163 | cfInfo->toa = cf.toa; |
| 7164 | cfInfo->number = convertCharPtrToHidlString(cf.number); |
| 7165 | cfInfo->timeSeconds = cf.timeSeconds; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7166 | RLOGD("onSupplementaryServiceIndicationInd: " |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7167 | "Data: %d,reason=%d,cls=%d,toa=%d,num=%s,tout=%d],", cf.status, |
| 7168 | cf.reason, cf.serviceClass, cf.toa, (char*)cf.number, cf.timeSeconds); |
| 7169 | } |
| 7170 | } else { |
| 7171 | ss.ssInfo.resize(1); |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 7172 | ss.cfData.resize(0); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7173 | |
| 7174 | /* each int */ |
| 7175 | ss.ssInfo[0].ssInfo.resize(SS_INFO_MAX); |
| 7176 | for (int i = 0; i < SS_INFO_MAX; i++) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7177 | RLOGD("onSupplementaryServiceIndicationInd: Data: %d", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7178 | rilSsResponse->ssInfo[i]); |
| 7179 | ss.ssInfo[0].ssInfo[i] = rilSsResponse->ssInfo[i]; |
| 7180 | } |
| 7181 | } |
| 7182 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7183 | RLOGD("onSupplementaryServiceIndicationInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7184 | Return<void> retStatus = radioService[slotId]->mRadioIndication-> |
| 7185 | onSupplementaryServiceIndication(convertIntToRadioIndicationType(indicationType), |
| 7186 | ss); |
| 7187 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7188 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7189 | RLOGE("onSupplementaryServiceIndicationInd: " |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7190 | "radioService[%d]->mRadioIndication == NULL", slotId); |
| 7191 | } |
| 7192 | |
| 7193 | return 0; |
| 7194 | } |
| 7195 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7196 | int radio::stkCallControlAlphaNotifyInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7197 | int indicationType, int token, RIL_Errno e, void *response, |
| 7198 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7199 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7200 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7201 | RLOGE("stkCallControlAlphaNotifyInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7202 | return 0; |
| 7203 | } |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7204 | RLOGD("stkCallControlAlphaNotifyInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7205 | Return<void> retStatus = radioService[slotId]->mRadioIndication->stkCallControlAlphaNotify( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7206 | convertIntToRadioIndicationType(indicationType), |
| 7207 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7208 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7209 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7210 | RLOGE("stkCallControlAlphaNotifyInd: radioService[%d]->mRadioIndication == NULL", |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7211 | slotId); |
| 7212 | } |
| 7213 | |
| 7214 | return 0; |
| 7215 | } |
| 7216 | |
| 7217 | void convertRilLceDataInfoToHal(void *response, size_t responseLen, LceDataInfo& lce) { |
| 7218 | RIL_LceDataInfo *rilLceDataInfo = (RIL_LceDataInfo *)response; |
| 7219 | lce.lastHopCapacityKbps = rilLceDataInfo->last_hop_capacity_kbps; |
| 7220 | lce.confidenceLevel = rilLceDataInfo->confidence_level; |
| 7221 | lce.lceSuspended = rilLceDataInfo->lce_suspended; |
| 7222 | } |
| 7223 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7224 | int radio::lceDataInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7225 | int indicationType, int token, RIL_Errno e, void *response, |
| 7226 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7227 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7228 | if (response == NULL || responseLen != sizeof(RIL_LceDataInfo)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7229 | RLOGE("lceDataInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7230 | return 0; |
| 7231 | } |
| 7232 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 7233 | LceDataInfo lce = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7234 | convertRilLceDataInfoToHal(response, responseLen, lce); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7235 | RLOGD("lceDataInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7236 | Return<void> retStatus = radioService[slotId]->mRadioIndication->lceData( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7237 | convertIntToRadioIndicationType(indicationType), lce); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7238 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7239 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7240 | RLOGE("lceDataInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7241 | } |
| 7242 | |
| 7243 | return 0; |
| 7244 | } |
| 7245 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7246 | int radio::pcoDataInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7247 | int indicationType, int token, RIL_Errno e, void *response, |
| 7248 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7249 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7250 | if (response == NULL || responseLen != sizeof(RIL_PCO_Data)) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7251 | RLOGE("pcoDataInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7252 | return 0; |
| 7253 | } |
| 7254 | |
Jack Yu | f68e0da | 2017-02-07 14:53:09 -0800 | [diff] [blame] | 7255 | PcoDataInfo pco = {}; |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7256 | RIL_PCO_Data *rilPcoData = (RIL_PCO_Data *)response; |
| 7257 | pco.cid = rilPcoData->cid; |
| 7258 | pco.bearerProto = convertCharPtrToHidlString(rilPcoData->bearer_proto); |
| 7259 | pco.pcoId = rilPcoData->pco_id; |
| 7260 | pco.contents.setToExternal((uint8_t *) rilPcoData->contents, rilPcoData->contents_length); |
| 7261 | |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7262 | RLOGD("pcoDataInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7263 | Return<void> retStatus = radioService[slotId]->mRadioIndication->pcoData( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7264 | convertIntToRadioIndicationType(indicationType), pco); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7265 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7266 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7267 | RLOGE("pcoDataInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7268 | } |
| 7269 | |
| 7270 | return 0; |
| 7271 | } |
| 7272 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7273 | int radio::modemResetInd(int slotId, |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7274 | int indicationType, int token, RIL_Errno e, void *response, |
| 7275 | size_t responseLen) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7276 | if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7277 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7278 | RLOGE("modemResetInd: invalid response"); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7279 | return 0; |
| 7280 | } |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7281 | RLOGD("modemResetInd"); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7282 | Return<void> retStatus = radioService[slotId]->mRadioIndication->modemReset( |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7283 | convertIntToRadioIndicationType(indicationType), |
| 7284 | convertCharPtrToHidlString((char *) response)); |
Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 7285 | radioService[slotId]->checkReturnStatus(retStatus); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7286 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7287 | RLOGE("modemResetInd: radioService[%d]->mRadioIndication == NULL", slotId); |
Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 7288 | } |
| 7289 | |
| 7290 | return 0; |
| 7291 | } |
| 7292 | |
Amit Mahajan | 759786a | 2017-03-03 17:35:47 -0800 | [diff] [blame] | 7293 | int radio::oemHookRawInd(int slotId, |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7294 | int indicationType, int token, RIL_Errno e, void *response, |
| 7295 | size_t responseLen) { |
| 7296 | if (oemHookService[slotId] != NULL && oemHookService[slotId]->mOemHookIndication != NULL) { |
| 7297 | if (response == NULL || responseLen == 0) { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7298 | RLOGE("oemHookRawInd: invalid response"); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7299 | return 0; |
| 7300 | } |
| 7301 | |
| 7302 | hidl_vec<uint8_t> data; |
| 7303 | data.setToExternal((uint8_t *) response, responseLen); |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7304 | RLOGD("oemHookRawInd"); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7305 | Return<void> retStatus = oemHookService[slotId]->mOemHookIndication->oemHookRaw( |
| 7306 | convertIntToRadioIndicationType(indicationType), data); |
Amit Mahajan | d423d19 | 2017-03-16 17:04:01 -0700 | [diff] [blame] | 7307 | checkReturnStatus(slotId, retStatus, false); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7308 | } else { |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7309 | RLOGE("oemHookRawInd: oemHookService[%d]->mOemHookIndication == NULL", slotId); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7310 | } |
| 7311 | |
| 7312 | return 0; |
| 7313 | } |
| 7314 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7315 | void radio::registerService(RIL_RadioFunctions *callbacks, CommandInfo *commands) { |
| 7316 | using namespace android::hardware; |
| 7317 | int simCount = 1; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7318 | const char *serviceNames[] = { |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7319 | android::RIL_getRilSocketName() |
| 7320 | #if (SIM_COUNT >= 2) |
| 7321 | , SOCKET2_NAME_RIL |
| 7322 | #if (SIM_COUNT >= 3) |
| 7323 | , SOCKET3_NAME_RIL |
| 7324 | #if (SIM_COUNT >= 4) |
| 7325 | , SOCKET4_NAME_RIL |
| 7326 | #endif |
| 7327 | #endif |
| 7328 | #endif |
| 7329 | }; |
| 7330 | |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7331 | const char *oemHookServiceNames[] = { |
| 7332 | OEM_HOOK_SERVICE_NAME |
| 7333 | #if (SIM_COUNT >= 2) |
| 7334 | , OEM_HOOK2_SERVICE_NAME |
| 7335 | #if (SIM_COUNT >= 3) |
| 7336 | , OEM_HOOK3_SERVICE_NAME |
| 7337 | #if (SIM_COUNT >= 4) |
| 7338 | , OEM_HOOK4_SERVICE_NAME |
| 7339 | #endif |
| 7340 | #endif |
| 7341 | #endif |
| 7342 | }; |
| 7343 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7344 | #if (SIM_COUNT >= 2) |
| 7345 | simCount = SIM_COUNT; |
| 7346 | #endif |
| 7347 | |
| 7348 | configureRpcThreadpool(1, true /* callerWillJoin */); |
| 7349 | for (int i = 0; i < simCount; i++) { |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7350 | pthread_rwlock_t *radioServiceRwlockPtr = getRadioServiceRwlock(i); |
| 7351 | int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); |
| 7352 | assert(ret == 0); |
| 7353 | |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7354 | radioService[i] = new RadioImpl; |
Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 7355 | radioService[i]->mSlotId = i; |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7356 | oemHookService[i] = new OemHookImpl; |
| 7357 | oemHookService[i]->mSlotId = i; |
Amit Mahajan | 111ddca | 2017-03-03 12:05:13 -0800 | [diff] [blame] | 7358 | RLOGD("registerService: starting IRadio %s", serviceNames[i]); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7359 | android::status_t status = radioService[i]->registerAsService(serviceNames[i]); |
Amit Mahajan | 439da36 | 2017-02-13 17:43:04 -0800 | [diff] [blame] | 7360 | status = oemHookService[i]->registerAsService(oemHookServiceNames[i]); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7361 | |
| 7362 | ret = pthread_rwlock_unlock(radioServiceRwlockPtr); |
| 7363 | assert(ret == 0); |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7364 | } |
| 7365 | |
Sanket Padawe | 378ccdd | 2017-01-24 14:11:12 -0800 | [diff] [blame] | 7366 | s_vendorFunctions = callbacks; |
Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 7367 | s_commands = commands; |
| 7368 | } |
| 7369 | |
| 7370 | void rilc_thread_pool() { |
| 7371 | joinRpcThreadpool(); |
Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 7372 | } |
| 7373 | |
| 7374 | pthread_rwlock_t * radio::getRadioServiceRwlock(int slotId) { |
| 7375 | pthread_rwlock_t *radioServiceRwlockPtr = &radioServiceRwlock; |
| 7376 | |
| 7377 | #if (SIM_COUNT >= 2) |
| 7378 | if (slotId == 2) radioServiceRwlockPtr = &radioServiceRwlock2; |
| 7379 | #if (SIM_COUNT >= 3) |
| 7380 | if (slotId == 3) radioServiceRwlockPtr = &radioServiceRwlock3; |
| 7381 | #if (SIM_COUNT >= 4) |
| 7382 | if (slotId == 4) radioServiceRwlockPtr = &radioServiceRwlock4; |
| 7383 | #endif |
| 7384 | #endif |
| 7385 | #endif |
| 7386 | |
| 7387 | return radioServiceRwlockPtr; |
Sanket Padawe | 0de29d1 | 2017-02-10 13:19:47 -0800 | [diff] [blame] | 7388 | } |