| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (c) 2016 The Android Open Source Project | 
 | 3 |  * | 
 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |  * you may not use this file except in compliance with the License. | 
 | 6 |  * You may obtain a copy of the License at | 
 | 7 |  * | 
 | 8 |  *      http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  * | 
 | 10 |  * Unless required by applicable law or agreed to in writing, software | 
 | 11 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |  * See the License for the specific language governing permissions and | 
 | 14 |  * limitations under the License. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #include <android/hardware/radio/1.0/IRadio.h> | 
 | 18 |  | 
 | 19 | #include <hwbinder/IPCThreadState.h> | 
 | 20 | #include <hwbinder/ProcessState.h> | 
 | 21 | #include <ril_service.h> | 
 | 22 | #include <hidl/HidlTransportSupport.h> | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 23 | #include <utils/SystemClock.h> | 
| Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame^] | 24 | #include <inttypes.h> | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 25 |  | 
 | 26 | #define INVALID_HEX_CHAR 16 | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 27 |  | 
 | 28 | using namespace android::hardware::radio::V1_0; | 
 | 29 | using ::android::hardware::configureRpcThreadpool; | 
 | 30 | using ::android::hardware::joinRpcThreadpool; | 
 | 31 | using ::android::hardware::Return; | 
 | 32 | using ::android::hardware::Status; | 
 | 33 | using ::android::hardware::hidl_string; | 
 | 34 | using ::android::hardware::hidl_vec; | 
 | 35 | using ::android::hardware::hidl_array; | 
 | 36 | using ::android::hardware::Void; | 
 | 37 | using android::CommandInfo; | 
 | 38 | using android::RequestInfo; | 
 | 39 | using android::requestToString; | 
 | 40 | using android::sp; | 
 | 41 |  | 
 | 42 | RIL_RadioFunctions *s_callbacks = NULL; | 
 | 43 | static CommandInfo *s_commands; | 
 | 44 |  | 
 | 45 | struct RadioImpl; | 
 | 46 |  | 
 | 47 | #if (SIM_COUNT >= 2) | 
 | 48 | sp<RadioImpl> radioService[SIM_COUNT]; | 
 | 49 | #else | 
 | 50 | sp<RadioImpl> radioService[1]; | 
 | 51 | #endif | 
 | 52 |  | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 53 | static pthread_rwlock_t radioServiceRwlock = PTHREAD_RWLOCK_INITIALIZER; | 
 | 54 |  | 
 | 55 | #if (SIM_COUNT >= 2) | 
 | 56 | static pthread_rwlock_t radioServiceRwlock2 = PTHREAD_RWLOCK_INITIALIZER; | 
 | 57 | #if (SIM_COUNT >= 3) | 
 | 58 | static pthread_rwlock_t radioServiceRwlock3 = PTHREAD_RWLOCK_INITIALIZER; | 
 | 59 | #if (SIM_COUNT >= 4) | 
 | 60 | static pthread_rwlock_t radioServiceRwlock4 = PTHREAD_RWLOCK_INITIALIZER; | 
 | 61 | #endif | 
 | 62 | #endif | 
 | 63 | #endif | 
 | 64 |  | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 65 | struct RadioImpl : public IRadio { | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 66 |     int32_t mSlotId; | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 67 |     // counter used for synchronization. It is incremented every time mRadioResponse or | 
 | 68 |     // mRadioIndication value is updated. | 
 | 69 |     volatile int32_t mCounter; | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 70 |     sp<IRadioResponse> mRadioResponse; | 
 | 71 |     sp<IRadioIndication> mRadioIndication; | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 72 |  | 
 | 73 |     Return<void> setResponseFunctions( | 
 | 74 |             const ::android::sp<IRadioResponse>& radioResponse, | 
 | 75 |             const ::android::sp<IRadioIndication>& radioIndication); | 
 | 76 |  | 
 | 77 |     Return<void> getIccCardStatus(int32_t serial); | 
 | 78 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 79 |     Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin, | 
 | 80 |             const hidl_string& aid); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 81 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 82 |     Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, | 
 | 83 |             const hidl_string& pin, const hidl_string& aid); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 84 |  | 
 | 85 |     Return<void> supplyIccPin2ForApp(int32_t serial, | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 86 |             const hidl_string& pin2, | 
 | 87 |             const hidl_string& aid); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 88 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 89 |     Return<void> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, | 
 | 90 |             const hidl_string& pin2, const hidl_string& aid); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 91 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 92 |     Return<void> changeIccPinForApp(int32_t serial, const hidl_string& oldPin, | 
 | 93 |             const hidl_string& newPin, const hidl_string& aid); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 94 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 95 |     Return<void> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, | 
 | 96 |             const hidl_string& newPin2, const hidl_string& aid); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 97 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 98 |     Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 99 |  | 
 | 100 |     Return<void> getCurrentCalls(int32_t serial); | 
 | 101 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 102 |     Return<void> dial(int32_t serial, const Dial& dialInfo); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 103 |  | 
 | 104 |     Return<void> getImsiForApp(int32_t serial, | 
 | 105 |             const ::android::hardware::hidl_string& aid); | 
 | 106 |  | 
 | 107 |     Return<void> hangup(int32_t serial, int32_t gsmIndex); | 
 | 108 |  | 
 | 109 |     Return<void> hangupWaitingOrBackground(int32_t serial); | 
 | 110 |  | 
 | 111 |     Return<void> hangupForegroundResumeBackground(int32_t serial); | 
 | 112 |  | 
 | 113 |     Return<void> switchWaitingOrHoldingAndActive(int32_t serial); | 
 | 114 |  | 
 | 115 |     Return<void> conference(int32_t serial); | 
 | 116 |  | 
 | 117 |     Return<void> rejectCall(int32_t serial); | 
 | 118 |  | 
 | 119 |     Return<void> getLastCallFailCause(int32_t serial); | 
 | 120 |  | 
 | 121 |     Return<void> getSignalStrength(int32_t serial); | 
 | 122 |  | 
 | 123 |     Return<void> getVoiceRegistrationState(int32_t serial); | 
 | 124 |  | 
 | 125 |     Return<void> getDataRegistrationState(int32_t serial); | 
 | 126 |  | 
 | 127 |     Return<void> getOperator(int32_t serial); | 
 | 128 |  | 
 | 129 |     Return<void> setRadioPower(int32_t serial, bool on); | 
 | 130 |  | 
 | 131 |     Return<void> sendDtmf(int32_t serial, | 
 | 132 |             const ::android::hardware::hidl_string& s); | 
 | 133 |  | 
 | 134 |     Return<void> sendSms(int32_t serial, const GsmSmsMessage& message); | 
 | 135 |  | 
 | 136 |     Return<void> sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message); | 
 | 137 |  | 
 | 138 |     Return<void> setupDataCall(int32_t serial, | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 139 |             RadioTechnology radioTechnology, | 
 | 140 |             const DataProfileInfo& profileInfo, | 
 | 141 |             bool modemCognitive, | 
 | 142 |             bool roamingAllowed); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 143 |  | 
 | 144 |     Return<void> iccIOForApp(int32_t serial, | 
 | 145 |             const IccIo& iccIo); | 
 | 146 |  | 
 | 147 |     Return<void> sendUssd(int32_t serial, | 
 | 148 |             const ::android::hardware::hidl_string& ussd); | 
 | 149 |  | 
 | 150 |     Return<void> cancelPendingUssd(int32_t serial); | 
 | 151 |  | 
 | 152 |     Return<void> getClir(int32_t serial); | 
 | 153 |  | 
 | 154 |     Return<void> setClir(int32_t serial, int32_t status); | 
 | 155 |  | 
 | 156 |     Return<void> getCallForwardStatus(int32_t serial, | 
 | 157 |             const CallForwardInfo& callInfo); | 
 | 158 |  | 
 | 159 |     Return<void> setCallForward(int32_t serial, | 
 | 160 |             const CallForwardInfo& callInfo); | 
 | 161 |  | 
 | 162 |     Return<void> getCallWaiting(int32_t serial, int32_t serviceClass); | 
 | 163 |  | 
 | 164 |     Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass); | 
 | 165 |  | 
 | 166 |     Return<void> acknowledgeLastIncomingGsmSms(int32_t serial, | 
 | 167 |             bool success, SmsAcknowledgeFailCause cause); | 
 | 168 |  | 
 | 169 |     Return<void> acceptCall(int32_t serial); | 
 | 170 |  | 
 | 171 |     Return<void> deactivateDataCall(int32_t serial, | 
 | 172 |             int32_t cid, bool reasonRadioShutDown); | 
 | 173 |  | 
 | 174 |     Return<void> getFacilityLockForApp(int32_t serial, | 
 | 175 |             const ::android::hardware::hidl_string& facility, | 
 | 176 |             const ::android::hardware::hidl_string& password, | 
 | 177 |             int32_t serviceClass, | 
 | 178 |             const ::android::hardware::hidl_string& appId); | 
 | 179 |  | 
 | 180 |     Return<void> setFacilityLockForApp(int32_t serial, | 
 | 181 |             const ::android::hardware::hidl_string& facility, | 
 | 182 |             bool lockState, | 
 | 183 |             const ::android::hardware::hidl_string& password, | 
 | 184 |             int32_t serviceClass, | 
 | 185 |             const ::android::hardware::hidl_string& appId); | 
 | 186 |  | 
 | 187 |     Return<void> setBarringPassword(int32_t serial, | 
 | 188 |             const ::android::hardware::hidl_string& facility, | 
 | 189 |             const ::android::hardware::hidl_string& oldPassword, | 
 | 190 |             const ::android::hardware::hidl_string& newPassword); | 
 | 191 |  | 
 | 192 |     Return<void> getNetworkSelectionMode(int32_t serial); | 
 | 193 |  | 
 | 194 |     Return<void> setNetworkSelectionModeAutomatic(int32_t serial); | 
 | 195 |  | 
 | 196 |     Return<void> setNetworkSelectionModeManual(int32_t serial, | 
 | 197 |             const ::android::hardware::hidl_string& operatorNumeric); | 
 | 198 |  | 
 | 199 |     Return<void> getAvailableNetworks(int32_t serial); | 
 | 200 |  | 
 | 201 |     Return<void> startDtmf(int32_t serial, | 
 | 202 |             const ::android::hardware::hidl_string& s); | 
 | 203 |  | 
 | 204 |     Return<void> stopDtmf(int32_t serial); | 
 | 205 |  | 
 | 206 |     Return<void> getBasebandVersion(int32_t serial); | 
 | 207 |  | 
 | 208 |     Return<void> separateConnection(int32_t serial, int32_t gsmIndex); | 
 | 209 |  | 
 | 210 |     Return<void> setMute(int32_t serial, bool enable); | 
 | 211 |  | 
 | 212 |     Return<void> getMute(int32_t serial); | 
 | 213 |  | 
 | 214 |     Return<void> getClip(int32_t serial); | 
 | 215 |  | 
 | 216 |     Return<void> getDataCallList(int32_t serial); | 
 | 217 |  | 
 | 218 |     Return<void> sendOemRadioRequestRaw(int32_t serial, | 
 | 219 |             const ::android::hardware::hidl_vec<uint8_t>& data); | 
 | 220 |  | 
 | 221 |     Return<void> sendOemRadioRequestStrings(int32_t serial, | 
 | 222 |             const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data); | 
 | 223 |  | 
 | 224 |     Return<void> sendScreenState(int32_t serial, bool enable); | 
 | 225 |  | 
 | 226 |     Return<void> setSuppServiceNotifications(int32_t serial, bool enable); | 
 | 227 |  | 
 | 228 |     Return<void> writeSmsToSim(int32_t serial, | 
 | 229 |             const SmsWriteArgs& smsWriteArgs); | 
 | 230 |  | 
 | 231 |     Return<void> deleteSmsOnSim(int32_t serial, int32_t index); | 
 | 232 |  | 
 | 233 |     Return<void> setBandMode(int32_t serial, RadioBandMode mode); | 
 | 234 |  | 
 | 235 |     Return<void> getAvailableBandModes(int32_t serial); | 
 | 236 |  | 
 | 237 |     Return<void> sendEnvelope(int32_t serial, | 
 | 238 |             const ::android::hardware::hidl_string& command); | 
 | 239 |  | 
 | 240 |     Return<void> sendTerminalResponseToSim(int32_t serial, | 
 | 241 |             const ::android::hardware::hidl_string& commandResponse); | 
 | 242 |  | 
 | 243 |     Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept); | 
 | 244 |  | 
 | 245 |     Return<void> explicitCallTransfer(int32_t serial); | 
 | 246 |  | 
 | 247 |     Return<void> setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType); | 
 | 248 |  | 
 | 249 |     Return<void> getPreferredNetworkType(int32_t serial); | 
 | 250 |  | 
 | 251 |     Return<void> getNeighboringCids(int32_t serial); | 
 | 252 |  | 
 | 253 |     Return<void> setLocationUpdates(int32_t serial, bool enable); | 
 | 254 |  | 
 | 255 |     Return<void> setCdmaSubscriptionSource(int32_t serial, | 
 | 256 |             CdmaSubscriptionSource cdmaSub); | 
 | 257 |  | 
 | 258 |     Return<void> setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type); | 
 | 259 |  | 
 | 260 |     Return<void> getCdmaRoamingPreference(int32_t serial); | 
 | 261 |  | 
 | 262 |     Return<void> setTTYMode(int32_t serial, TtyMode mode); | 
 | 263 |  | 
 | 264 |     Return<void> getTTYMode(int32_t serial); | 
 | 265 |  | 
 | 266 |     Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable); | 
 | 267 |  | 
 | 268 |     Return<void> getPreferredVoicePrivacy(int32_t serial); | 
 | 269 |  | 
 | 270 |     Return<void> sendCDMAFeatureCode(int32_t serial, | 
 | 271 |             const ::android::hardware::hidl_string& featureCode); | 
 | 272 |  | 
 | 273 |     Return<void> sendBurstDtmf(int32_t serial, | 
 | 274 |             const ::android::hardware::hidl_string& dtmf, | 
 | 275 |             int32_t on, | 
 | 276 |             int32_t off); | 
 | 277 |  | 
 | 278 |     Return<void> sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms); | 
 | 279 |  | 
 | 280 |     Return<void> acknowledgeLastIncomingCdmaSms(int32_t serial, | 
 | 281 |             const CdmaSmsAck& smsAck); | 
 | 282 |  | 
 | 283 |     Return<void> getGsmBroadcastConfig(int32_t serial); | 
 | 284 |  | 
 | 285 |     Return<void> setGsmBroadcastConfig(int32_t serial, | 
 | 286 |             const hidl_vec<GsmBroadcastSmsConfigInfo>& configInfo); | 
 | 287 |  | 
 | 288 |     Return<void> setGsmBroadcastActivation(int32_t serial, bool activate); | 
 | 289 |  | 
 | 290 |     Return<void> getCdmaBroadcastConfig(int32_t serial); | 
 | 291 |  | 
 | 292 |     Return<void> setCdmaBroadcastConfig(int32_t serial, | 
 | 293 |             const hidl_vec<CdmaBroadcastSmsConfigInfo>& configInfo); | 
 | 294 |  | 
 | 295 |     Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate); | 
 | 296 |  | 
 | 297 |     Return<void> getCDMASubscription(int32_t serial); | 
 | 298 |  | 
 | 299 |     Return<void> writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms); | 
 | 300 |  | 
 | 301 |     Return<void> deleteSmsOnRuim(int32_t serial, int32_t index); | 
 | 302 |  | 
 | 303 |     Return<void> getDeviceIdentity(int32_t serial); | 
 | 304 |  | 
 | 305 |     Return<void> exitEmergencyCallbackMode(int32_t serial); | 
 | 306 |  | 
 | 307 |     Return<void> getSmscAddress(int32_t serial); | 
 | 308 |  | 
 | 309 |     Return<void> setSmscAddress(int32_t serial, | 
 | 310 |             const ::android::hardware::hidl_string& smsc); | 
 | 311 |  | 
 | 312 |     Return<void> reportSmsMemoryStatus(int32_t serial, bool available); | 
 | 313 |  | 
 | 314 |     Return<void> reportStkServiceIsRunning(int32_t serial); | 
 | 315 |  | 
 | 316 |     Return<void> getCdmaSubscriptionSource(int32_t serial); | 
 | 317 |  | 
 | 318 |     Return<void> requestIsimAuthentication(int32_t serial, | 
 | 319 |             const ::android::hardware::hidl_string& challenge); | 
 | 320 |  | 
 | 321 |     Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, | 
 | 322 |             bool success, | 
 | 323 |             const ::android::hardware::hidl_string& ackPdu); | 
 | 324 |  | 
 | 325 |     Return<void> sendEnvelopeWithStatus(int32_t serial, | 
 | 326 |             const ::android::hardware::hidl_string& contents); | 
 | 327 |  | 
 | 328 |     Return<void> getVoiceRadioTechnology(int32_t serial); | 
 | 329 |  | 
 | 330 |     Return<void> getCellInfoList(int32_t serial); | 
 | 331 |  | 
 | 332 |     Return<void> setCellInfoListRate(int32_t serial, int32_t rate); | 
 | 333 |  | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 334 |     Return<void> setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo, | 
 | 335 |             bool modemCognitive); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 336 |  | 
 | 337 |     Return<void> getImsRegistrationState(int32_t serial); | 
 | 338 |  | 
 | 339 |     Return<void> sendImsSms(int32_t serial, const ImsSmsMessage& message); | 
 | 340 |  | 
 | 341 |     Return<void> iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message); | 
 | 342 |  | 
 | 343 |     Return<void> iccOpenLogicalChannel(int32_t serial, | 
 | 344 |             const ::android::hardware::hidl_string& aid); | 
 | 345 |  | 
 | 346 |     Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId); | 
 | 347 |  | 
 | 348 |     Return<void> iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message); | 
 | 349 |  | 
 | 350 |     Return<void> nvReadItem(int32_t serial, NvItem itemId); | 
 | 351 |  | 
 | 352 |     Return<void> nvWriteItem(int32_t serial, const NvWriteItem& item); | 
 | 353 |  | 
 | 354 |     Return<void> nvWriteCdmaPrl(int32_t serial, | 
 | 355 |             const ::android::hardware::hidl_vec<uint8_t>& prl); | 
 | 356 |  | 
 | 357 |     Return<void> nvResetConfig(int32_t serial, ResetNvType resetType); | 
 | 358 |  | 
 | 359 |     Return<void> setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub); | 
 | 360 |  | 
 | 361 |     Return<void> setDataAllowed(int32_t serial, bool allow); | 
 | 362 |  | 
 | 363 |     Return<void> getHardwareConfig(int32_t serial); | 
 | 364 |  | 
 | 365 |     Return<void> requestIccSimAuthentication(int32_t serial, | 
 | 366 |             int32_t authContext, | 
 | 367 |             const ::android::hardware::hidl_string& authData, | 
 | 368 |             const ::android::hardware::hidl_string& aid); | 
 | 369 |  | 
 | 370 |     Return<void> setDataProfile(int32_t serial, | 
 | 371 |             const ::android::hardware::hidl_vec<DataProfileInfo>& profiles); | 
 | 372 |  | 
 | 373 |     Return<void> requestShutdown(int32_t serial); | 
 | 374 |  | 
 | 375 |     Return<void> getRadioCapability(int32_t serial); | 
 | 376 |  | 
 | 377 |     Return<void> setRadioCapability(int32_t serial, const RadioCapability& rc); | 
 | 378 |  | 
 | 379 |     Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode); | 
 | 380 |  | 
 | 381 |     Return<void> stopLceService(int32_t serial); | 
 | 382 |  | 
 | 383 |     Return<void> pullLceData(int32_t serial); | 
 | 384 |  | 
 | 385 |     Return<void> getModemActivityInfo(int32_t serial); | 
 | 386 |  | 
 | 387 |     Return<void> setAllowedCarriers(int32_t serial, | 
 | 388 |             bool allAllowed, | 
 | 389 |             const CarrierRestrictions& carriers); | 
 | 390 |  | 
 | 391 |     Return<void> getAllowedCarriers(int32_t serial); | 
 | 392 |  | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 393 |     Return<void> sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state); | 
 | 394 |  | 
 | 395 |     Return<void> setIndicationFilter(int32_t serial, int32_t indicationFilter); | 
 | 396 |  | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 397 |     Return<void> responseAcknowledgement(); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 398 |  | 
 | 399 |     void checkReturnStatus(Return<void>& ret); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 400 | }; | 
 | 401 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 402 | void dispatchStrings(RequestInfo *pRI, int countStrings, ...) { | 
 | 403 |     char **pStrings; | 
 | 404 |     android::Parcel p;   // TODO: should delete this after translation of all commands is complete | 
 | 405 |     pStrings = (char **)calloc(countStrings, sizeof(char *)); | 
 | 406 |     if (pStrings == NULL) { | 
 | 407 |         RLOGE("Memory allocation failed for request %s", | 
 | 408 |             requestToString(pRI->pCI->requestNumber)); | 
 | 409 |         pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber, | 
 | 410 |                 (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0); | 
 | 411 |         return; | 
 | 412 |     } | 
 | 413 |     va_list ap; | 
 | 414 |     va_start(ap, countStrings); | 
 | 415 |     for (int i = 0; i < countStrings; i++) { | 
 | 416 |         const char* str = va_arg(ap, const char *); | 
 | 417 |         int len = strlen(str); | 
 | 418 |         pStrings[i] = (char *) calloc(len + 1, sizeof(char)); | 
 | 419 |         if (pStrings[i] == NULL) { | 
 | 420 |             RLOGE("Memory allocation failed for request %s", | 
 | 421 |                     requestToString(pRI->pCI->requestNumber)); | 
 | 422 |             va_end(ap); | 
 | 423 |             pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber, | 
 | 424 |                     (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0); | 
 | 425 |             for (int j = 0; j < i; j++) { | 
 | 426 | #ifdef MEMSET_FREED | 
 | 427 |                 memsetString (pStrings[j]); | 
 | 428 | #endif | 
 | 429 |                 free(pStrings[j]); | 
 | 430 |             } | 
 | 431 |             free(pStrings); | 
 | 432 |             return; | 
 | 433 |         } | 
 | 434 |         strncpy(pStrings[i], str, len + 1); | 
 | 435 |     } | 
 | 436 |     va_end(ap); | 
 | 437 |  | 
 | 438 |     s_callbacks->onRequest(pRI->pCI->requestNumber, pStrings, countStrings * sizeof(char *), pRI); | 
 | 439 |  | 
 | 440 |     if (pStrings != NULL) { | 
 | 441 |         for (int i = 0 ; i < countStrings ; i++) { | 
 | 442 | #ifdef MEMSET_FREED | 
 | 443 |             memsetString (pStrings[i]); | 
 | 444 | #endif | 
 | 445 |             free(pStrings[i]); | 
 | 446 |         } | 
 | 447 |  | 
 | 448 | #ifdef MEMSET_FREED | 
 | 449 |         memset(pStrings, 0, countStrings * sizeof(char *)); | 
 | 450 | #endif | 
 | 451 |         free(pStrings); | 
 | 452 |     } | 
 | 453 | } | 
 | 454 |  | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 455 | void RadioImpl::checkReturnStatus(Return<void>& ret) { | 
 | 456 |     if (ret.isOk() == false) { | 
 | 457 |         RLOGE("checkReturnStatus: unable to call response/indication callback"); | 
 | 458 |         // Remote process (RIL.java) hosting the callbacks must be dead. Reset the callback objects; | 
 | 459 |         // there's no other recovery to be done here. When the client process is back up, it will | 
 | 460 |         // call setResponseFunctions() | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 461 |  | 
 | 462 |         // Caller should already hold rdlock, release that first | 
 | 463 |         // note the current counter to avoid overwriting updates made by another thread before | 
 | 464 |         // write lock is acquired. | 
 | 465 |         int counter = mCounter; | 
 | 466 |         pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); | 
 | 467 |         int ret = pthread_rwlock_unlock(radioServiceRwlockPtr); | 
 | 468 |         assert(ret == 0); | 
 | 469 |  | 
 | 470 |         // acquire wrlock | 
 | 471 |         ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); | 
 | 472 |         assert(ret == 0); | 
 | 473 |  | 
 | 474 |         // make sure the counter value has not changed | 
 | 475 |         if (counter == mCounter) { | 
 | 476 |             mRadioResponse = NULL; | 
 | 477 |             mRadioIndication = NULL; | 
 | 478 |             mCounter++; | 
 | 479 |         } else { | 
 | 480 |             RLOGE("checkReturnStatus: not resetting responseFunctions as they likely got updated" | 
 | 481 |                     "on another thread"); | 
 | 482 |         } | 
 | 483 |  | 
 | 484 |         // release wrlock | 
 | 485 |         ret = pthread_rwlock_unlock(radioServiceRwlockPtr); | 
 | 486 |         assert(ret == 0); | 
 | 487 |  | 
 | 488 |         // Reacquire rdlock | 
 | 489 |         ret = pthread_rwlock_rdlock(radioServiceRwlockPtr); | 
 | 490 |         assert(ret == 0); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 491 |     } | 
 | 492 | } | 
 | 493 |  | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 494 | Return<void> RadioImpl::setResponseFunctions( | 
 | 495 |         const ::android::sp<IRadioResponse>& radioResponseParam, | 
 | 496 |         const ::android::sp<IRadioIndication>& radioIndicationParam) { | 
 | 497 |     RLOGD("RadioImpl::setResponseFunctions"); | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 498 |  | 
 | 499 |     pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); | 
 | 500 |     int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); | 
 | 501 |     assert(ret == 0); | 
 | 502 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 503 |     mRadioResponse = radioResponseParam; | 
 | 504 |     mRadioIndication = radioIndicationParam; | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 505 |     mCounter++; | 
 | 506 |  | 
 | 507 |     ret = pthread_rwlock_unlock(radioServiceRwlockPtr); | 
 | 508 |     assert(ret == 0); | 
 | 509 |  | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 510 |     return Status::ok(); | 
 | 511 | } | 
 | 512 |  | 
 | 513 | Return<void> RadioImpl::getIccCardStatus(int32_t serial) { | 
 | 514 |     RLOGD("RadioImpl::getIccCardStatus: serial %d", serial); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 515 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_GET_SIM_STATUS); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 516 |     if (pRI == NULL) { | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 517 |         return Void(); | 
 | 518 |     } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 519 |     s_callbacks->onRequest(RIL_REQUEST_GET_SIM_STATUS, NULL, 0, pRI); | 
 | 520 |  | 
 | 521 |     return Status::ok(); | 
 | 522 | } | 
 | 523 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 524 | Return<void> RadioImpl::supplyIccPinForApp(int32_t serial, const hidl_string& pin, | 
 | 525 |         const hidl_string& aid) { | 
 | 526 |     RLOGD("RadioImpl::supplyIccPinForApp: serial %d", serial); | 
 | 527 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN); | 
 | 528 |     if (pRI == NULL) { | 
 | 529 |         return Void(); | 
 | 530 |     } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 531 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 532 |     dispatchStrings(pRI, 2, (const char *)pin, (const char *)aid); | 
 | 533 |     return Status::ok(); | 
 | 534 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 535 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 536 | Return<void> RadioImpl::supplyIccPukForApp(int32_t serial, const hidl_string& puk, | 
 | 537 |         const hidl_string& pin, const hidl_string& aid) { | 
 | 538 |     RLOGD("RadioImpl::supplyIccPukForApp: serial %d", serial); | 
 | 539 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK); | 
 | 540 |     if (pRI == NULL) { | 
 | 541 |         return Void(); | 
 | 542 |     } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 543 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 544 |     dispatchStrings(pRI, 3, (const char *)puk, (const char *)pin, (const char *)aid); | 
 | 545 |     return Status::ok(); | 
 | 546 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 547 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 548 | Return<void> RadioImpl::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, | 
 | 549 |         const hidl_string& aid) { | 
 | 550 |     RLOGD("RadioImpl::supplyIccPin2ForApp: serial %d", serial); | 
 | 551 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN2); | 
 | 552 |     if (pRI == NULL) { | 
 | 553 |         return Void(); | 
 | 554 |     } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 555 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 556 |     dispatchStrings(pRI, 2, (const char *)pin2, (const char *)aid); | 
 | 557 |     return Status::ok(); | 
 | 558 | } | 
 | 559 |  | 
 | 560 | Return<void> RadioImpl::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, | 
 | 561 |         const hidl_string& pin2, const hidl_string& aid) { | 
 | 562 |     RLOGD("RadioImpl::supplyIccPuk2ForApp: serial %d", serial); | 
 | 563 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK2); | 
 | 564 |     if (pRI == NULL) { | 
 | 565 |         return Void(); | 
 | 566 |     } | 
 | 567 |  | 
 | 568 |     dispatchStrings(pRI, 3, (const char *)puk2, (const char *)pin2, (const char *)aid); | 
 | 569 |     return Status::ok(); | 
 | 570 | } | 
 | 571 |  | 
 | 572 | Return<void> RadioImpl::changeIccPinForApp(int32_t serial, const hidl_string& oldPin, | 
 | 573 |         const hidl_string& newPin, const hidl_string& aid) { | 
 | 574 |     RLOGD("RadioImpl::changeIccPinForApp: serial %d", serial); | 
 | 575 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN); | 
 | 576 |     if (pRI == NULL) { | 
 | 577 |         return Void(); | 
 | 578 |     } | 
 | 579 |  | 
 | 580 |     dispatchStrings(pRI, 3, (const char *)oldPin, (const char *)newPin, | 
 | 581 |             (const char *)aid); | 
 | 582 |     return Status::ok(); | 
 | 583 | } | 
 | 584 |  | 
 | 585 | Return<void> RadioImpl::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, | 
 | 586 |         const hidl_string& newPin2, const hidl_string& aid) { | 
 | 587 |     RLOGD("RadioImpl::changeIccPin2ForApp: serial %d", serial); | 
 | 588 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN2); | 
 | 589 |     if (pRI == NULL) { | 
 | 590 |         return Void(); | 
 | 591 |     } | 
 | 592 |  | 
 | 593 |     dispatchStrings(pRI, 3, (const char *)oldPin2, (const char *)newPin2, | 
 | 594 |             (const char *)aid); | 
 | 595 |     return Status::ok(); | 
 | 596 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 597 |  | 
 | 598 | Return<void> RadioImpl::supplyNetworkDepersonalization(int32_t serial, | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 599 |         const hidl_string& netPin) { | 
 | 600 |     RLOGD("RadioImpl::supplyNetworkDepersonalization: serial %d", serial); | 
 | 601 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, | 
 | 602 |             RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION); | 
 | 603 |     if (pRI == NULL) { | 
 | 604 |         return Void(); | 
 | 605 |     } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 606 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 607 |     dispatchStrings(pRI, 1, (const char *)netPin); | 
 | 608 |     return Status::ok(); | 
 | 609 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 610 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 611 | Return<void> RadioImpl::getCurrentCalls(int32_t serial) { | 
 | 612 |     RLOGD("RadioImpl::getCurrentCalls: serial %d", serial); | 
 | 613 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_GET_CURRENT_CALLS); | 
 | 614 |     if (pRI == NULL) { | 
 | 615 |         return Void(); | 
 | 616 |     } | 
 | 617 |  | 
 | 618 |     s_callbacks->onRequest(RIL_REQUEST_GET_CURRENT_CALLS, NULL, 0, pRI); | 
 | 619 |     return Status::ok(); | 
 | 620 | } | 
 | 621 |  | 
 | 622 | Return<void> RadioImpl::dial(int32_t serial, const Dial& dialInfo) { | 
 | 623 |     RLOGD("RadioImpl::dial: serial %d", serial); | 
 | 624 |     RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_DIAL); | 
 | 625 |     if (pRI == NULL) { | 
 | 626 |         return Void(); | 
 | 627 |     } | 
 | 628 |     RIL_Dial dial; | 
 | 629 |     RIL_UUS_Info uusInfo; | 
 | 630 |     int32_t sizeOfDial = sizeof(dial); | 
 | 631 |  | 
 | 632 |     memset (&dial, 0, sizeOfDial); | 
 | 633 |  | 
 | 634 |     dial.address = (char *) calloc(dialInfo.address.size() + 1, sizeof(char)); | 
 | 635 |     if (dial.address == NULL) { | 
 | 636 |         android::Parcel p; | 
 | 637 |         RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber)); | 
 | 638 |         pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber, | 
 | 639 |                 (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0); | 
 | 640 |         return Void(); | 
 | 641 |     } | 
 | 642 |     strcpy(dial.address, dialInfo.address.c_str()); | 
 | 643 |     dial.clir = (int)dialInfo.clir; | 
 | 644 |  | 
 | 645 |     memset(&uusInfo, 0, sizeof(RIL_UUS_Info)); | 
 | 646 |     if (dialInfo.uusInfo.size() != 0) { | 
 | 647 |         int32_t len; | 
 | 648 |  | 
 | 649 |         uusInfo.uusType = (RIL_UUS_Type) dialInfo.uusInfo[0].uusType; | 
 | 650 |         uusInfo.uusDcs = (RIL_UUS_DCS) dialInfo.uusInfo[0].uusDcs; | 
 | 651 |  | 
 | 652 |         if (dialInfo.uusInfo[0].uusData.size() == 0) { | 
 | 653 |             uusInfo.uusData = NULL; | 
 | 654 |             len = 0; | 
 | 655 |         } else { | 
 | 656 |             len = dialInfo.uusInfo[0].uusData.size(); | 
 | 657 |             uusInfo.uusData = (char*) calloc(len + 1, sizeof(char)); | 
 | 658 |             // check if the length is invalid | 
 | 659 |             if (uusInfo.uusData == NULL) { | 
 | 660 |                 RLOGE("Memory allocation failed for request %s", | 
 | 661 |                         requestToString(pRI->pCI->requestNumber)); | 
 | 662 |                 android::Parcel p; | 
 | 663 |                 pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber, | 
 | 664 |                         (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0); | 
 | 665 |                 free(dial.address); | 
 | 666 |                 return Void(); | 
 | 667 |             } | 
 | 668 |             strcpy(uusInfo.uusData, dialInfo.uusInfo[0].uusData.c_str()); | 
 | 669 |         } | 
 | 670 |  | 
 | 671 |         uusInfo.uusLength = len; | 
 | 672 |         dial.uusInfo = &uusInfo; | 
 | 673 |     } | 
 | 674 |  | 
 | 675 |     s_callbacks->onRequest(RIL_REQUEST_DIAL, &dial, sizeOfDial, pRI); | 
 | 676 |  | 
 | 677 | #ifdef MEMSET_FREED | 
 | 678 |     memsetString (dial.address); | 
 | 679 | #endif | 
 | 680 |     free (dial.address); | 
 | 681 |  | 
 | 682 | #ifdef MEMSET_FREED | 
 | 683 |     memsetString (uusInfo.uusData); | 
 | 684 | #endif | 
 | 685 |     if (uusInfo.uusData != NULL) { | 
 | 686 |         free(uusInfo.uusData); | 
 | 687 |     } | 
 | 688 |  | 
 | 689 |     return Status::ok(); | 
 | 690 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 691 |  | 
 | 692 | Return<void> RadioImpl::getImsiForApp(int32_t serial, | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 693 |         const hidl_string& aid) {return Status::ok();} | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 694 |  | 
 | 695 | Return<void> RadioImpl::hangup(int32_t serial, int32_t gsmIndex) {return Status::ok();} | 
 | 696 |  | 
 | 697 | Return<void> RadioImpl::hangupWaitingOrBackground(int32_t serial) {return Status::ok();} | 
 | 698 |  | 
 | 699 | Return<void> RadioImpl::hangupForegroundResumeBackground(int32_t serial) {return Status::ok();} | 
 | 700 |  | 
 | 701 | Return<void> RadioImpl::switchWaitingOrHoldingAndActive(int32_t serial) {return Status::ok();} | 
 | 702 |  | 
 | 703 | Return<void> RadioImpl::conference(int32_t serial) {return Status::ok();} | 
 | 704 |  | 
 | 705 | Return<void> RadioImpl::rejectCall(int32_t serial) {return Status::ok();} | 
 | 706 |  | 
 | 707 | Return<void> RadioImpl::getLastCallFailCause(int32_t serial) {return Status::ok();} | 
 | 708 |  | 
 | 709 | Return<void> RadioImpl::getSignalStrength(int32_t serial) {return Status::ok();} | 
 | 710 |  | 
 | 711 | Return<void> RadioImpl::getVoiceRegistrationState(int32_t serial) {return Status::ok();} | 
 | 712 |  | 
 | 713 | Return<void> RadioImpl::getDataRegistrationState(int32_t serial) {return Status::ok();} | 
 | 714 |  | 
 | 715 | Return<void> RadioImpl::getOperator(int32_t serial) {return Status::ok();} | 
 | 716 |  | 
 | 717 | Return<void> RadioImpl::setRadioPower(int32_t serial, bool on) {return Status::ok();} | 
 | 718 |  | 
 | 719 | Return<void> RadioImpl::sendDtmf(int32_t serial, | 
 | 720 |         const ::android::hardware::hidl_string& s) {return Status::ok();} | 
 | 721 |  | 
 | 722 | Return<void> RadioImpl::sendSms(int32_t serial, const GsmSmsMessage& message) {return Status::ok();} | 
 | 723 |  | 
 | 724 | Return<void> RadioImpl::sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message) {return Status::ok();} | 
 | 725 |  | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 726 | Return<void> RadioImpl::setupDataCall(int32_t serial, RadioTechnology radioTechnology, | 
 | 727 |         const DataProfileInfo& dataProfileInfo, bool modemCognitive, bool roamingAllowed) { | 
 | 728 |         return Status::ok();} | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 729 |  | 
 | 730 | Return<void> RadioImpl::iccIOForApp(int32_t serial, | 
 | 731 |         const IccIo& iccIo) {return Status::ok();} | 
 | 732 |  | 
 | 733 | Return<void> RadioImpl::sendUssd(int32_t serial, | 
 | 734 |         const ::android::hardware::hidl_string& ussd) {return Status::ok();} | 
 | 735 |  | 
 | 736 | Return<void> RadioImpl::cancelPendingUssd(int32_t serial) {return Status::ok();} | 
 | 737 |  | 
 | 738 | Return<void> RadioImpl::getClir(int32_t serial) {return Status::ok();} | 
 | 739 |  | 
 | 740 | Return<void> RadioImpl::setClir(int32_t serial, int32_t status) {return Status::ok();} | 
 | 741 |  | 
 | 742 | Return<void> RadioImpl::getCallForwardStatus(int32_t serial, | 
 | 743 |         const CallForwardInfo& callInfo) {return Status::ok();} | 
 | 744 |  | 
 | 745 | Return<void> RadioImpl::setCallForward(int32_t serial, | 
 | 746 |         const CallForwardInfo& callInfo) {return Status::ok();} | 
 | 747 |  | 
 | 748 | Return<void> RadioImpl::getCallWaiting(int32_t serial, int32_t serviceClass) {return Status::ok();} | 
 | 749 |  | 
 | 750 | Return<void> RadioImpl::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) {return Status::ok();} | 
 | 751 |  | 
 | 752 | Return<void> RadioImpl::acknowledgeLastIncomingGsmSms(int32_t serial, | 
 | 753 |         bool success, SmsAcknowledgeFailCause cause) {return Status::ok();} | 
 | 754 |  | 
 | 755 | Return<void> RadioImpl::acceptCall(int32_t serial) {return Status::ok();} | 
 | 756 |  | 
 | 757 | Return<void> RadioImpl::deactivateDataCall(int32_t serial, | 
 | 758 |         int32_t cid, bool reasonRadioShutDown) {return Status::ok();} | 
 | 759 |  | 
 | 760 | Return<void> RadioImpl::getFacilityLockForApp(int32_t serial, | 
 | 761 |         const ::android::hardware::hidl_string& facility, | 
 | 762 |         const ::android::hardware::hidl_string& password, | 
 | 763 |         int32_t serviceClass, | 
 | 764 |         const ::android::hardware::hidl_string& appId) {return Status::ok();} | 
 | 765 |  | 
 | 766 | Return<void> RadioImpl::setFacilityLockForApp(int32_t serial, | 
 | 767 |         const ::android::hardware::hidl_string& facility, | 
 | 768 |         bool lockState, | 
 | 769 |         const ::android::hardware::hidl_string& password, | 
 | 770 |         int32_t serviceClass, | 
 | 771 |         const ::android::hardware::hidl_string& appId) {return Status::ok();} | 
 | 772 |  | 
 | 773 | Return<void> RadioImpl::setBarringPassword(int32_t serial, | 
 | 774 |         const ::android::hardware::hidl_string& facility, | 
 | 775 |         const ::android::hardware::hidl_string& oldPassword, | 
 | 776 |         const ::android::hardware::hidl_string& newPassword) {return Status::ok();} | 
 | 777 |  | 
 | 778 | Return<void> RadioImpl::getNetworkSelectionMode(int32_t serial) {return Status::ok();} | 
 | 779 |  | 
 | 780 | Return<void> RadioImpl::setNetworkSelectionModeAutomatic(int32_t serial) {return Status::ok();} | 
 | 781 |  | 
 | 782 | Return<void> RadioImpl::setNetworkSelectionModeManual(int32_t serial, | 
 | 783 |         const ::android::hardware::hidl_string& operatorNumeric) {return Status::ok();} | 
 | 784 |  | 
 | 785 | Return<void> RadioImpl::getAvailableNetworks(int32_t serial) {return Status::ok();} | 
 | 786 |  | 
 | 787 | Return<void> RadioImpl::startDtmf(int32_t serial, | 
 | 788 |         const ::android::hardware::hidl_string& s) {return Status::ok();} | 
 | 789 |  | 
 | 790 | Return<void> RadioImpl::stopDtmf(int32_t serial) {return Status::ok();} | 
 | 791 |  | 
 | 792 | Return<void> RadioImpl::getBasebandVersion(int32_t serial) {return Status::ok();} | 
 | 793 |  | 
 | 794 | Return<void> RadioImpl::separateConnection(int32_t serial, int32_t gsmIndex) {return Status::ok();} | 
 | 795 |  | 
 | 796 | Return<void> RadioImpl::setMute(int32_t serial, bool enable) {return Status::ok();} | 
 | 797 |  | 
 | 798 | Return<void> RadioImpl::getMute(int32_t serial) {return Status::ok();} | 
 | 799 |  | 
 | 800 | Return<void> RadioImpl::getClip(int32_t serial) {return Status::ok();} | 
 | 801 |  | 
 | 802 | Return<void> RadioImpl::getDataCallList(int32_t serial) {return Status::ok();} | 
 | 803 |  | 
 | 804 | Return<void> RadioImpl::sendOemRadioRequestRaw(int32_t serial, | 
 | 805 |         const ::android::hardware::hidl_vec<uint8_t>& data) {return Status::ok();} | 
 | 806 |  | 
 | 807 | Return<void> RadioImpl::sendOemRadioRequestStrings(int32_t serial, | 
 | 808 |         const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data) {return Status::ok();} | 
 | 809 |  | 
 | 810 | Return<void> RadioImpl::sendScreenState(int32_t serial, bool enable) {return Status::ok();} | 
 | 811 |  | 
 | 812 | Return<void> RadioImpl::setSuppServiceNotifications(int32_t serial, bool enable) {return Status::ok();} | 
 | 813 |  | 
 | 814 | Return<void> RadioImpl::writeSmsToSim(int32_t serial, | 
 | 815 |         const SmsWriteArgs& smsWriteArgs) {return Status::ok();} | 
 | 816 |  | 
 | 817 | Return<void> RadioImpl::deleteSmsOnSim(int32_t serial, int32_t index) {return Status::ok();} | 
 | 818 |  | 
 | 819 | Return<void> RadioImpl::setBandMode(int32_t serial, RadioBandMode mode) {return Status::ok();} | 
 | 820 |  | 
 | 821 | Return<void> RadioImpl::getAvailableBandModes(int32_t serial) {return Status::ok();} | 
 | 822 |  | 
 | 823 | Return<void> RadioImpl::sendEnvelope(int32_t serial, | 
 | 824 |         const ::android::hardware::hidl_string& command) {return Status::ok();} | 
 | 825 |  | 
 | 826 | Return<void> RadioImpl::sendTerminalResponseToSim(int32_t serial, | 
 | 827 |         const ::android::hardware::hidl_string& commandResponse) {return Status::ok();} | 
 | 828 |  | 
 | 829 | Return<void> RadioImpl::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) {return Status::ok();} | 
 | 830 |  | 
 | 831 | Return<void> RadioImpl::explicitCallTransfer(int32_t serial) {return Status::ok();} | 
 | 832 |  | 
 | 833 | Return<void> RadioImpl::setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType) {return Status::ok();} | 
 | 834 |  | 
 | 835 | Return<void> RadioImpl::getPreferredNetworkType(int32_t serial) {return Status::ok();} | 
 | 836 |  | 
 | 837 | Return<void> RadioImpl::getNeighboringCids(int32_t serial) {return Status::ok();} | 
 | 838 |  | 
 | 839 | Return<void> RadioImpl::setLocationUpdates(int32_t serial, bool enable) {return Status::ok();} | 
 | 840 |  | 
 | 841 | Return<void> RadioImpl::setCdmaSubscriptionSource(int32_t serial, CdmaSubscriptionSource cdmaSub) {return Status::ok();} | 
 | 842 |  | 
 | 843 | Return<void> RadioImpl::setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type) {return Status::ok();} | 
 | 844 |  | 
 | 845 | Return<void> RadioImpl::getCdmaRoamingPreference(int32_t serial) {return Status::ok();} | 
 | 846 |  | 
 | 847 | Return<void> RadioImpl::setTTYMode(int32_t serial, TtyMode mode) {return Status::ok();} | 
 | 848 |  | 
 | 849 | Return<void> RadioImpl::getTTYMode(int32_t serial) {return Status::ok();} | 
 | 850 |  | 
 | 851 | Return<void> RadioImpl::setPreferredVoicePrivacy(int32_t serial, bool enable) {return Status::ok();} | 
 | 852 |  | 
 | 853 | Return<void> RadioImpl::getPreferredVoicePrivacy(int32_t serial) {return Status::ok();} | 
 | 854 |  | 
 | 855 | Return<void> RadioImpl::sendCDMAFeatureCode(int32_t serial, | 
 | 856 |         const ::android::hardware::hidl_string& featureCode) {return Status::ok();} | 
 | 857 |  | 
 | 858 | Return<void> RadioImpl::sendBurstDtmf(int32_t serial, | 
 | 859 |         const ::android::hardware::hidl_string& dtmf, | 
 | 860 |         int32_t on, | 
 | 861 |         int32_t off) {return Status::ok();} | 
 | 862 |  | 
 | 863 | Return<void> RadioImpl::sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms) {return Status::ok();} | 
 | 864 |  | 
 | 865 | Return<void> RadioImpl::acknowledgeLastIncomingCdmaSms(int32_t serial, const CdmaSmsAck& smsAck) {return Status::ok();} | 
 | 866 |  | 
 | 867 | Return<void> RadioImpl::getGsmBroadcastConfig(int32_t serial) {return Status::ok();} | 
 | 868 |  | 
 | 869 | Return<void> RadioImpl::setGsmBroadcastConfig(int32_t serial, | 
 | 870 |         const hidl_vec<GsmBroadcastSmsConfigInfo>& configInfo) {return Status::ok();} | 
 | 871 |  | 
 | 872 | Return<void> RadioImpl::setGsmBroadcastActivation(int32_t serial, bool activate) {return Status::ok();} | 
 | 873 |  | 
 | 874 | Return<void> RadioImpl::getCdmaBroadcastConfig(int32_t serial) {return Status::ok();} | 
 | 875 |  | 
 | 876 | Return<void> RadioImpl::setCdmaBroadcastConfig(int32_t serial, | 
 | 877 |         const hidl_vec<CdmaBroadcastSmsConfigInfo>& configInfo) {return Status::ok();} | 
 | 878 |  | 
 | 879 | Return<void> RadioImpl::setCdmaBroadcastActivation(int32_t serial, bool activate) {return Status::ok();} | 
 | 880 |  | 
 | 881 | Return<void> RadioImpl::getCDMASubscription(int32_t serial) {return Status::ok();} | 
 | 882 |  | 
 | 883 | Return<void> RadioImpl::writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms) {return Status::ok();} | 
 | 884 |  | 
 | 885 | Return<void> RadioImpl::deleteSmsOnRuim(int32_t serial, int32_t index) {return Status::ok();} | 
 | 886 |  | 
 | 887 | Return<void> RadioImpl::getDeviceIdentity(int32_t serial) {return Status::ok();} | 
 | 888 |  | 
 | 889 | Return<void> RadioImpl::exitEmergencyCallbackMode(int32_t serial) {return Status::ok();} | 
 | 890 |  | 
 | 891 | Return<void> RadioImpl::getSmscAddress(int32_t serial) {return Status::ok();} | 
 | 892 |  | 
 | 893 | Return<void> RadioImpl::setSmscAddress(int32_t serial, | 
 | 894 |         const ::android::hardware::hidl_string& smsc) {return Status::ok();} | 
 | 895 |  | 
 | 896 | Return<void> RadioImpl::reportSmsMemoryStatus(int32_t serial, bool available) {return Status::ok();} | 
 | 897 |  | 
 | 898 | Return<void> RadioImpl::reportStkServiceIsRunning(int32_t serial) {return Status::ok();} | 
 | 899 |  | 
 | 900 | Return<void> RadioImpl::getCdmaSubscriptionSource(int32_t serial) {return Status::ok();} | 
 | 901 |  | 
 | 902 | Return<void> RadioImpl::requestIsimAuthentication(int32_t serial, | 
 | 903 |         const ::android::hardware::hidl_string& challenge) {return Status::ok();} | 
 | 904 |  | 
 | 905 | Return<void> RadioImpl::acknowledgeIncomingGsmSmsWithPdu(int32_t serial, | 
 | 906 |         bool success, | 
 | 907 |         const ::android::hardware::hidl_string& ackPdu) {return Status::ok();} | 
 | 908 |  | 
 | 909 | Return<void> RadioImpl::sendEnvelopeWithStatus(int32_t serial, | 
 | 910 |         const ::android::hardware::hidl_string& contents) {return Status::ok();} | 
 | 911 |  | 
 | 912 | Return<void> RadioImpl::getVoiceRadioTechnology(int32_t serial) {return Status::ok();} | 
 | 913 |  | 
 | 914 | Return<void> RadioImpl::getCellInfoList(int32_t serial) {return Status::ok();} | 
 | 915 |  | 
 | 916 | Return<void> RadioImpl::setCellInfoListRate(int32_t serial, int32_t rate) {return Status::ok();} | 
 | 917 |  | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 918 | Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo, bool modemCognitive) {return Status::ok();} | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 919 |  | 
 | 920 | Return<void> RadioImpl::getImsRegistrationState(int32_t serial) {return Status::ok();} | 
 | 921 |  | 
 | 922 | Return<void> RadioImpl::sendImsSms(int32_t serial, const ImsSmsMessage& message) {return Status::ok();} | 
 | 923 |  | 
 | 924 | Return<void> RadioImpl::iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message) {return Status::ok();} | 
 | 925 |  | 
 | 926 | Return<void> RadioImpl::iccOpenLogicalChannel(int32_t serial, | 
 | 927 |         const ::android::hardware::hidl_string& aid) {return Status::ok();} | 
 | 928 |  | 
 | 929 | Return<void> RadioImpl::iccCloseLogicalChannel(int32_t serial, int32_t channelId) {return Status::ok();} | 
 | 930 |  | 
 | 931 | Return<void> RadioImpl::iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message) {return Status::ok();} | 
 | 932 |  | 
 | 933 | Return<void> RadioImpl::nvReadItem(int32_t serial, NvItem itemId) {return Status::ok();} | 
 | 934 |  | 
 | 935 | Return<void> RadioImpl::nvWriteItem(int32_t serial, const NvWriteItem& item) {return Status::ok();} | 
 | 936 |  | 
 | 937 | Return<void> RadioImpl::nvWriteCdmaPrl(int32_t serial, | 
 | 938 |         const ::android::hardware::hidl_vec<uint8_t>& prl) {return Status::ok();} | 
 | 939 |  | 
 | 940 | Return<void> RadioImpl::nvResetConfig(int32_t serial, ResetNvType resetType) {return Status::ok();} | 
 | 941 |  | 
 | 942 | Return<void> RadioImpl::setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub) {return Status::ok();} | 
 | 943 |  | 
 | 944 | Return<void> RadioImpl::setDataAllowed(int32_t serial, bool allow) {return Status::ok();} | 
 | 945 |  | 
 | 946 | Return<void> RadioImpl::getHardwareConfig(int32_t serial) {return Status::ok();} | 
 | 947 |  | 
 | 948 | Return<void> RadioImpl::requestIccSimAuthentication(int32_t serial, | 
 | 949 |         int32_t authContext, | 
 | 950 |         const ::android::hardware::hidl_string& authData, | 
 | 951 |         const ::android::hardware::hidl_string& aid) {return Status::ok();} | 
 | 952 |  | 
 | 953 | Return<void> RadioImpl::setDataProfile(int32_t serial, | 
 | 954 |         const ::android::hardware::hidl_vec<DataProfileInfo>& profiles) {return Status::ok();} | 
 | 955 |  | 
 | 956 | Return<void> RadioImpl::requestShutdown(int32_t serial) {return Status::ok();} | 
 | 957 |  | 
 | 958 | Return<void> RadioImpl::getRadioCapability(int32_t serial) {return Status::ok();} | 
 | 959 |  | 
 | 960 | Return<void> RadioImpl::setRadioCapability(int32_t serial, const RadioCapability& rc) {return Status::ok();} | 
 | 961 |  | 
 | 962 | Return<void> RadioImpl::startLceService(int32_t serial, int32_t reportInterval, bool pullMode) {return Status::ok();} | 
 | 963 |  | 
 | 964 | Return<void> RadioImpl::stopLceService(int32_t serial) {return Status::ok();} | 
 | 965 |  | 
 | 966 | Return<void> RadioImpl::pullLceData(int32_t serial) {return Status::ok();} | 
 | 967 |  | 
 | 968 | Return<void> RadioImpl::getModemActivityInfo(int32_t serial) {return Status::ok();} | 
 | 969 |  | 
 | 970 | Return<void> RadioImpl::setAllowedCarriers(int32_t serial, | 
 | 971 |         bool allAllowed, | 
 | 972 |         const CarrierRestrictions& carriers) {return Status::ok();} | 
 | 973 |  | 
 | 974 | Return<void> RadioImpl::getAllowedCarriers(int32_t serial) {return Status::ok();} | 
 | 975 |  | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 976 | Return<void> RadioImpl::sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state) {return Status::ok();} | 
 | 977 |  | 
 | 978 | Return<void> RadioImpl::setIndicationFilter(int32_t serial, int32_t indicationFilter) {return Status::ok();} | 
 | 979 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 980 | Return<void> RadioImpl::responseAcknowledgement() { | 
 | 981 |     android::releaseWakeLock(); | 
 | 982 |     return Status::ok(); | 
 | 983 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 984 |  | 
 | 985 | hidl_string convertCharPtrToHidlString(char *ptr) { | 
 | 986 |     hidl_string ret; | 
 | 987 |     if (ptr != NULL) { | 
 | 988 |         ret.setToExternal(ptr, strlen(ptr)); | 
 | 989 |     } | 
 | 990 |     return ret; | 
 | 991 | } | 
 | 992 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 993 | void radio::acknowledgeRequest(int slotId, int serial) { | 
 | 994 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 995 |         Return<void> retStatus = radioService[slotId]->mRadioResponse->acknowledgeRequest(serial); | 
 | 996 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 997 |     } else { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 998 |         RLOGE("radio::acknowledgeRequest: radioService[%d]->mRadioResponse == NULL", slotId); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 999 |     } | 
 | 1000 | } | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1001 |  | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1002 | void populateResponseInfo(RadioResponseInfo& responseInfo, int serial, int responseType, | 
 | 1003 |         RIL_Errno e) { | 
 | 1004 |     responseInfo.serial = serial; | 
 | 1005 |     switch (responseType) { | 
 | 1006 |         case RESPONSE_SOLICITED: | 
 | 1007 |             responseInfo.type = RadioResponseType::SOLICITED; | 
 | 1008 |             break; | 
 | 1009 |         case RESPONSE_SOLICITED_ACK_EXP: | 
 | 1010 |             responseInfo.type = RadioResponseType::SOLICITED_ACK_EXP; | 
 | 1011 |             break; | 
 | 1012 |     } | 
 | 1013 |     responseInfo.error = (RadioError) e; | 
 | 1014 | } | 
 | 1015 |  | 
 | 1016 | int responseInt(RadioResponseInfo& responseInfo, int serial, int responseType, RIL_Errno e, | 
 | 1017 |         void *response, size_t responseLen) { | 
 | 1018 |     populateResponseInfo(responseInfo, serial, responseType, e); | 
 | 1019 |     int ret = -1; | 
 | 1020 |  | 
 | 1021 |     if (response == NULL || responseLen != sizeof(int)) { | 
 | 1022 |         RLOGE("responseInt: Invalid response"); | 
 | 1023 |         if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | 
 | 1024 |     } else { | 
 | 1025 |         int *p_int = (int *) response; | 
 | 1026 |         ret = p_int[0]; | 
 | 1027 |     } | 
 | 1028 |     return ret; | 
 | 1029 | } | 
 | 1030 |  | 
 | 1031 | int radio::getIccCardStatusResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1032 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1033 |     RLOGD("radio::getIccCardStatusResponse: serial %d", serial); | 
 | 1034 |  | 
 | 1035 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1036 |         RadioResponseInfo responseInfo; | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1037 |         populateResponseInfo(responseInfo, serial, responseType, e); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1038 |         CardStatus cardStatus; | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1039 |         if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)) { | 
 | 1040 |             RLOGE("radio::getIccCardStatusResponse: Invalid response"); | 
 | 1041 |             if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | 
 | 1042 |             memset(&cardStatus, 0, sizeof(cardStatus)); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1043 |         } else { | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1044 |             RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response); | 
 | 1045 |             cardStatus.cardState = (CardState) p_cur->card_state; | 
 | 1046 |             cardStatus.universalPinState = (PinState) p_cur->universal_pin_state; | 
 | 1047 |             cardStatus.gsmUmtsSubscriptionAppIndex = p_cur->gsm_umts_subscription_app_index; | 
 | 1048 |             cardStatus.cdmaSubscriptionAppIndex = p_cur->cdma_subscription_app_index; | 
 | 1049 |             cardStatus.imsSubscriptionAppIndex = p_cur->ims_subscription_app_index; | 
 | 1050 |  | 
 | 1051 |             RIL_AppStatus *rilAppStatus = p_cur->applications; | 
 | 1052 |             cardStatus.applications.resize(p_cur->num_applications); | 
 | 1053 |             AppStatus *appStatus = cardStatus.applications.data(); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1054 |             RLOGD("radio::getIccCardStatusResponse: num_applications %d", p_cur->num_applications); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1055 |             for (int i = 0; i < p_cur->num_applications; i++) { | 
 | 1056 |                 appStatus[i].appType = (AppType) rilAppStatus[i].app_type; | 
 | 1057 |                 appStatus[i].appState = (AppState) rilAppStatus[i].app_state; | 
 | 1058 |                 appStatus[i].persoSubstate = (PersoSubstate) rilAppStatus[i].perso_substate; | 
 | 1059 |                 appStatus[i].aidPtr = convertCharPtrToHidlString(rilAppStatus[i].aid_ptr); | 
 | 1060 |                 appStatus[i].appLabelPtr = convertCharPtrToHidlString( | 
 | 1061 |                         rilAppStatus[i].app_label_ptr); | 
 | 1062 |                 appStatus[i].pin1Replaced = rilAppStatus[i].pin1_replaced; | 
 | 1063 |                 appStatus[i].pin1 = (PinState) rilAppStatus[i].pin1; | 
 | 1064 |                 appStatus[i].pin2 = (PinState) rilAppStatus[i].pin2; | 
 | 1065 |             } | 
 | 1066 |         } | 
 | 1067 |  | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1068 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1069 |                 getIccCardStatusResponse(responseInfo, cardStatus); | 
 | 1070 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1071 |     } else { | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1072 |         RLOGE("radio::getIccCardStatusResponse: radioService[%d]->mRadioResponse == NULL", slotId); | 
 | 1073 |     } | 
 | 1074 |  | 
 | 1075 |     return 0; | 
 | 1076 | } | 
 | 1077 |  | 
 | 1078 | int radio::supplyIccPinForAppResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1079 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1080 |     RLOGD("radio::supplyIccPinForAppResponse: serial %d", serial); | 
 | 1081 |  | 
 | 1082 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1083 |         RadioResponseInfo responseInfo; | 
 | 1084 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1085 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1086 |                 supplyIccPinForAppResponse(responseInfo, ret); | 
 | 1087 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1088 |     } else { | 
 | 1089 |         RLOGE("radio::supplyIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL", | 
 | 1090 |                 slotId); | 
 | 1091 |     } | 
 | 1092 |  | 
 | 1093 |     return 0; | 
 | 1094 | } | 
 | 1095 |  | 
 | 1096 | int radio::supplyIccPukForAppResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1097 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1098 |     RLOGD("radio::supplyIccPukForAppResponse: serial %d", serial); | 
 | 1099 |  | 
 | 1100 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1101 |         RadioResponseInfo responseInfo; | 
 | 1102 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1103 |         Return<void> retStatus = radioService[slotId]->mRadioResponse->supplyIccPukForAppResponse(responseInfo, ret); | 
 | 1104 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1105 |     } else { | 
 | 1106 |         RLOGE("radio::supplyIccPukForAppResponse: radioService[%d]->mRadioResponse == NULL", | 
 | 1107 |                 slotId); | 
 | 1108 |     } | 
 | 1109 |  | 
 | 1110 |     return 0; | 
 | 1111 | } | 
 | 1112 |  | 
 | 1113 | int radio::supplyIccPin2ForAppResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1114 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1115 |     RLOGD("radio::supplyIccPin2ForAppResponse: serial %d", serial); | 
 | 1116 |  | 
 | 1117 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1118 |         RadioResponseInfo responseInfo; | 
 | 1119 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1120 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1121 |                 supplyIccPin2ForAppResponse(responseInfo, ret); | 
 | 1122 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1123 |     } else { | 
 | 1124 |         RLOGE("radio::supplyIccPin2ForAppResponse: radioService[%d]->mRadioResponse == NULL", | 
 | 1125 |                 slotId); | 
 | 1126 |     } | 
 | 1127 |  | 
 | 1128 |     return 0; | 
 | 1129 | } | 
 | 1130 |  | 
 | 1131 | int radio::supplyIccPuk2ForAppResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1132 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1133 |     RLOGD("radio::supplyIccPuk2ForAppResponse: serial %d", serial); | 
 | 1134 |  | 
 | 1135 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1136 |         RadioResponseInfo responseInfo; | 
 | 1137 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1138 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1139 |                 supplyIccPuk2ForAppResponse(responseInfo, ret); | 
 | 1140 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1141 |     } else { | 
 | 1142 |         RLOGE("radio::supplyIccPuk2ForAppResponse: radioService[%d]->mRadioResponse == NULL", | 
 | 1143 |                 slotId); | 
 | 1144 |     } | 
 | 1145 |  | 
 | 1146 |     return 0; | 
 | 1147 | } | 
 | 1148 |  | 
 | 1149 | int radio::changeIccPinForAppResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1150 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1151 |     RLOGD("radio::changeIccPinForAppResponse: serial %d", serial); | 
 | 1152 |  | 
 | 1153 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1154 |         RadioResponseInfo responseInfo; | 
 | 1155 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1156 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1157 |                 changeIccPinForAppResponse(responseInfo, ret); | 
 | 1158 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1159 |     } else { | 
 | 1160 |         RLOGE("radio::changeIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL", | 
 | 1161 |                 slotId); | 
 | 1162 |     } | 
 | 1163 |  | 
 | 1164 |     return 0; | 
 | 1165 | } | 
 | 1166 |  | 
 | 1167 | int radio::changeIccPin2ForAppResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1168 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1169 |     RLOGD("radio::changeIccPin2ForAppResponse: serial %d", serial); | 
 | 1170 |  | 
 | 1171 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1172 |         RadioResponseInfo responseInfo; | 
 | 1173 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1174 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1175 |                 changeIccPin2ForAppResponse(responseInfo, ret); | 
 | 1176 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1177 |     } else { | 
 | 1178 |         RLOGE("radio::changeIccPin2ForAppResponse: radioService[%d]->mRadioResponse == NULL", | 
 | 1179 |                 slotId); | 
 | 1180 |     } | 
 | 1181 |  | 
 | 1182 |     return 0; | 
 | 1183 | } | 
 | 1184 |  | 
 | 1185 | int radio::supplyNetworkDepersonalizationResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1186 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1187 |     RLOGD("radio::supplyNetworkDepersonalizationResponse: serial %d", serial); | 
 | 1188 |  | 
 | 1189 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1190 |         RadioResponseInfo responseInfo; | 
 | 1191 |         int ret = responseInt(responseInfo, serial, responseType, e, response, responseLen); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1192 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1193 |                 supplyNetworkDepersonalizationResponse(responseInfo, ret); | 
 | 1194 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1195 |     } else { | 
 | 1196 |         RLOGE("radio::supplyNetworkDepersonalizationResponse: radioService[%d]->mRadioResponse == \ | 
 | 1197 |                 NULL", slotId); | 
 | 1198 |     } | 
 | 1199 |  | 
 | 1200 |     return 0; | 
 | 1201 | } | 
 | 1202 |  | 
 | 1203 | int radio::getCurrentCallsResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1204 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1205 |     RLOGD("radio::getCurrentCallsResponse: serial %d", serial); | 
 | 1206 |  | 
 | 1207 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1208 |         RadioResponseInfo responseInfo; | 
 | 1209 |         populateResponseInfo(responseInfo, serial, responseType, e); | 
 | 1210 |  | 
 | 1211 |         hidl_vec<Call> calls; | 
 | 1212 |         if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) { | 
 | 1213 |             RLOGE("radio::getCurrentCallsResponse: Invalid response"); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1214 |             if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1215 |         } else { | 
 | 1216 |             int num = responseLen / sizeof(RIL_Call *); | 
 | 1217 |             calls.resize(num); | 
 | 1218 |  | 
 | 1219 |             for (int i = 0 ; i < num ; i++) { | 
 | 1220 |                 RIL_Call *p_cur = ((RIL_Call **) response)[i]; | 
 | 1221 |                 /* each call info */ | 
 | 1222 |                 calls[i].state = (CallState) p_cur->state; | 
 | 1223 |                 calls[i].index = p_cur->index; | 
 | 1224 |                 calls[i].toa = p_cur->toa; | 
 | 1225 |                 calls[i].isMpty = p_cur->isMpty; | 
 | 1226 |                 calls[i].isMT = p_cur->isMT; | 
 | 1227 |                 calls[i].als = p_cur->als; | 
 | 1228 |                 calls[i].isVoice = p_cur->isVoice; | 
 | 1229 |                 calls[i].isVoicePrivacy = p_cur->isVoicePrivacy; | 
 | 1230 |                 calls[i].number = convertCharPtrToHidlString(p_cur->number); | 
 | 1231 |                 calls[i].numberPresentation = (CallPresentation) p_cur->numberPresentation; | 
 | 1232 |                 calls[i].name = convertCharPtrToHidlString(p_cur->name); | 
 | 1233 |                 calls[i].namePresentation = (CallPresentation) p_cur->namePresentation; | 
 | 1234 |                 if (!(p_cur->uusInfo == NULL || p_cur->uusInfo->uusData == NULL)) { | 
 | 1235 |                     RIL_UUS_Info *uusInfo = p_cur->uusInfo; | 
 | 1236 |                     calls[i].uusInfo[0].uusType = (UusType) uusInfo->uusType; | 
 | 1237 |                     calls[i].uusInfo[0].uusDcs = (UusDcs) uusInfo->uusDcs; | 
 | 1238 |                     // convert uusInfo->uusData to a null-terminated string | 
 | 1239 |                     if (uusInfo->uusData != NULL) { | 
 | 1240 |                         char *nullTermStr = strndup(uusInfo->uusData, uusInfo->uusLength); | 
 | 1241 |                         calls[i].uusInfo[0].uusData = nullTermStr; | 
 | 1242 |                         free(nullTermStr); | 
 | 1243 |                     } else { | 
 | 1244 |                         hidl_string emptyString; | 
 | 1245 |                         calls[i].uusInfo[0].uusData = emptyString; | 
 | 1246 |                     } | 
 | 1247 |                 } | 
 | 1248 |             } | 
 | 1249 |         } | 
 | 1250 |  | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1251 |         Return<void> retStatus = radioService[slotId]->mRadioResponse-> | 
 | 1252 |                 getCurrentCallsResponse(responseInfo, calls); | 
 | 1253 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1254 |     } else { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1255 |         RLOGE("radio::getCurrentCallsResponse: radioService[%d]->mRadioResponse == NULL", slotId); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1256 |     } | 
 | 1257 |  | 
 | 1258 |     return 0; | 
 | 1259 | } | 
 | 1260 |  | 
 | 1261 | int radio::dialResponse(android::Parcel &p, int slotId, int requestNumber, | 
 | 1262 |         int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { | 
 | 1263 |     RLOGD("radio::dialResponse: serial %d", serial); | 
 | 1264 |  | 
 | 1265 |     if (radioService[slotId]->mRadioResponse != NULL) { | 
 | 1266 |         RadioResponseInfo responseInfo; | 
 | 1267 |         populateResponseInfo(responseInfo, serial, responseType, e); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1268 |         Return<void> retStatus = radioService[slotId]->mRadioResponse->dialResponse(responseInfo); | 
 | 1269 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 1270 |     } else { | 
 | 1271 |         RLOGE("radio::dialResponse: radioService[%d]->mRadioResponse == NULL", slotId); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1272 |     } | 
 | 1273 |  | 
 | 1274 |     return 0; | 
 | 1275 | } | 
 | 1276 |  | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1277 | RadioIndicationType convertIntToRadioIndicationType(int indicationType) { | 
 | 1278 |     return indicationType == RESPONSE_UNSOLICITED ? (RadioIndicationType::UNSOLICITED) : | 
 | 1279 |             (RadioIndicationType::UNSOLICITED_ACK_EXP); | 
 | 1280 | } | 
 | 1281 |  | 
 | 1282 | void radio::radioStateChangedInd(int slotId, int indicationType, RIL_RadioState radioState) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1283 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1284 |         RLOGD("radio::radioStateChangedInd: radioState %d", radioState); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1285 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->radioStateChanged( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1286 |                 convertIntToRadioIndicationType(indicationType), (RadioState) radioState); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1287 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1288 |     } else { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1289 |         RLOGE("radio::radioStateChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 1290 |     } | 
 | 1291 | } | 
 | 1292 |  | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1293 | int radio::callStateChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1294 |                                int indicationType, int token, RIL_Errno e, void *response, | 
 | 1295 |                                size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1296 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1297 |         RLOGD("radio::callStateChangedInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1298 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->callStateChanged( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1299 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1300 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1301 |     } else { | 
 | 1302 |         RLOGE("radio::callStateChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1303 |     } | 
 | 1304 |  | 
 | 1305 |     return 0; | 
 | 1306 | } | 
 | 1307 |  | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 1308 | int radio::networkStateChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1309 |                                        int indicationType, int token, RIL_Errno e, void *response, | 
 | 1310 |                                        size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1311 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 1312 |         RLOGD("radio::networkStateChangedInd"); | 
 | 1313 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->networkStateChanged( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1314 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1315 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1316 |     } else { | 
| Jack Yu | 06181bb | 2017-01-10 12:10:41 -0800 | [diff] [blame] | 1317 |         RLOGE("radio::networkStateChangedInd: radioService[%d]->mRadioIndication == NULL", | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 1318 |                 slotId); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1319 |     } | 
 | 1320 |  | 
 | 1321 |     return 0; | 
 | 1322 | } | 
 | 1323 |  | 
 | 1324 | uint8_t hexCharToInt(uint8_t c) { | 
 | 1325 |     if (c >= '0' && c <= '9') return (c - '0'); | 
 | 1326 |     if (c >= 'A' && c <= 'F') return (c - 'A' + 10); | 
 | 1327 |     if (c >= 'a' && c <= 'f') return (c - 'a' + 10); | 
 | 1328 |  | 
 | 1329 |     return INVALID_HEX_CHAR; | 
 | 1330 | } | 
 | 1331 |  | 
 | 1332 | uint8_t * convertHexStringToBytes(void *response, size_t responseLen) { | 
 | 1333 |     if (responseLen % 2 != 0) { | 
 | 1334 |         return NULL; | 
 | 1335 |     } | 
 | 1336 |  | 
 | 1337 |     uint8_t *bytes = (uint8_t *)calloc(responseLen/2, sizeof(uint8_t)); | 
 | 1338 |     if (bytes == NULL) { | 
 | 1339 |         RLOGE("convertHexStringToBytes: cannot allocate memory for bytes string"); | 
 | 1340 |         return NULL; | 
 | 1341 |     } | 
 | 1342 |     uint8_t *hexString = (uint8_t *)response; | 
 | 1343 |  | 
| Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame^] | 1344 |     for (size_t i = 0; i < responseLen; i += 2) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1345 |         uint8_t hexChar1 = hexCharToInt(hexString[i]); | 
 | 1346 |         uint8_t hexChar2 = hexCharToInt(hexString[i + 1]); | 
 | 1347 |  | 
 | 1348 |         if (hexChar1 == INVALID_HEX_CHAR || hexChar2 == INVALID_HEX_CHAR) { | 
 | 1349 |             RLOGE("convertHexStringToBytes: invalid hex char %d %d", | 
 | 1350 |                     hexString[i], hexString[i + 1]); | 
 | 1351 |             free(bytes); | 
 | 1352 |             return NULL; | 
 | 1353 |         } | 
 | 1354 |         bytes[i/2] = ((hexChar1 << 4) | hexChar2); | 
 | 1355 |     } | 
 | 1356 |  | 
 | 1357 |     return bytes; | 
 | 1358 | } | 
 | 1359 |  | 
 | 1360 | int radio::newSmsInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1361 |                      int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1362 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1363 |         if (response == NULL || responseLen == 0) { | 
 | 1364 |             RLOGE("radio::newSmsInd: invalid response"); | 
 | 1365 |             return 0; | 
 | 1366 |         } | 
 | 1367 |  | 
 | 1368 |         uint8_t *bytes = convertHexStringToBytes(response, responseLen); | 
 | 1369 |         if (bytes == NULL) { | 
 | 1370 |             RLOGE("radio::newSmsInd: convertHexStringToBytes failed"); | 
 | 1371 |             return 0; | 
 | 1372 |         } | 
 | 1373 |  | 
 | 1374 |         hidl_vec<uint8_t> pdu; | 
 | 1375 |         pdu.setToExternal(bytes, responseLen/2); | 
 | 1376 |         RLOGD("radio::newSmsInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1377 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->newSms( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1378 |                 convertIntToRadioIndicationType(indicationType), pdu); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1379 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1380 |         free(bytes); | 
 | 1381 |     } else { | 
 | 1382 |         RLOGE("radio::newSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1383 |     } | 
 | 1384 |  | 
 | 1385 |     return 0; | 
 | 1386 | } | 
 | 1387 |  | 
 | 1388 | int radio::newSmsStatusReportInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1389 |                                  int indicationType, int token, RIL_Errno e, void *response, | 
 | 1390 |                                  size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1391 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1392 |         if (response == NULL || responseLen == 0) { | 
 | 1393 |             RLOGE("radio::newSmsStatusReportInd: invalid response"); | 
 | 1394 |             return 0; | 
 | 1395 |         } | 
 | 1396 |  | 
 | 1397 |         uint8_t *bytes = convertHexStringToBytes(response, responseLen); | 
 | 1398 |         if (bytes == NULL) { | 
 | 1399 |             RLOGE("radio::newSmsStatusReportInd: convertHexStringToBytes failed"); | 
 | 1400 |             return 0; | 
 | 1401 |         } | 
 | 1402 |  | 
 | 1403 |         hidl_vec<uint8_t> pdu; | 
 | 1404 |         pdu.setToExternal(bytes, responseLen/2); | 
 | 1405 |         RLOGD("radio::newSmsStatusReportInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1406 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->newSmsStatusReport( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1407 |                 convertIntToRadioIndicationType(indicationType), pdu); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1408 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1409 |         free(bytes); | 
 | 1410 |     } else { | 
 | 1411 |         RLOGE("radio::newSmsStatusReportInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1412 |     } | 
 | 1413 |  | 
 | 1414 |     return 0; | 
 | 1415 | } | 
 | 1416 |  | 
 | 1417 | int radio::newSmsOnSimInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1418 |                           int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1419 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1420 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 1421 |             RLOGE("radio::newSmsOnSimInd: invalid response"); | 
 | 1422 |             return 0; | 
 | 1423 |         } | 
 | 1424 |         int32_t recordNumber = ((int32_t *) response)[0]; | 
 | 1425 |         RLOGD("radio::newSmsOnSimInd: slotIndex %d", recordNumber); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1426 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->newSmsOnSim( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1427 |                 convertIntToRadioIndicationType(indicationType), recordNumber); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1428 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1429 |     } else { | 
 | 1430 |         RLOGE("radio::newSmsOnSimInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1431 |     } | 
 | 1432 |  | 
 | 1433 |     return 0; | 
 | 1434 | } | 
 | 1435 |  | 
 | 1436 | int radio::onUssdInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1437 |                      int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1438 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1439 |         if (response == NULL || responseLen != 2 * sizeof(char *)) { | 
 | 1440 |             RLOGE("radio::onUssdInd: invalid response"); | 
 | 1441 |             return 0; | 
 | 1442 |         } | 
 | 1443 |         char **strings = (char **) response; | 
 | 1444 |         char *mode = strings[0]; | 
 | 1445 |         hidl_string msg = convertCharPtrToHidlString(strings[1]); | 
 | 1446 |         UssdModeType modeType = (UssdModeType) atoi(mode); | 
 | 1447 |         RLOGD("radio::onUssdInd: mode %s", mode); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1448 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->onUssd( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1449 |                 convertIntToRadioIndicationType(indicationType), modeType, msg); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1450 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1451 |     } else { | 
 | 1452 |         RLOGE("radio::onUssdInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1453 |     } | 
 | 1454 |  | 
 | 1455 |     return 0; | 
 | 1456 | } | 
 | 1457 |  | 
 | 1458 | int radio::nitzTimeReceivedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1459 |                                int indicationType, int token, RIL_Errno e, void *response, | 
 | 1460 |                                size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1461 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1462 |         if (response == NULL || responseLen == 0) { | 
 | 1463 |             RLOGE("radio::nitzTimeReceivedInd: invalid response"); | 
 | 1464 |             return 0; | 
 | 1465 |         } | 
 | 1466 |         hidl_string nitzTime = convertCharPtrToHidlString((char *) response); | 
 | 1467 |         int64_t timeReceived = android::elapsedRealtime(); | 
| Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame^] | 1468 |         RLOGD("radio::nitzTimeReceivedInd: nitzTime %s receivedTime %" PRId64, nitzTime.c_str(), | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 1469 |                 timeReceived); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1470 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->nitzTimeReceived( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1471 |                 convertIntToRadioIndicationType(indicationType), nitzTime, timeReceived); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1472 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1473 |     } else { | 
 | 1474 |         RLOGE("radio::nitzTimeReceivedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
| Weilun Du | d2c3093 | 2017-02-09 12:32:42 -0800 | [diff] [blame] | 1475 |         return -1; | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1476 |     } | 
 | 1477 |  | 
 | 1478 |     return 0; | 
 | 1479 | } | 
 | 1480 |  | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 1481 | void convertRilSignalStrengthToHal(void *response, size_t responseLen, | 
 | 1482 |         SignalStrength& signalStrength) { | 
 | 1483 |     RIL_SignalStrength_v10 *rilSignalStrength = (RIL_SignalStrength_v10 *) response; | 
 | 1484 |  | 
 | 1485 |     // Fixup LTE for backwards compatibility | 
 | 1486 |     // signalStrength: -1 -> 99 | 
 | 1487 |     if (rilSignalStrength->LTE_SignalStrength.signalStrength == -1) { | 
 | 1488 |         rilSignalStrength->LTE_SignalStrength.signalStrength = 99; | 
 | 1489 |     } | 
 | 1490 |     // rsrp: -1 -> INT_MAX all other negative value to positive. | 
 | 1491 |     // So remap here | 
 | 1492 |     if (rilSignalStrength->LTE_SignalStrength.rsrp == -1) { | 
 | 1493 |         rilSignalStrength->LTE_SignalStrength.rsrp = INT_MAX; | 
 | 1494 |     } else if (rilSignalStrength->LTE_SignalStrength.rsrp < -1) { | 
 | 1495 |         rilSignalStrength->LTE_SignalStrength.rsrp = -rilSignalStrength->LTE_SignalStrength.rsrp; | 
 | 1496 |     } | 
 | 1497 |     // rsrq: -1 -> INT_MAX | 
 | 1498 |     if (rilSignalStrength->LTE_SignalStrength.rsrq == -1) { | 
 | 1499 |         rilSignalStrength->LTE_SignalStrength.rsrq = INT_MAX; | 
 | 1500 |     } | 
 | 1501 |     // Not remapping rssnr is already using INT_MAX | 
 | 1502 |     // cqi: -1 -> INT_MAX | 
 | 1503 |     if (rilSignalStrength->LTE_SignalStrength.cqi == -1) { | 
 | 1504 |         rilSignalStrength->LTE_SignalStrength.cqi = INT_MAX; | 
 | 1505 |     } | 
 | 1506 |  | 
 | 1507 |     signalStrength.gw.signalStrength = rilSignalStrength->GW_SignalStrength.signalStrength; | 
 | 1508 |     signalStrength.gw.bitErrorRate = rilSignalStrength->GW_SignalStrength.bitErrorRate; | 
 | 1509 |     signalStrength.cdma.dbm = rilSignalStrength->CDMA_SignalStrength.dbm; | 
 | 1510 |     signalStrength.cdma.ecio = rilSignalStrength->CDMA_SignalStrength.ecio; | 
 | 1511 |     signalStrength.evdo.dbm = rilSignalStrength->EVDO_SignalStrength.dbm; | 
 | 1512 |     signalStrength.evdo.ecio = rilSignalStrength->EVDO_SignalStrength.ecio; | 
 | 1513 |     signalStrength.evdo.signalNoiseRatio = | 
 | 1514 |             rilSignalStrength->EVDO_SignalStrength.signalNoiseRatio; | 
 | 1515 |     signalStrength.lte.signalStrength = rilSignalStrength->LTE_SignalStrength.signalStrength; | 
 | 1516 |     signalStrength.lte.rsrp = rilSignalStrength->LTE_SignalStrength.rsrp; | 
 | 1517 |     signalStrength.lte.rsrq = rilSignalStrength->LTE_SignalStrength.rsrq; | 
 | 1518 |     signalStrength.lte.rssnr = rilSignalStrength->LTE_SignalStrength.rssnr; | 
 | 1519 |     signalStrength.lte.cqi = rilSignalStrength->LTE_SignalStrength.cqi; | 
 | 1520 |     signalStrength.lte.timingAdvance = rilSignalStrength->LTE_SignalStrength.timingAdvance; | 
 | 1521 |     signalStrength.tdScdma.rscp = rilSignalStrength->TD_SCDMA_SignalStrength.rscp; | 
 | 1522 | } | 
 | 1523 |  | 
 | 1524 | int radio::currentSignalStrengthInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1525 |                                     int indicationType, int token, RIL_Errno e, | 
 | 1526 |                                     void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1527 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 1528 |         if (response == NULL || responseLen != sizeof(RIL_SignalStrength_v10)) { | 
 | 1529 |             RLOGE("radio::currentSignalStrengthInd: invalid response"); | 
 | 1530 |             return 0; | 
 | 1531 |         } | 
 | 1532 |  | 
 | 1533 |         SignalStrength signalStrength; | 
 | 1534 |         convertRilSignalStrengthToHal(response, responseLen, signalStrength); | 
 | 1535 |  | 
 | 1536 |         RLOGD("radio::currentSignalStrengthInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1537 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->currentSignalStrength( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 1538 |                 convertIntToRadioIndicationType(indicationType), signalStrength); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1539 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 1540 |     } else { | 
 | 1541 |         RLOGE("radio::currentSignalStrengthInd: radioService[%d]->mRadioIndication == NULL", | 
 | 1542 |                 slotId); | 
 | 1543 |     } | 
 | 1544 |  | 
 | 1545 |     return 0; | 
 | 1546 | } | 
 | 1547 |  | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1548 | void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse, | 
 | 1549 |         SetupDataCallResult& dcResult) { | 
 | 1550 |     dcResult.status = dcResponse->status; | 
 | 1551 |     dcResult.suggestedRetryTime = dcResponse->suggestedRetryTime; | 
 | 1552 |     dcResult.cid = dcResponse->cid; | 
 | 1553 |     dcResult.active = dcResponse->active; | 
 | 1554 |     dcResult.type = convertCharPtrToHidlString(dcResponse->type); | 
 | 1555 |     dcResult.ifname = convertCharPtrToHidlString(dcResponse->ifname); | 
 | 1556 |     dcResult.addresses = convertCharPtrToHidlString(dcResponse->addresses); | 
 | 1557 |     dcResult.dnses = convertCharPtrToHidlString(dcResponse->dnses); | 
 | 1558 |     dcResult.gateways = convertCharPtrToHidlString(dcResponse->gateways); | 
 | 1559 |     dcResult.pcscf = convertCharPtrToHidlString(dcResponse->pcscf); | 
 | 1560 |     dcResult.mtu = dcResponse->mtu; | 
 | 1561 | } | 
 | 1562 |  | 
 | 1563 | void convertRilDataCallListToHal(void *response, size_t responseLen, | 
 | 1564 |         hidl_vec<SetupDataCallResult>& dcResultList) { | 
 | 1565 |     int num = responseLen / sizeof(RIL_Data_Call_Response_v11); | 
 | 1566 |  | 
 | 1567 |     RIL_Data_Call_Response_v11 *dcResponse = (RIL_Data_Call_Response_v11 *) response; | 
 | 1568 |     dcResultList.resize(num); | 
 | 1569 |     for (int i = 0; i < num; i++) { | 
 | 1570 |         convertRilDataCallToHal(&dcResponse[i], dcResultList[i]); | 
 | 1571 |     } | 
 | 1572 | } | 
 | 1573 |  | 
 | 1574 | int radio::dataCallListChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1575 |                                   int indicationType, int token, RIL_Errno e, void *response, | 
 | 1576 |                                   size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1577 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1578 |         if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) { | 
 | 1579 |             RLOGE("radio::dataCallListChangedInd: invalid response"); | 
 | 1580 |             return 0; | 
 | 1581 |         } | 
 | 1582 |         hidl_vec<SetupDataCallResult> dcList; | 
 | 1583 |         convertRilDataCallListToHal(response, responseLen, dcList); | 
 | 1584 |         RLOGD("radio::dataCallListChangedInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1585 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->dataCallListChanged( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1586 |                 convertIntToRadioIndicationType(indicationType), dcList); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1587 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1588 |     } else { | 
 | 1589 |         RLOGE("radio::dataCallListChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1590 |     } | 
 | 1591 |  | 
 | 1592 |     return 0; | 
 | 1593 | } | 
 | 1594 |  | 
 | 1595 | int radio::suppSvcNotifyInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1596 |                             int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1597 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1598 |         if (response == NULL || responseLen != sizeof(RIL_SuppSvcNotification)) { | 
 | 1599 |             RLOGE("radio::suppSvcNotifyInd: invalid response"); | 
 | 1600 |             return 0; | 
 | 1601 |         } | 
 | 1602 |  | 
 | 1603 |         SuppSvcNotification suppSvc; | 
 | 1604 |         RIL_SuppSvcNotification *ssn = (RIL_SuppSvcNotification *) response; | 
 | 1605 |         suppSvc.isMT = ssn->notificationType; | 
 | 1606 |         suppSvc.code = ssn->code; | 
 | 1607 |         suppSvc.index = ssn->index; | 
 | 1608 |         suppSvc.type = ssn->type; | 
 | 1609 |         suppSvc.number = convertCharPtrToHidlString(ssn->number); | 
 | 1610 |  | 
 | 1611 |         RLOGD("radio::suppSvcNotifyInd: isMT %d code %d index %d type %d", | 
 | 1612 |                 suppSvc.isMT, suppSvc.code, suppSvc.index, suppSvc.type); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1613 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->suppSvcNotify( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1614 |                 convertIntToRadioIndicationType(indicationType), suppSvc); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1615 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1616 |     } else { | 
 | 1617 |         RLOGE("radio::suppSvcNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1618 |     } | 
 | 1619 |  | 
 | 1620 |     return 0; | 
 | 1621 | } | 
 | 1622 |  | 
 | 1623 | int radio::stkSessionEndInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1624 |                             int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1625 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1626 |         RLOGD("radio::stkSessionEndInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1627 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->stkSessionEnd( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1628 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1629 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1630 |     } else { | 
 | 1631 |         RLOGE("radio::stkSessionEndInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1632 |     } | 
 | 1633 |  | 
 | 1634 |     return 0; | 
 | 1635 | } | 
 | 1636 |  | 
 | 1637 | int radio::stkProactiveCommandInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1638 |                                   int indicationType, int token, RIL_Errno e, void *response, | 
 | 1639 |                                   size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1640 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1641 |         if (response == NULL || responseLen == 0) { | 
 | 1642 |             RLOGE("radio::stkProactiveCommandInd: invalid response"); | 
 | 1643 |             return 0; | 
 | 1644 |         } | 
 | 1645 |         RLOGD("radio::stkProactiveCommandInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1646 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->stkProactiveCommand( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1647 |                 convertIntToRadioIndicationType(indicationType), | 
 | 1648 |                 convertCharPtrToHidlString((char *) response)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1649 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1650 |     } else { | 
 | 1651 |         RLOGE("radio::stkProactiveCommandInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1652 |     } | 
 | 1653 |  | 
 | 1654 |     return 0; | 
 | 1655 | } | 
 | 1656 |  | 
 | 1657 | int radio::stkEventNotifyInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1658 |                              int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1659 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1660 |         if (response == NULL || responseLen == 0) { | 
 | 1661 |             RLOGE("radio::stkEventNotifyInd: invalid response"); | 
 | 1662 |             return 0; | 
 | 1663 |         } | 
 | 1664 |         RLOGD("radio::stkEventNotifyInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1665 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->stkEventNotify( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1666 |                 convertIntToRadioIndicationType(indicationType), | 
 | 1667 |                 convertCharPtrToHidlString((char *) response)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1668 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1669 |     } else { | 
 | 1670 |         RLOGE("radio::stkEventNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1671 |     } | 
 | 1672 |  | 
 | 1673 |     return 0; | 
 | 1674 | } | 
 | 1675 |  | 
 | 1676 | int radio::stkCallSetupInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1677 |                            int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1678 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1679 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 1680 |             RLOGE("radio::stkCallSetupInd: invalid response"); | 
 | 1681 |             return 0; | 
 | 1682 |         } | 
 | 1683 |         int32_t timeout = ((int32_t *) response)[0]; | 
 | 1684 |         RLOGD("radio::stkCallSetupInd: timeout %d", timeout); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1685 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->stkCallSetup( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1686 |                 convertIntToRadioIndicationType(indicationType), timeout); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1687 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1688 |     } else { | 
 | 1689 |         RLOGE("radio::stkCallSetupInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1690 |     } | 
 | 1691 |  | 
 | 1692 |     return 0; | 
 | 1693 | } | 
 | 1694 |  | 
 | 1695 | int radio::simSmsStorageFullInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1696 |                                 int indicationType, int token, RIL_Errno e, void *response, | 
 | 1697 |                                 size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1698 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1699 |         RLOGD("radio::simSmsStorageFullInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1700 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->simSmsStorageFull( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1701 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1702 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1703 |     } else { | 
 | 1704 |         RLOGE("radio::simSmsStorageFullInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1705 |     } | 
 | 1706 |  | 
 | 1707 |     return 0; | 
 | 1708 | } | 
 | 1709 |  | 
 | 1710 | int radio::simRefreshInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1711 |                          int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1712 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1713 |         if (response == NULL || responseLen != sizeof(RIL_SimRefreshResponse_v7)) { | 
 | 1714 |             RLOGE("radio::simRefreshInd: invalid response"); | 
 | 1715 |             return 0; | 
 | 1716 |         } | 
 | 1717 |  | 
 | 1718 |         SimRefreshResult refreshResult; | 
 | 1719 |         RIL_SimRefreshResponse_v7 *simRefreshResponse = ((RIL_SimRefreshResponse_v7 *) response); | 
 | 1720 |         refreshResult.type = | 
 | 1721 |                 (android::hardware::radio::V1_0::SimRefreshType) simRefreshResponse->result; | 
 | 1722 |         refreshResult.efId = simRefreshResponse->ef_id; | 
 | 1723 |         refreshResult.aid = convertCharPtrToHidlString(simRefreshResponse->aid); | 
 | 1724 |  | 
 | 1725 |         RLOGD("radio::simRefreshInd: type %d efId %d", refreshResult.type, refreshResult.efId); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1726 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->simRefresh( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1727 |                 convertIntToRadioIndicationType(indicationType), refreshResult); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1728 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1729 |     } else { | 
 | 1730 |         RLOGE("radio::simRefreshInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1731 |     } | 
 | 1732 |  | 
 | 1733 |     return 0; | 
 | 1734 | } | 
 | 1735 |  | 
 | 1736 | void convertRilCdmaSignalInfoRecordToHal(RIL_CDMA_SignalInfoRecord *signalInfoRecord, | 
 | 1737 |         CdmaSignalInfoRecord& record) { | 
 | 1738 |     record.isPresent = signalInfoRecord->isPresent; | 
 | 1739 |     record.signalType = signalInfoRecord->signalType; | 
 | 1740 |     record.alertPitch = signalInfoRecord->alertPitch; | 
 | 1741 |     record.signal = signalInfoRecord->signal; | 
 | 1742 | } | 
 | 1743 |  | 
 | 1744 | int radio::callRingInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1745 |                        int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1746 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1747 |         bool isGsm; | 
 | 1748 |         CdmaSignalInfoRecord record; | 
 | 1749 |         if (response == NULL || responseLen == 0) { | 
 | 1750 |             isGsm = true; | 
 | 1751 |         } else { | 
 | 1752 |             isGsm = false; | 
 | 1753 |             if (responseLen != sizeof (RIL_CDMA_SignalInfoRecord)) { | 
 | 1754 |                 RLOGE("radio::callRingInd: invalid response"); | 
 | 1755 |                 return 0; | 
 | 1756 |             } | 
 | 1757 |             convertRilCdmaSignalInfoRecordToHal((RIL_CDMA_SignalInfoRecord *) response, record); | 
 | 1758 |         } | 
 | 1759 |  | 
 | 1760 |         RLOGD("radio::callRingInd: isGsm %d", isGsm); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1761 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->callRing( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1762 |                 convertIntToRadioIndicationType(indicationType), isGsm, record); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1763 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1764 |     } else { | 
 | 1765 |         RLOGE("radio::callRingInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1766 |     } | 
 | 1767 |  | 
 | 1768 |     return 0; | 
 | 1769 | } | 
 | 1770 |  | 
 | 1771 | int radio::simStatusChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1772 |                                int indicationType, int token, RIL_Errno e, void *response, | 
 | 1773 |                                size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1774 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1775 |         RLOGD("radio::simStatusChangedInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1776 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->simStatusChanged( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1777 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1778 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1779 |     } else { | 
 | 1780 |         RLOGE("radio::simStatusChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1781 |     } | 
 | 1782 |  | 
 | 1783 |     return 0; | 
 | 1784 | } | 
 | 1785 |  | 
 | 1786 | int radio::cdmaNewSmsInd(android::Parcel &p, int slotId, int requestNumber, int indicationType, | 
 | 1787 |                          int token, RIL_Errno e, void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1788 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1789 |         if (response == NULL || responseLen != sizeof(RIL_CDMA_SMS_Message)) { | 
 | 1790 |             RLOGE("radio::cdmaNewSmsInd: invalid response"); | 
 | 1791 |             return 0; | 
 | 1792 |         } | 
 | 1793 |  | 
 | 1794 |         CdmaSmsMessage msg; | 
 | 1795 |         RIL_CDMA_SMS_Message *rilMsg = (RIL_CDMA_SMS_Message *) response; | 
 | 1796 |         msg.teleserviceId = rilMsg->uTeleserviceID; | 
 | 1797 |         msg.isServicePresent = rilMsg->bIsServicePresent; | 
 | 1798 |         msg.serviceCategory = rilMsg->uServicecategory; | 
 | 1799 |         msg.address.digitMode = | 
 | 1800 |                 (android::hardware::radio::V1_0::CdmaSmsDigitMode) rilMsg->sAddress.digit_mode; | 
 | 1801 |         msg.address.numberMode = | 
 | 1802 |                 (android::hardware::radio::V1_0::CdmaSmsNumberMode) rilMsg->sAddress.number_mode; | 
 | 1803 |         msg.address.numberType = | 
 | 1804 |                 (android::hardware::radio::V1_0::CdmaSmsNumberType) rilMsg->sAddress.number_type; | 
 | 1805 |         msg.address.numberPlan = | 
 | 1806 |                 (android::hardware::radio::V1_0::CdmaSmsNumberPlan) rilMsg->sAddress.number_plan; | 
 | 1807 |  | 
 | 1808 |         int digitLimit = MIN((rilMsg->sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX); | 
 | 1809 |         msg.address.digits.setToExternal(rilMsg->sAddress.digits, digitLimit); | 
 | 1810 |  | 
 | 1811 |         msg.subAddress.subaddressType = (android::hardware::radio::V1_0::CdmaSmsSubaddressType) | 
 | 1812 |                 rilMsg->sSubAddress.subaddressType; | 
 | 1813 |         msg.subAddress.odd = rilMsg->sSubAddress.odd; | 
 | 1814 |  | 
 | 1815 |         digitLimit= MIN((rilMsg->sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX); | 
 | 1816 |         msg.subAddress.digits.setToExternal(rilMsg->sSubAddress.digits, digitLimit); | 
 | 1817 |  | 
 | 1818 |         digitLimit = MIN((rilMsg->uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX); | 
 | 1819 |         msg.bearerData.setToExternal(rilMsg->aBearerData, digitLimit); | 
 | 1820 |  | 
 | 1821 |         RLOGD("radio::cdmaNewSmsInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1822 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaNewSms( | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1823 |                 convertIntToRadioIndicationType(indicationType), msg); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1824 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 1825 |     } else { | 
 | 1826 |         RLOGE("radio::cdmaNewSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1827 |     } | 
 | 1828 |  | 
 | 1829 |     return 0; | 
 | 1830 | } | 
 | 1831 |  | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1832 | int radio::newBroadcastSmsInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1833 |                               int indicationType, int token, RIL_Errno e, void *response, | 
 | 1834 |                               size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1835 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1836 |         if (response == NULL || responseLen == 0) { | 
 | 1837 |             RLOGE("radio::newBroadcastSmsInd: invalid response"); | 
 | 1838 |             return 0; | 
 | 1839 |         } | 
 | 1840 |  | 
 | 1841 |         hidl_vec<uint8_t> data; | 
 | 1842 |         data.setToExternal((uint8_t *) response, responseLen); | 
 | 1843 |         RLOGD("radio::newBroadcastSmsInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1844 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->newBroadcastSms( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1845 |                 convertIntToRadioIndicationType(indicationType), data); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1846 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1847 |     } else { | 
 | 1848 |         RLOGE("radio::newBroadcastSmsInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1849 |     } | 
 | 1850 |  | 
 | 1851 |     return 0; | 
 | 1852 | } | 
 | 1853 |  | 
 | 1854 | int radio::cdmaRuimSmsStorageFullInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1855 |                                      int indicationType, int token, RIL_Errno e, void *response, | 
 | 1856 |                                      size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1857 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1858 |         RLOGD("radio::cdmaRuimSmsStorageFullInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1859 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaRuimSmsStorageFull( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1860 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1861 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1862 |     } else { | 
 | 1863 |         RLOGE("radio::cdmaRuimSmsStorageFullInd: radioService[%d]->mRadioIndication == NULL", | 
 | 1864 |                 slotId); | 
 | 1865 |     } | 
 | 1866 |  | 
 | 1867 |     return 0; | 
 | 1868 | } | 
 | 1869 |  | 
 | 1870 | int radio::restrictedStateChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1871 |                                      int indicationType, int token, RIL_Errno e, void *response, | 
 | 1872 |                                      size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1873 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1874 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 1875 |             RLOGE("radio::restrictedStateChangedInd: invalid response"); | 
 | 1876 |             return 0; | 
 | 1877 |         } | 
 | 1878 |         int32_t state = ((int32_t *) response)[0]; | 
 | 1879 |         RLOGD("radio::restrictedStateChangedInd: state %d", state); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1880 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->restrictedStateChanged( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1881 |                 convertIntToRadioIndicationType(indicationType), (PhoneRestrictedState) state); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1882 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1883 |     } else { | 
 | 1884 |         RLOGE("radio::restrictedStateChangedInd: radioService[%d]->mRadioIndication == NULL", | 
 | 1885 |                 slotId); | 
 | 1886 |     } | 
 | 1887 |  | 
 | 1888 |     return 0; | 
 | 1889 | } | 
 | 1890 |  | 
 | 1891 | int radio::enterEmergencyCallbackModeInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1892 |                                          int indicationType, int token, RIL_Errno e, void *response, | 
 | 1893 |                                          size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1894 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1895 |         RLOGD("radio::enterEmergencyCallbackModeInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1896 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->enterEmergencyCallbackMode( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1897 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1898 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1899 |     } else { | 
 | 1900 |         RLOGE("radio::enterEmergencyCallbackModeInd: radioService[%d]->mRadioIndication == NULL", | 
 | 1901 |                 slotId); | 
 | 1902 |     } | 
 | 1903 |  | 
 | 1904 |     return 0; | 
 | 1905 | } | 
 | 1906 |  | 
 | 1907 | int radio::cdmaCallWaitingInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1908 |                               int indicationType, int token, RIL_Errno e, void *response, | 
 | 1909 |                               size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1910 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1911 |         if (response == NULL || responseLen != sizeof(RIL_CDMA_CallWaiting_v6)) { | 
 | 1912 |             RLOGE("radio::cdmaCallWaitingInd: invalid response"); | 
 | 1913 |             return 0; | 
 | 1914 |         } | 
 | 1915 |  | 
 | 1916 |         CdmaCallWaiting callWaitingRecord; | 
 | 1917 |         RIL_CDMA_CallWaiting_v6 *callWaitingRil = ((RIL_CDMA_CallWaiting_v6 *) response); | 
 | 1918 |         callWaitingRecord.number = convertCharPtrToHidlString(callWaitingRil->number); | 
 | 1919 |         callWaitingRecord.numberPresentation = | 
 | 1920 |                 (CdmaCallWaitingNumberPresentation) callWaitingRil->numberPresentation; | 
 | 1921 |         callWaitingRecord.name = convertCharPtrToHidlString(callWaitingRil->name); | 
 | 1922 |         convertRilCdmaSignalInfoRecordToHal(&callWaitingRil->signalInfoRecord, | 
 | 1923 |                 callWaitingRecord.signalInfoRecord); | 
 | 1924 |         callWaitingRecord.numberType = (CdmaCallWaitingNumberType) callWaitingRil->number_type; | 
 | 1925 |         callWaitingRecord.numberPlan = (CdmaCallWaitingNumberPlan) callWaitingRil->number_plan; | 
 | 1926 |  | 
 | 1927 |         RLOGD("radio::cdmaCallWaitingInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1928 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaCallWaiting( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1929 |                 convertIntToRadioIndicationType(indicationType), callWaitingRecord); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1930 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1931 |     } else { | 
 | 1932 |         RLOGE("radio::cdmaCallWaitingInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 1933 |     } | 
 | 1934 |  | 
 | 1935 |     return 0; | 
 | 1936 | } | 
 | 1937 |  | 
 | 1938 | int radio::cdmaOtaProvisionStatusInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1939 |                                      int indicationType, int token, RIL_Errno e, void *response, | 
 | 1940 |                                      size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1941 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1942 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 1943 |             RLOGE("radio::cdmaOtaProvisionStatusInd: invalid response"); | 
 | 1944 |             return 0; | 
 | 1945 |         } | 
 | 1946 |         int32_t status = ((int32_t *) response)[0]; | 
 | 1947 |         RLOGD("radio::cdmaOtaProvisionStatusInd: status %d", status); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1948 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaOtaProvisionStatus( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1949 |                 convertIntToRadioIndicationType(indicationType), (CdmaOtaProvisionStatus) status); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 1950 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1951 |     } else { | 
 | 1952 |         RLOGE("radio::cdmaOtaProvisionStatusInd: radioService[%d]->mRadioIndication == NULL", | 
 | 1953 |                 slotId); | 
 | 1954 |     } | 
 | 1955 |  | 
 | 1956 |     return 0; | 
 | 1957 | } | 
 | 1958 |  | 
 | 1959 | int radio::cdmaInfoRecInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 1960 |                           int indicationType, int token, RIL_Errno e, void *response, | 
 | 1961 |                           size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 1962 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 1963 |         if (response == NULL || responseLen != sizeof(RIL_CDMA_InformationRecords)) { | 
 | 1964 |             RLOGE("radio::cdmaInfoRecInd: invalid response"); | 
 | 1965 |             return 0; | 
 | 1966 |         } | 
 | 1967 |  | 
 | 1968 |         CdmaInformationRecords records; | 
 | 1969 |         RIL_CDMA_InformationRecords *recordsRil = (RIL_CDMA_InformationRecords *) response; | 
 | 1970 |  | 
 | 1971 |         char* string8 = NULL; | 
 | 1972 |         int num = MIN(recordsRil->numberOfInfoRecs, RIL_CDMA_MAX_NUMBER_OF_INFO_RECS); | 
 | 1973 |         if (recordsRil->numberOfInfoRecs > RIL_CDMA_MAX_NUMBER_OF_INFO_RECS) { | 
 | 1974 |             RLOGE("radio::cdmaInfoRecInd: received %d recs which is more than %d, dropping \ | 
 | 1975 |                     additional ones", | 
 | 1976 |                     recordsRil->numberOfInfoRecs, | 
 | 1977 |                     RIL_CDMA_MAX_NUMBER_OF_INFO_RECS); | 
 | 1978 |         } | 
 | 1979 |         records.infoRec.resize(num); | 
 | 1980 |         for (int i = 0 ; i < num ; i++) { | 
 | 1981 |             CdmaInformationRecord *record = &records.infoRec[i]; | 
 | 1982 |             RIL_CDMA_InformationRecord *infoRec = &recordsRil->infoRec[i]; | 
 | 1983 |             record->name = (CdmaInfoRecName) infoRec->name; | 
 | 1984 |             switch (infoRec->name) { | 
 | 1985 |                 case RIL_CDMA_DISPLAY_INFO_REC: | 
 | 1986 |                 case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: { | 
 | 1987 |                     if (infoRec->rec.display.alpha_len > CDMA_ALPHA_INFO_BUFFER_LENGTH) { | 
 | 1988 |                         RLOGE("radio::cdmaInfoRecInd: invalid display info response length %d \ | 
 | 1989 |                                 expected not more than %d", (int) infoRec->rec.display.alpha_len, | 
 | 1990 |                                 CDMA_ALPHA_INFO_BUFFER_LENGTH); | 
 | 1991 |                         return 0; | 
 | 1992 |                     } | 
 | 1993 |                     string8 = (char*) malloc((infoRec->rec.display.alpha_len + 1) * sizeof(char)); | 
 | 1994 |                     if (string8 == NULL) { | 
 | 1995 |                         RLOGE("radio::cdmaInfoRecInd: Memory allocation failed for \ | 
 | 1996 |                                 responseCdmaInformationRecords"); | 
 | 1997 |                         return 0; | 
 | 1998 |                     } | 
 | 1999 |                     memcpy(string8, infoRec->rec.display.alpha_buf, infoRec->rec.display.alpha_len); | 
 | 2000 |                     string8[(int)infoRec->rec.display.alpha_len] = '\0'; | 
 | 2001 |  | 
 | 2002 |                     record->display.resize(1); | 
 | 2003 |                     record->display[0].alphaBuf = string8; | 
 | 2004 |                     free(string8); | 
 | 2005 |                     string8 = NULL; | 
 | 2006 |                     break; | 
 | 2007 |                 } | 
 | 2008 |  | 
 | 2009 |                 case RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: | 
 | 2010 |                 case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: | 
 | 2011 |                 case RIL_CDMA_CONNECTED_NUMBER_INFO_REC: { | 
 | 2012 |                     if (infoRec->rec.number.len > CDMA_NUMBER_INFO_BUFFER_LENGTH) { | 
 | 2013 |                         RLOGE("radio::cdmaInfoRecInd: invalid display info response length %d \ | 
 | 2014 |                                 expected not more than %d", (int) infoRec->rec.number.len, | 
 | 2015 |                                 CDMA_NUMBER_INFO_BUFFER_LENGTH); | 
 | 2016 |                         return 0; | 
 | 2017 |                     } | 
 | 2018 |                     string8 = (char*) malloc((infoRec->rec.number.len + 1) * sizeof(char)); | 
 | 2019 |                     if (string8 == NULL) { | 
 | 2020 |                         RLOGE("radio::cdmaInfoRecInd: Memory allocation failed for \ | 
 | 2021 |                                 responseCdmaInformationRecords"); | 
 | 2022 |                         return 0; | 
 | 2023 |                     } | 
 | 2024 |                     memcpy(string8, infoRec->rec.number.buf, infoRec->rec.number.len); | 
 | 2025 |                     string8[(int)infoRec->rec.number.len] = '\0'; | 
 | 2026 |  | 
 | 2027 |                     record->number.resize(1); | 
 | 2028 |                     record->number[0].number = string8; | 
 | 2029 |                     free(string8); | 
 | 2030 |                     string8 = NULL; | 
 | 2031 |                     record->number[0].numberType = infoRec->rec.number.number_type; | 
 | 2032 |                     record->number[0].numberPlan = infoRec->rec.number.number_plan; | 
 | 2033 |                     record->number[0].pi = infoRec->rec.number.pi; | 
 | 2034 |                     record->number[0].si = infoRec->rec.number.si; | 
 | 2035 |                     break; | 
 | 2036 |                 } | 
 | 2037 |  | 
 | 2038 |                 case RIL_CDMA_SIGNAL_INFO_REC: { | 
 | 2039 |                     record->signal.resize(1); | 
 | 2040 |                     record->signal[0].isPresent = infoRec->rec.signal.isPresent; | 
 | 2041 |                     record->signal[0].signalType = infoRec->rec.signal.signalType; | 
 | 2042 |                     record->signal[0].alertPitch = infoRec->rec.signal.alertPitch; | 
 | 2043 |                     record->signal[0].signal = infoRec->rec.signal.signal; | 
 | 2044 |                     break; | 
 | 2045 |                 } | 
 | 2046 |  | 
 | 2047 |                 case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: { | 
 | 2048 |                     if (infoRec->rec.redir.redirectingNumber.len > | 
 | 2049 |                                                   CDMA_NUMBER_INFO_BUFFER_LENGTH) { | 
 | 2050 |                         RLOGE("radio::cdmaInfoRecInd: invalid display info response length %d \ | 
 | 2051 |                                 expected not more than %d\n", | 
 | 2052 |                                 (int)infoRec->rec.redir.redirectingNumber.len, | 
 | 2053 |                                 CDMA_NUMBER_INFO_BUFFER_LENGTH); | 
 | 2054 |                         return 0; | 
 | 2055 |                     } | 
 | 2056 |                     string8 = (char*) malloc((infoRec->rec.redir.redirectingNumber.len + 1) * | 
 | 2057 |                             sizeof(char)); | 
 | 2058 |                     if (string8 == NULL) { | 
 | 2059 |                         RLOGE("radio::cdmaInfoRecInd: Memory allocation failed for \ | 
 | 2060 |                                 responseCdmaInformationRecords"); | 
 | 2061 |                         return 0; | 
 | 2062 |                     } | 
 | 2063 |                     memcpy(string8, infoRec->rec.redir.redirectingNumber.buf, | 
 | 2064 |                             infoRec->rec.redir.redirectingNumber.len); | 
 | 2065 |                     string8[(int)infoRec->rec.redir.redirectingNumber.len] = '\0'; | 
 | 2066 |  | 
 | 2067 |                     record->redir.resize(1); | 
 | 2068 |                     record->redir[0].redirectingNumber.number = string8; | 
 | 2069 |                     free(string8); | 
 | 2070 |                     string8 = NULL; | 
 | 2071 |                     record->redir[0].redirectingNumber.numberType = | 
 | 2072 |                             infoRec->rec.redir.redirectingNumber.number_type; | 
 | 2073 |                     record->redir[0].redirectingNumber.numberPlan = | 
 | 2074 |                             infoRec->rec.redir.redirectingNumber.number_plan; | 
 | 2075 |                     record->redir[0].redirectingNumber.pi = infoRec->rec.redir.redirectingNumber.pi; | 
 | 2076 |                     record->redir[0].redirectingNumber.si = infoRec->rec.redir.redirectingNumber.si; | 
 | 2077 |                     record->redir[0].redirectingReason = | 
 | 2078 |                             (CdmaRedirectingReason) infoRec->rec.redir.redirectingReason; | 
 | 2079 |                     break; | 
 | 2080 |                 } | 
 | 2081 |  | 
 | 2082 |                 case RIL_CDMA_LINE_CONTROL_INFO_REC: { | 
 | 2083 |                     record->lineCtrl.resize(1); | 
 | 2084 |                     record->lineCtrl[0].lineCtrlPolarityIncluded = | 
 | 2085 |                             infoRec->rec.lineCtrl.lineCtrlPolarityIncluded; | 
 | 2086 |                     record->lineCtrl[0].lineCtrlToggle = infoRec->rec.lineCtrl.lineCtrlToggle; | 
 | 2087 |                     record->lineCtrl[0].lineCtrlReverse = infoRec->rec.lineCtrl.lineCtrlReverse; | 
 | 2088 |                     record->lineCtrl[0].lineCtrlPowerDenial = | 
 | 2089 |                             infoRec->rec.lineCtrl.lineCtrlPowerDenial; | 
 | 2090 |                     break; | 
 | 2091 |                 } | 
 | 2092 |  | 
 | 2093 |                 case RIL_CDMA_T53_CLIR_INFO_REC: { | 
 | 2094 |                     record->clir.resize(1); | 
 | 2095 |                     record->clir[0].cause = infoRec->rec.clir.cause; | 
 | 2096 |                     break; | 
 | 2097 |                 } | 
 | 2098 |  | 
 | 2099 |                 case RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: { | 
 | 2100 |                     record->audioCtrl.resize(1); | 
 | 2101 |                     record->audioCtrl[0].upLink = infoRec->rec.audioCtrl.upLink; | 
 | 2102 |                     record->audioCtrl[0].downLink = infoRec->rec.audioCtrl.downLink; | 
 | 2103 |                     break; | 
 | 2104 |                 } | 
 | 2105 |  | 
 | 2106 |                 case RIL_CDMA_T53_RELEASE_INFO_REC: | 
 | 2107 |                     RLOGE("radio::cdmaInfoRecInd: RIL_CDMA_T53_RELEASE_INFO_REC: INVALID"); | 
 | 2108 |                     return 0; | 
 | 2109 |  | 
 | 2110 |                 default: | 
 | 2111 |                     RLOGE("radio::cdmaInfoRecInd: Incorrect name value"); | 
 | 2112 |                     return 0; | 
 | 2113 |             } | 
 | 2114 |         } | 
 | 2115 |  | 
 | 2116 |         RLOGD("radio::cdmaInfoRecInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2117 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaInfoRec( | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 2118 |                 convertIntToRadioIndicationType(indicationType), records); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2119 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 1955c74 | 2016-12-29 07:07:54 -0800 | [diff] [blame] | 2120 |     } else { | 
 | 2121 |         RLOGE("radio::cdmaInfoRecInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2122 |     } | 
 | 2123 |  | 
 | 2124 |     return 0; | 
 | 2125 | } | 
 | 2126 |  | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2127 | int radio::oemHookRawInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2128 |                          int indicationType, int token, RIL_Errno e, void *response, | 
 | 2129 |                          size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2130 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2131 |         if (response == NULL || responseLen == 0) { | 
 | 2132 |             RLOGE("radio::oemHookRawInd: invalid response"); | 
 | 2133 |             return 0; | 
 | 2134 |         } | 
 | 2135 |  | 
 | 2136 |         hidl_vec<uint8_t> data; | 
 | 2137 |         data.setToExternal((uint8_t *) response, responseLen); | 
 | 2138 |         RLOGD("radio::oemHookRawInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2139 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->oemHookRaw( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2140 |                 convertIntToRadioIndicationType(indicationType), data); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2141 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2142 |     } else { | 
 | 2143 |         RLOGE("radio::oemHookRawInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2144 |     } | 
 | 2145 |  | 
 | 2146 |     return 0; | 
 | 2147 | } | 
 | 2148 |  | 
 | 2149 | int radio::indicateRingbackToneInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2150 |                                    int indicationType, int token, RIL_Errno e, void *response, | 
 | 2151 |                                    size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2152 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2153 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 2154 |             RLOGE("radio::indicateRingbackToneInd: invalid response"); | 
 | 2155 |             return 0; | 
 | 2156 |         } | 
 | 2157 |         bool start = ((int32_t *) response)[0]; | 
 | 2158 |         RLOGD("radio::indicateRingbackToneInd: start %d", start); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2159 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->indicateRingbackTone( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2160 |                 convertIntToRadioIndicationType(indicationType), start); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2161 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2162 |     } else { | 
 | 2163 |         RLOGE("radio::indicateRingbackToneInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2164 |     } | 
 | 2165 |  | 
 | 2166 |     return 0; | 
 | 2167 | } | 
 | 2168 |  | 
 | 2169 | int radio::resendIncallMuteInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2170 |                                int indicationType, int token, RIL_Errno e, void *response, | 
 | 2171 |                                size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2172 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2173 |         RLOGD("radio::resendIncallMuteInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2174 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->resendIncallMute( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2175 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2176 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2177 |     } else { | 
 | 2178 |         RLOGE("radio::resendIncallMuteInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2179 |     } | 
 | 2180 |  | 
 | 2181 |     return 0; | 
 | 2182 | } | 
 | 2183 |  | 
 | 2184 | int radio::cdmaSubscriptionSourceChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2185 |                                             int indicationType, int token, RIL_Errno e, | 
 | 2186 |                                             void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2187 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2188 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 2189 |             RLOGE("radio::cdmaSubscriptionSourceChangedInd: invalid response"); | 
 | 2190 |             return 0; | 
 | 2191 |         } | 
 | 2192 |         int32_t cdmaSource = ((int32_t *) response)[0]; | 
 | 2193 |         RLOGD("radio::cdmaSubscriptionSourceChangedInd: cdmaSource %d", cdmaSource); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2194 |         Return<void> retStatus = radioService[slotId]->mRadioIndication-> | 
 | 2195 |                 cdmaSubscriptionSourceChanged(convertIntToRadioIndicationType(indicationType), | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2196 |                 (CdmaSubscriptionSource) cdmaSource); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2197 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2198 |     } else { | 
 | 2199 |         RLOGE("radio::cdmaSubscriptionSourceChangedInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2200 |                 slotId); | 
 | 2201 |     } | 
 | 2202 |  | 
 | 2203 |     return 0; | 
 | 2204 | } | 
 | 2205 |  | 
 | 2206 | int radio::cdmaPrlChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2207 |                              int indicationType, int token, RIL_Errno e, void *response, | 
 | 2208 |                              size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2209 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2210 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 2211 |             RLOGE("radio::cdmaPrlChangedInd: invalid response"); | 
 | 2212 |             return 0; | 
 | 2213 |         } | 
 | 2214 |         int32_t version = ((int32_t *) response)[0]; | 
 | 2215 |         RLOGD("radio::cdmaPrlChangedInd: version %d", version); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2216 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cdmaPrlChanged( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2217 |                 convertIntToRadioIndicationType(indicationType), version); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2218 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2219 |     } else { | 
 | 2220 |         RLOGE("radio::cdmaPrlChangedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2221 |     } | 
 | 2222 |  | 
 | 2223 |     return 0; | 
 | 2224 | } | 
 | 2225 |  | 
 | 2226 | int radio::exitEmergencyCallbackModeInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2227 |                                         int indicationType, int token, RIL_Errno e, void *response, | 
 | 2228 |                                         size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2229 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2230 |         RLOGD("radio::exitEmergencyCallbackModeInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2231 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->exitEmergencyCallbackMode( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2232 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2233 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2234 |     } else { | 
 | 2235 |         RLOGE("radio::exitEmergencyCallbackModeInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2236 |                 slotId); | 
 | 2237 |     } | 
 | 2238 |  | 
 | 2239 |     return 0; | 
 | 2240 | } | 
 | 2241 |  | 
 | 2242 | int radio::rilConnectedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2243 |                            int indicationType, int token, RIL_Errno e, void *response, | 
 | 2244 |                            size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2245 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2246 |         RLOGD("radio::rilConnectedInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2247 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->rilConnected( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2248 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2249 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2250 |     } else { | 
 | 2251 |         RLOGE("radio::rilConnectedInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2252 |     } | 
 | 2253 |  | 
 | 2254 |     return 0; | 
 | 2255 | } | 
 | 2256 |  | 
 | 2257 | int radio::voiceRadioTechChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2258 |                                     int indicationType, int token, RIL_Errno e, void *response, | 
 | 2259 |                                     size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2260 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2261 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 2262 |             RLOGE("radio::voiceRadioTechChangedInd: invalid response"); | 
 | 2263 |             return 0; | 
 | 2264 |         } | 
 | 2265 |         int32_t rat = ((int32_t *) response)[0]; | 
 | 2266 |         RLOGD("radio::voiceRadioTechChangedInd: rat %d", rat); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2267 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->voiceRadioTechChanged( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2268 |                 convertIntToRadioIndicationType(indicationType), (RadioTechnology) rat); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2269 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2270 |     } else { | 
 | 2271 |         RLOGE("radio::voiceRadioTechChangedInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2272 |                 slotId); | 
 | 2273 |     } | 
 | 2274 |  | 
 | 2275 |     return 0; | 
 | 2276 | } | 
 | 2277 |  | 
 | 2278 | void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<CellInfo>& records) { | 
 | 2279 |     int num = responseLen / sizeof(RIL_CellInfo_v12); | 
 | 2280 |     records.resize(num); | 
 | 2281 |  | 
 | 2282 |     RIL_CellInfo_v12 *rillCellInfo = (RIL_CellInfo_v12 *) response; | 
 | 2283 |     for (int i = 0; i < num; i++) { | 
 | 2284 |         records[i].cellInfoType = (CellInfoType) rillCellInfo->cellInfoType; | 
 | 2285 |         records[i].registered = rillCellInfo->registered; | 
 | 2286 |         records[i].timeStampType = (TimeStampType) rillCellInfo->timeStampType; | 
 | 2287 |         records[i].timeStamp = rillCellInfo->timeStamp; | 
 | 2288 |         switch(rillCellInfo->cellInfoType) { | 
 | 2289 |             case RIL_CELL_INFO_TYPE_GSM: { | 
 | 2290 |                 records[i].gsm.resize(1); | 
 | 2291 |                 CellInfoGsm *cellInfoGsm = &records[i].gsm[0]; | 
 | 2292 |                 cellInfoGsm->cellIdentityGsm.mcc = | 
 | 2293 |                         std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mcc); | 
 | 2294 |                 cellInfoGsm->cellIdentityGsm.mnc = | 
 | 2295 |                         std::to_string(rillCellInfo->CellInfo.gsm.cellIdentityGsm.mnc); | 
 | 2296 |                 cellInfoGsm->cellIdentityGsm.lac = | 
 | 2297 |                         rillCellInfo->CellInfo.gsm.cellIdentityGsm.lac; | 
 | 2298 |                 cellInfoGsm->cellIdentityGsm.cid = | 
 | 2299 |                         rillCellInfo->CellInfo.gsm.cellIdentityGsm.cid; | 
 | 2300 |                 cellInfoGsm->cellIdentityGsm.arfcn = | 
 | 2301 |                         rillCellInfo->CellInfo.gsm.cellIdentityGsm.arfcn; | 
 | 2302 |                 cellInfoGsm->cellIdentityGsm.bsic = | 
 | 2303 |                         rillCellInfo->CellInfo.gsm.cellIdentityGsm.bsic; | 
 | 2304 |                 cellInfoGsm->signalStrengthGsm.signalStrength = | 
 | 2305 |                         rillCellInfo->CellInfo.gsm.signalStrengthGsm.signalStrength; | 
 | 2306 |                 cellInfoGsm->signalStrengthGsm.bitErrorRate = | 
 | 2307 |                         rillCellInfo->CellInfo.gsm.signalStrengthGsm.bitErrorRate; | 
 | 2308 |                 cellInfoGsm->signalStrengthGsm.timingAdvance = | 
 | 2309 |                         rillCellInfo->CellInfo.gsm.signalStrengthGsm.timingAdvance; | 
 | 2310 |                 break; | 
 | 2311 |             } | 
 | 2312 |  | 
 | 2313 |             case RIL_CELL_INFO_TYPE_WCDMA: { | 
 | 2314 |                 records[i].wcdma.resize(1); | 
 | 2315 |                 CellInfoWcdma *cellInfoWcdma = &records[i].wcdma[0]; | 
 | 2316 |                 cellInfoWcdma->cellIdentityWcdma.mcc = | 
 | 2317 |                         std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mcc); | 
 | 2318 |                 cellInfoWcdma->cellIdentityWcdma.mnc = | 
 | 2319 |                         std::to_string(rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.mnc); | 
 | 2320 |                 cellInfoWcdma->cellIdentityWcdma.lac = | 
 | 2321 |                         rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.lac; | 
 | 2322 |                 cellInfoWcdma->cellIdentityWcdma.cid = | 
 | 2323 |                         rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.cid; | 
 | 2324 |                 cellInfoWcdma->cellIdentityWcdma.psc = | 
 | 2325 |                         rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.psc; | 
 | 2326 |                 cellInfoWcdma->cellIdentityWcdma.uarfcn = | 
 | 2327 |                         rillCellInfo->CellInfo.wcdma.cellIdentityWcdma.uarfcn; | 
 | 2328 |                 cellInfoWcdma->signalStrengthWcdma.signalStrength = | 
 | 2329 |                         rillCellInfo->CellInfo.wcdma.signalStrengthWcdma.signalStrength; | 
 | 2330 |                 cellInfoWcdma->signalStrengthWcdma.bitErrorRate = | 
 | 2331 |                         rillCellInfo->CellInfo.wcdma.signalStrengthWcdma.bitErrorRate; | 
 | 2332 |                 break; | 
 | 2333 |             } | 
 | 2334 |  | 
 | 2335 |             case RIL_CELL_INFO_TYPE_CDMA: { | 
 | 2336 |                 records[i].cdma.resize(1); | 
 | 2337 |                 CellInfoCdma *cellInfoCdma = &records[i].cdma[0]; | 
 | 2338 |                 cellInfoCdma->cellIdentityCdma.networkId = | 
 | 2339 |                         rillCellInfo->CellInfo.cdma.cellIdentityCdma.networkId; | 
 | 2340 |                 cellInfoCdma->cellIdentityCdma.systemId = | 
 | 2341 |                         rillCellInfo->CellInfo.cdma.cellIdentityCdma.systemId; | 
 | 2342 |                 cellInfoCdma->cellIdentityCdma.baseStationId = | 
 | 2343 |                         rillCellInfo->CellInfo.cdma.cellIdentityCdma.basestationId; | 
 | 2344 |                 cellInfoCdma->cellIdentityCdma.longitude = | 
 | 2345 |                         rillCellInfo->CellInfo.cdma.cellIdentityCdma.longitude; | 
 | 2346 |                 cellInfoCdma->cellIdentityCdma.latitude = | 
 | 2347 |                         rillCellInfo->CellInfo.cdma.cellIdentityCdma.latitude; | 
 | 2348 |                 cellInfoCdma->signalStrengthCdma.dbm = | 
 | 2349 |                         rillCellInfo->CellInfo.cdma.signalStrengthCdma.dbm; | 
 | 2350 |                 cellInfoCdma->signalStrengthCdma.ecio = | 
 | 2351 |                         rillCellInfo->CellInfo.cdma.signalStrengthCdma.ecio; | 
 | 2352 |                 cellInfoCdma->signalStrengthEvdo.dbm = | 
 | 2353 |                         rillCellInfo->CellInfo.cdma.signalStrengthEvdo.dbm; | 
 | 2354 |                 cellInfoCdma->signalStrengthEvdo.ecio = | 
 | 2355 |                         rillCellInfo->CellInfo.cdma.signalStrengthEvdo.ecio; | 
 | 2356 |                 cellInfoCdma->signalStrengthEvdo.signalNoiseRatio = | 
 | 2357 |                         rillCellInfo->CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio; | 
 | 2358 |                 break; | 
 | 2359 |             } | 
 | 2360 |  | 
 | 2361 |             case RIL_CELL_INFO_TYPE_LTE: { | 
 | 2362 |                 records[i].lte.resize(1); | 
 | 2363 |                 CellInfoLte *cellInfoLte = &records[i].lte[0]; | 
 | 2364 |                 cellInfoLte->cellIdentityLte.mcc = | 
 | 2365 |                         std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mcc); | 
 | 2366 |                 cellInfoLte->cellIdentityLte.mnc = | 
 | 2367 |                         std::to_string(rillCellInfo->CellInfo.lte.cellIdentityLte.mnc); | 
 | 2368 |                 cellInfoLte->cellIdentityLte.ci = | 
 | 2369 |                         rillCellInfo->CellInfo.lte.cellIdentityLte.ci; | 
 | 2370 |                 cellInfoLte->cellIdentityLte.pci = | 
 | 2371 |                         rillCellInfo->CellInfo.lte.cellIdentityLte.pci; | 
 | 2372 |                 cellInfoLte->cellIdentityLte.tac = | 
 | 2373 |                         rillCellInfo->CellInfo.lte.cellIdentityLte.tac; | 
 | 2374 |                 cellInfoLte->cellIdentityLte.earfcn = | 
 | 2375 |                         rillCellInfo->CellInfo.lte.cellIdentityLte.earfcn; | 
 | 2376 |                 cellInfoLte->signalStrengthLte.signalStrength = | 
 | 2377 |                         rillCellInfo->CellInfo.lte.signalStrengthLte.signalStrength; | 
 | 2378 |                 cellInfoLte->signalStrengthLte.rsrp = | 
 | 2379 |                         rillCellInfo->CellInfo.lte.signalStrengthLte.rsrp; | 
 | 2380 |                 cellInfoLte->signalStrengthLte.rsrq = | 
 | 2381 |                         rillCellInfo->CellInfo.lte.signalStrengthLte.rsrq; | 
 | 2382 |                 cellInfoLte->signalStrengthLte.rssnr = | 
 | 2383 |                         rillCellInfo->CellInfo.lte.signalStrengthLte.rssnr; | 
 | 2384 |                 cellInfoLte->signalStrengthLte.cqi = | 
 | 2385 |                         rillCellInfo->CellInfo.lte.signalStrengthLte.cqi; | 
 | 2386 |                 cellInfoLte->signalStrengthLte.timingAdvance = | 
 | 2387 |                         rillCellInfo->CellInfo.lte.signalStrengthLte.timingAdvance; | 
 | 2388 |                 break; | 
 | 2389 |             } | 
 | 2390 |  | 
 | 2391 |             case RIL_CELL_INFO_TYPE_TD_SCDMA: { | 
 | 2392 |                 records[i].tdscdma.resize(1); | 
 | 2393 |                 CellInfoTdscdma *cellInfoTdscdma = &records[i].tdscdma[0]; | 
 | 2394 |                 cellInfoTdscdma->cellIdentityTdscdma.mcc = | 
 | 2395 |                         std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mcc); | 
 | 2396 |                 cellInfoTdscdma->cellIdentityTdscdma.mnc = | 
 | 2397 |                         std::to_string(rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.mnc); | 
 | 2398 |                 cellInfoTdscdma->cellIdentityTdscdma.lac = | 
 | 2399 |                         rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.lac; | 
 | 2400 |                 cellInfoTdscdma->cellIdentityTdscdma.cid = | 
 | 2401 |                         rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.cid; | 
 | 2402 |                 cellInfoTdscdma->cellIdentityTdscdma.cpid = | 
 | 2403 |                         rillCellInfo->CellInfo.tdscdma.cellIdentityTdscdma.cpid; | 
 | 2404 |                 cellInfoTdscdma->signalStrengthTdscdma.rscp = | 
 | 2405 |                         rillCellInfo->CellInfo.tdscdma.signalStrengthTdscdma.rscp; | 
 | 2406 |                 break; | 
 | 2407 |             } | 
 | 2408 |         } | 
 | 2409 |         rillCellInfo += 1; | 
 | 2410 |     } | 
 | 2411 | } | 
 | 2412 |  | 
 | 2413 | int radio::cellInfoListInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2414 |                            int indicationType, int token, RIL_Errno e, void *response, | 
 | 2415 |                            size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2416 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2417 |         if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) { | 
 | 2418 |             RLOGE("radio::cellInfoListInd: invalid response"); | 
 | 2419 |             return 0; | 
 | 2420 |         } | 
 | 2421 |  | 
 | 2422 |         hidl_vec<CellInfo> records; | 
 | 2423 |         convertRilCellInfoListToHal(response, responseLen, records); | 
 | 2424 |  | 
 | 2425 |         RLOGD("radio::cellInfoListInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2426 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->cellInfoList( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2427 |                 convertIntToRadioIndicationType(indicationType), records); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2428 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2429 |     } else { | 
 | 2430 |         RLOGE("radio::cellInfoListInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2431 |     } | 
 | 2432 |  | 
 | 2433 |     return 0; | 
 | 2434 | } | 
 | 2435 |  | 
 | 2436 | int radio::imsNetworkStateChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2437 |                                      int indicationType, int token, RIL_Errno e, void *response, | 
 | 2438 |                                      size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2439 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2440 |         RLOGD("radio::imsNetworkStateChangedInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2441 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->imsNetworkStateChanged( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2442 |                 convertIntToRadioIndicationType(indicationType)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2443 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2444 |     } else { | 
 | 2445 |         RLOGE("radio::imsNetworkStateChangedInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2446 |                 slotId); | 
 | 2447 |     } | 
 | 2448 |  | 
 | 2449 |     return 0; | 
 | 2450 | } | 
 | 2451 |  | 
 | 2452 | int radio::subscriptionStatusChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2453 |                                         int indicationType, int token, RIL_Errno e, void *response, | 
 | 2454 |                                         size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2455 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2456 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 2457 |             RLOGE("radio::subscriptionStatusChangedInd: invalid response"); | 
 | 2458 |             return 0; | 
 | 2459 |         } | 
 | 2460 |         bool activate = ((int32_t *) response)[0]; | 
 | 2461 |         RLOGD("radio::subscriptionStatusChangedInd: activate %d", activate); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2462 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->subscriptionStatusChanged( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2463 |                 convertIntToRadioIndicationType(indicationType), activate); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2464 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2465 |     } else { | 
 | 2466 |         RLOGE("radio::subscriptionStatusChangedInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2467 |                 slotId); | 
 | 2468 |     } | 
 | 2469 |  | 
 | 2470 |     return 0; | 
 | 2471 | } | 
 | 2472 |  | 
 | 2473 | int radio::srvccStateNotifyInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2474 |                                int indicationType, int token, RIL_Errno e, void *response, | 
 | 2475 |                                size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2476 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2477 |         if (response == NULL || responseLen != sizeof(int)) { | 
 | 2478 |             RLOGE("radio::srvccStateNotifyInd: invalid response"); | 
 | 2479 |             return 0; | 
 | 2480 |         } | 
 | 2481 |         int32_t state = ((int32_t *) response)[0]; | 
 | 2482 |         RLOGD("radio::srvccStateNotifyInd: rat %d", state); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2483 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->srvccStateNotify( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2484 |                 convertIntToRadioIndicationType(indicationType), (SrvccState) state); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2485 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2486 |     } else { | 
 | 2487 |         RLOGE("radio::srvccStateNotifyInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2488 |     } | 
 | 2489 |  | 
 | 2490 |     return 0; | 
 | 2491 | } | 
 | 2492 |  | 
 | 2493 | void convertRilHardwareConfigListToHal(void *response, size_t responseLen, | 
 | 2494 |         hidl_vec<HardwareConfig>& records) { | 
 | 2495 |     int num = responseLen / sizeof(RIL_HardwareConfig); | 
 | 2496 |     records.resize(num); | 
 | 2497 |  | 
 | 2498 |     RIL_HardwareConfig *rilHardwareConfig = (RIL_HardwareConfig *) response; | 
 | 2499 |     for (int i = 0; i < num; i++) { | 
 | 2500 |         records[i].type = (HardwareConfigType) rilHardwareConfig[i].type; | 
 | 2501 |         records[i].uuid = convertCharPtrToHidlString(rilHardwareConfig[i].uuid); | 
 | 2502 |         records[i].state = (HardwareConfigState) rilHardwareConfig[i].state; | 
 | 2503 |         switch (rilHardwareConfig[i].type) { | 
 | 2504 |             case RIL_HARDWARE_CONFIG_MODEM: { | 
 | 2505 |                 records[i].modem.resize(1); | 
 | 2506 |                 HardwareConfigModem *hwConfigModem = &records[i].modem[0]; | 
 | 2507 |                 hwConfigModem->rat = rilHardwareConfig[i].cfg.modem.rat; | 
 | 2508 |                 hwConfigModem->maxVoice = rilHardwareConfig[i].cfg.modem.maxVoice; | 
 | 2509 |                 hwConfigModem->maxData = rilHardwareConfig[i].cfg.modem.maxData; | 
 | 2510 |                 hwConfigModem->maxStandby = rilHardwareConfig[i].cfg.modem.maxStandby; | 
 | 2511 |                 break; | 
 | 2512 |             } | 
 | 2513 |  | 
 | 2514 |             case RIL_HARDWARE_CONFIG_SIM: { | 
 | 2515 |                 records[i].sim.resize(1); | 
 | 2516 |                 records[i].sim[0].modemUuid = | 
 | 2517 |                         convertCharPtrToHidlString(rilHardwareConfig[i].cfg.sim.modemUuid); | 
 | 2518 |                 break; | 
 | 2519 |             } | 
 | 2520 |         } | 
 | 2521 |     } | 
 | 2522 | } | 
 | 2523 |  | 
 | 2524 | int radio::hardwareConfigChangedInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2525 |                                     int indicationType, int token, RIL_Errno e, void *response, | 
 | 2526 |                                     size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2527 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2528 |         if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) { | 
 | 2529 |             RLOGE("radio::hardwareConfigChangedInd: invalid response"); | 
 | 2530 |             return 0; | 
 | 2531 |         } | 
 | 2532 |  | 
 | 2533 |         hidl_vec<HardwareConfig> configs; | 
 | 2534 |         convertRilHardwareConfigListToHal(response, responseLen, configs); | 
 | 2535 |  | 
 | 2536 |         RLOGD("radio::hardwareConfigChangedInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2537 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->hardwareConfigChanged( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2538 |                 convertIntToRadioIndicationType(indicationType), configs); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2539 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2540 |     } else { | 
 | 2541 |         RLOGE("radio::hardwareConfigChangedInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2542 |                 slotId); | 
 | 2543 |     } | 
 | 2544 |  | 
 | 2545 |     return 0; | 
 | 2546 | } | 
 | 2547 |  | 
 | 2548 | void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc) { | 
 | 2549 |     RIL_RadioCapability *rilRadioCapability = (RIL_RadioCapability *) response; | 
 | 2550 |     rc.session = rilRadioCapability->session; | 
 | 2551 |     rc.phase = (android::hardware::radio::V1_0::RadioCapabilityPhase) rilRadioCapability->phase; | 
 | 2552 |     rc.raf = rilRadioCapability->rat; | 
 | 2553 |     rc.logicalModemUuid = convertCharPtrToHidlString(rilRadioCapability->logicalModemUuid); | 
 | 2554 |     rc.status = (android::hardware::radio::V1_0::RadioCapabilityStatus) rilRadioCapability->status; | 
 | 2555 | } | 
 | 2556 |  | 
 | 2557 | int radio::radioCapabilityIndicationInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2558 |                                         int indicationType, int token, RIL_Errno e, void *response, | 
 | 2559 |                                         size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2560 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2561 |         if (response == NULL || responseLen != sizeof(RIL_RadioCapability)) { | 
 | 2562 |             RLOGE("radio::radioCapabilityIndicationInd: invalid response"); | 
 | 2563 |             return 0; | 
 | 2564 |         } | 
 | 2565 |  | 
 | 2566 |         RadioCapability rc; | 
 | 2567 |         convertRilRadioCapabilityToHal(response, responseLen, rc); | 
 | 2568 |  | 
 | 2569 |         RLOGD("radio::radioCapabilityIndicationInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2570 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->radioCapabilityIndication( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2571 |                 convertIntToRadioIndicationType(indicationType), rc); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2572 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2573 |     } else { | 
 | 2574 |         RLOGE("radio::radioCapabilityIndicationInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2575 |                 slotId); | 
 | 2576 |     } | 
 | 2577 |  | 
 | 2578 |     return 0; | 
 | 2579 | } | 
 | 2580 |  | 
 | 2581 | bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType) { | 
 | 2582 |     if ((reqType == SS_INTERROGATION) && | 
 | 2583 |         (serType == SS_CFU || | 
 | 2584 |          serType == SS_CF_BUSY || | 
 | 2585 |          serType == SS_CF_NO_REPLY || | 
 | 2586 |          serType == SS_CF_NOT_REACHABLE || | 
 | 2587 |          serType == SS_CF_ALL || | 
 | 2588 |          serType == SS_CF_ALL_CONDITIONAL)) { | 
 | 2589 |         return true; | 
 | 2590 |     } | 
 | 2591 |     return false; | 
 | 2592 | } | 
 | 2593 |  | 
 | 2594 | int radio::onSupplementaryServiceIndicationInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2595 |                                                int indicationType, int token, RIL_Errno e, | 
 | 2596 |                                                void *response, size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2597 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2598 |         if (response == NULL || responseLen != sizeof(RIL_StkCcUnsolSsResponse)) { | 
 | 2599 |             RLOGE("radio::onSupplementaryServiceIndicationInd: invalid response"); | 
 | 2600 |             return 0; | 
 | 2601 |         } | 
 | 2602 |  | 
 | 2603 |         RIL_StkCcUnsolSsResponse *rilSsResponse = (RIL_StkCcUnsolSsResponse *) response; | 
 | 2604 |         StkCcUnsolSsResult ss; | 
 | 2605 |         ss.serviceType = (SsServiceType) rilSsResponse->serviceType; | 
 | 2606 |         ss.requestType = (SsRequestType) rilSsResponse->requestType; | 
 | 2607 |         ss.teleserviceType = (SsTeleserviceType) rilSsResponse->teleserviceType; | 
 | 2608 |         ss.serviceClass = rilSsResponse->serviceClass; | 
 | 2609 |         ss.result = (RadioError) rilSsResponse->result; | 
 | 2610 |  | 
 | 2611 |         if (isServiceTypeCfQuery(rilSsResponse->serviceType, rilSsResponse->requestType)) { | 
 | 2612 |             RLOGD("radio::onSupplementaryServiceIndicationInd CF type, num of Cf elements %d", | 
 | 2613 |                     rilSsResponse->cfData.numValidIndexes); | 
 | 2614 |             if (rilSsResponse->cfData.numValidIndexes > NUM_SERVICE_CLASSES) { | 
 | 2615 |                 RLOGE("radio::onSupplementaryServiceIndicationInd numValidIndexes is greater than " | 
 | 2616 |                         "max value %d, truncating it to max value", NUM_SERVICE_CLASSES); | 
 | 2617 |                 rilSsResponse->cfData.numValidIndexes = NUM_SERVICE_CLASSES; | 
 | 2618 |             } | 
 | 2619 |  | 
 | 2620 |             ss.cfData.resize(1); | 
 | 2621 |  | 
 | 2622 |             /* number of call info's */ | 
 | 2623 |             ss.cfData[0].cfInfo.resize(rilSsResponse->cfData.numValidIndexes); | 
 | 2624 |  | 
 | 2625 |             for (int i = 0; i < rilSsResponse->cfData.numValidIndexes; i++) { | 
 | 2626 |                  RIL_CallForwardInfo cf = rilSsResponse->cfData.cfInfo[i]; | 
 | 2627 |                  CallForwardInfo *cfInfo = &ss.cfData[0].cfInfo[i]; | 
 | 2628 |  | 
 | 2629 |                  cfInfo->status = (CallForwardInfoStatus) cf.status; | 
 | 2630 |                  cfInfo->reason = cf.reason; | 
 | 2631 |                  cfInfo->serviceClass = cf.serviceClass; | 
 | 2632 |                  cfInfo->toa = cf.toa; | 
 | 2633 |                  cfInfo->number = convertCharPtrToHidlString(cf.number); | 
 | 2634 |                  cfInfo->timeSeconds = cf.timeSeconds; | 
 | 2635 |                  RLOGD("radio::onSupplementaryServiceIndicationInd: " | 
 | 2636 |                         "Data: %d,reason=%d,cls=%d,toa=%d,num=%s,tout=%d],", cf.status, | 
 | 2637 |                         cf.reason, cf.serviceClass, cf.toa, (char*)cf.number, cf.timeSeconds); | 
 | 2638 |             } | 
 | 2639 |         } else { | 
 | 2640 |             ss.ssInfo.resize(1); | 
 | 2641 |  | 
 | 2642 |             /* each int */ | 
 | 2643 |             ss.ssInfo[0].ssInfo.resize(SS_INFO_MAX); | 
 | 2644 |             for (int i = 0; i < SS_INFO_MAX; i++) { | 
 | 2645 |                  RLOGD("radio::onSupplementaryServiceIndicationInd: Data: %d", | 
 | 2646 |                         rilSsResponse->ssInfo[i]); | 
 | 2647 |                  ss.ssInfo[0].ssInfo[i] = rilSsResponse->ssInfo[i]; | 
 | 2648 |             } | 
 | 2649 |         } | 
 | 2650 |  | 
 | 2651 |         RLOGD("radio::onSupplementaryServiceIndicationInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2652 |         Return<void> retStatus = radioService[slotId]->mRadioIndication-> | 
 | 2653 |                 onSupplementaryServiceIndication(convertIntToRadioIndicationType(indicationType), | 
 | 2654 |                 ss); | 
 | 2655 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2656 |     } else { | 
 | 2657 |         RLOGE("radio::onSupplementaryServiceIndicationInd: " | 
 | 2658 |                 "radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2659 |     } | 
 | 2660 |  | 
 | 2661 |     return 0; | 
 | 2662 | } | 
 | 2663 |  | 
 | 2664 | int radio::stkCallControlAlphaNotifyInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2665 |                                         int indicationType, int token, RIL_Errno e, void *response, | 
 | 2666 |                                         size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2667 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2668 |         if (response == NULL || responseLen == 0) { | 
 | 2669 |             RLOGE("radio::stkCallControlAlphaNotifyInd: invalid response"); | 
 | 2670 |             return 0; | 
 | 2671 |         } | 
 | 2672 |         RLOGD("radio::stkCallControlAlphaNotifyInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2673 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->stkCallControlAlphaNotify( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2674 |                 convertIntToRadioIndicationType(indicationType), | 
 | 2675 |                 convertCharPtrToHidlString((char *) response)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2676 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2677 |     } else { | 
 | 2678 |         RLOGE("radio::stkCallControlAlphaNotifyInd: radioService[%d]->mRadioIndication == NULL", | 
 | 2679 |                 slotId); | 
 | 2680 |     } | 
 | 2681 |  | 
 | 2682 |     return 0; | 
 | 2683 | } | 
 | 2684 |  | 
 | 2685 | void convertRilLceDataInfoToHal(void *response, size_t responseLen, LceDataInfo& lce) { | 
 | 2686 |     RIL_LceDataInfo *rilLceDataInfo = (RIL_LceDataInfo *)response; | 
 | 2687 |     lce.lastHopCapacityKbps = rilLceDataInfo->last_hop_capacity_kbps; | 
 | 2688 |     lce.confidenceLevel = rilLceDataInfo->confidence_level; | 
 | 2689 |     lce.lceSuspended = rilLceDataInfo->lce_suspended; | 
 | 2690 | } | 
 | 2691 |  | 
 | 2692 | int radio::lceDataInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2693 |                       int indicationType, int token, RIL_Errno e, void *response, | 
 | 2694 |                       size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2695 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2696 |         if (response == NULL || responseLen != sizeof(RIL_LceDataInfo)) { | 
 | 2697 |             RLOGE("radio::lceDataInd: invalid response"); | 
 | 2698 |             return 0; | 
 | 2699 |         } | 
 | 2700 |  | 
 | 2701 |         LceDataInfo lce; | 
 | 2702 |         convertRilLceDataInfoToHal(response, responseLen, lce); | 
 | 2703 |         RLOGD("radio::lceDataInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2704 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->lceData( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2705 |                 convertIntToRadioIndicationType(indicationType), lce); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2706 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2707 |     } else { | 
 | 2708 |         RLOGE("radio::lceDataInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2709 |     } | 
 | 2710 |  | 
 | 2711 |     return 0; | 
 | 2712 | } | 
 | 2713 |  | 
 | 2714 | int radio::pcoDataInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2715 |                       int indicationType, int token, RIL_Errno e, void *response, | 
 | 2716 |                       size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2717 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2718 |         if (response == NULL || responseLen != sizeof(RIL_PCO_Data)) { | 
 | 2719 |             RLOGE("radio::pcoDataInd: invalid response"); | 
 | 2720 |             return 0; | 
 | 2721 |         } | 
 | 2722 |  | 
 | 2723 |         PcoDataInfo pco; | 
 | 2724 |         RIL_PCO_Data *rilPcoData = (RIL_PCO_Data *)response; | 
 | 2725 |         pco.cid = rilPcoData->cid; | 
 | 2726 |         pco.bearerProto = convertCharPtrToHidlString(rilPcoData->bearer_proto); | 
 | 2727 |         pco.pcoId = rilPcoData->pco_id; | 
 | 2728 |         pco.contents.setToExternal((uint8_t *) rilPcoData->contents, rilPcoData->contents_length); | 
 | 2729 |  | 
 | 2730 |         RLOGD("radio::pcoDataInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2731 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->pcoData( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2732 |                 convertIntToRadioIndicationType(indicationType), pco); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2733 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2734 |     } else { | 
 | 2735 |         RLOGE("radio::pcoDataInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2736 |     } | 
 | 2737 |  | 
 | 2738 |     return 0; | 
 | 2739 | } | 
 | 2740 |  | 
 | 2741 | int radio::modemResetInd(android::Parcel &p, int slotId, int requestNumber, | 
 | 2742 |                          int indicationType, int token, RIL_Errno e, void *response, | 
 | 2743 |                          size_t responseLen) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2744 |     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) { | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2745 |         if (response == NULL || responseLen == 0) { | 
 | 2746 |             RLOGE("radio::modemResetInd: invalid response"); | 
 | 2747 |             return 0; | 
 | 2748 |         } | 
 | 2749 |         RLOGD("radio::modemResetInd"); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2750 |         Return<void> retStatus = radioService[slotId]->mRadioIndication->modemReset( | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2751 |                 convertIntToRadioIndicationType(indicationType), | 
 | 2752 |                 convertCharPtrToHidlString((char *) response)); | 
| Amit Mahajan | 1724984 | 2017-01-19 15:05:45 -0800 | [diff] [blame] | 2753 |         radioService[slotId]->checkReturnStatus(retStatus); | 
| Amit Mahajan | 2fa9e63 | 2017-01-06 16:55:33 -0800 | [diff] [blame] | 2754 |     } else { | 
 | 2755 |         RLOGE("radio::modemResetInd: radioService[%d]->mRadioIndication == NULL", slotId); | 
 | 2756 |     } | 
 | 2757 |  | 
 | 2758 |     return 0; | 
 | 2759 | } | 
 | 2760 |  | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2761 | void radio::registerService(RIL_RadioFunctions *callbacks, CommandInfo *commands) { | 
 | 2762 |     using namespace android::hardware; | 
 | 2763 |     int simCount = 1; | 
 | 2764 |     char *serviceNames[] = { | 
 | 2765 |             android::RIL_getRilSocketName() | 
 | 2766 |             #if (SIM_COUNT >= 2) | 
 | 2767 |             , SOCKET2_NAME_RIL | 
 | 2768 |             #if (SIM_COUNT >= 3) | 
 | 2769 |             , SOCKET3_NAME_RIL | 
 | 2770 |             #if (SIM_COUNT >= 4) | 
 | 2771 |             , SOCKET4_NAME_RIL | 
 | 2772 |             #endif | 
 | 2773 |             #endif | 
 | 2774 |             #endif | 
 | 2775 |             }; | 
 | 2776 |  | 
 | 2777 |     #if (SIM_COUNT >= 2) | 
 | 2778 |     simCount = SIM_COUNT; | 
 | 2779 |     #endif | 
 | 2780 |  | 
 | 2781 |     configureRpcThreadpool(1, true /* callerWillJoin */); | 
 | 2782 |     for (int i = 0; i < simCount; i++) { | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2783 |         pthread_rwlock_t *radioServiceRwlockPtr = getRadioServiceRwlock(i); | 
 | 2784 |         int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); | 
 | 2785 |         assert(ret == 0); | 
 | 2786 |  | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2787 |         radioService[i] = new RadioImpl; | 
| Sanket Padawe | f220dc5 | 2017-01-02 23:46:00 -0800 | [diff] [blame] | 2788 |         radioService[i]->mSlotId = i; | 
| Amit Mahajan | 5829a47 | 2016-12-28 17:28:07 -0800 | [diff] [blame] | 2789 |         RLOGD("radio::registerService: starting IRadio %s", serviceNames[i]); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2790 |         android::status_t status = radioService[i]->registerAsService(serviceNames[i]); | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2791 |  | 
 | 2792 |         ret = pthread_rwlock_unlock(radioServiceRwlockPtr); | 
 | 2793 |         assert(ret == 0); | 
| Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame] | 2794 |     } | 
 | 2795 |  | 
 | 2796 |     s_callbacks = callbacks; | 
 | 2797 |     s_commands = commands; | 
 | 2798 | } | 
 | 2799 |  | 
 | 2800 | void rilc_thread_pool() { | 
 | 2801 |     joinRpcThreadpool(); | 
| Amit Mahajan | 932e08e | 2017-01-24 05:45:02 -0800 | [diff] [blame] | 2802 | } | 
 | 2803 |  | 
 | 2804 | pthread_rwlock_t * radio::getRadioServiceRwlock(int slotId) { | 
 | 2805 |     pthread_rwlock_t *radioServiceRwlockPtr = &radioServiceRwlock; | 
 | 2806 |  | 
 | 2807 |     #if (SIM_COUNT >= 2) | 
 | 2808 |     if (slotId == 2) radioServiceRwlockPtr = &radioServiceRwlock2; | 
 | 2809 |     #if (SIM_COUNT >= 3) | 
 | 2810 |     if (slotId == 3) radioServiceRwlockPtr = &radioServiceRwlock3; | 
 | 2811 |     #if (SIM_COUNT >= 4) | 
 | 2812 |     if (slotId == 4) radioServiceRwlockPtr = &radioServiceRwlock4; | 
 | 2813 |     #endif | 
 | 2814 |     #endif | 
 | 2815 |     #endif | 
 | 2816 |  | 
 | 2817 |     return radioServiceRwlockPtr; | 
| Wei Wang | 100ac9b | 2017-02-03 14:18:07 -0800 | [diff] [blame^] | 2818 | } |