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 package com.android.internal.telephony; 18 19 import android.content.Context; 20 import android.hardware.radio.V1_0.ActivityStatsInfo; 21 import android.hardware.radio.V1_0.AppStatus; 22 import android.hardware.radio.V1_0.CardStatus; 23 import android.hardware.radio.V1_0.Carrier; 24 import android.hardware.radio.V1_0.CarrierRestrictions; 25 import android.hardware.radio.V1_0.CdmaBroadcastSmsConfigInfo; 26 import android.hardware.radio.V1_0.DataRegStateResult; 27 import android.hardware.radio.V1_0.GsmBroadcastSmsConfigInfo; 28 import android.hardware.radio.V1_0.LastCallFailCauseInfo; 29 import android.hardware.radio.V1_0.LceDataInfo; 30 import android.hardware.radio.V1_0.LceStatusInfo; 31 import android.hardware.radio.V1_0.NeighboringCell; 32 import android.hardware.radio.V1_0.RadioError; 33 import android.hardware.radio.V1_0.RadioResponseInfo; 34 import android.hardware.radio.V1_0.RadioTechnologyFamily; 35 import android.hardware.radio.V1_0.SendSmsResult; 36 import android.hardware.radio.V1_0.VoiceRegStateResult; 37 import android.hardware.radio.V1_4.CarrierRestrictionsWithPriority; 38 import android.hardware.radio.V1_4.SimLockMultiSimPolicy; 39 import android.hardware.radio.V1_6.IRadioResponse; 40 import android.hardware.radio.V1_6.SetupDataCallResult; 41 import android.os.AsyncResult; 42 import android.os.Message; 43 import android.os.SystemClock; 44 import android.service.carrier.CarrierIdentifier; 45 import android.telephony.AccessNetworkConstants; 46 import android.telephony.AnomalyReporter; 47 import android.telephony.BarringInfo; 48 import android.telephony.CarrierRestrictionRules; 49 import android.telephony.CellInfo; 50 import android.telephony.LinkCapacityEstimate; 51 import android.telephony.ModemActivityInfo; 52 import android.telephony.NeighboringCellInfo; 53 import android.telephony.NetworkScanRequest; 54 import android.telephony.PhoneNumberUtils; 55 import android.telephony.RadioAccessFamily; 56 import android.telephony.RadioAccessSpecifier; 57 import android.telephony.SignalStrength; 58 import android.telephony.SubscriptionManager; 59 import android.telephony.TelephonyManager; 60 import android.telephony.data.DataCallResponse; 61 import android.telephony.data.NetworkSlicingConfig; 62 import android.text.TextUtils; 63 64 import com.android.internal.telephony.dataconnection.KeepaliveStatus; 65 import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; 66 import com.android.internal.telephony.uicc.AdnCapacity; 67 import com.android.internal.telephony.uicc.IccCardApplicationStatus; 68 import com.android.internal.telephony.uicc.IccCardStatus; 69 import com.android.internal.telephony.uicc.IccIoResult; 70 import com.android.internal.telephony.uicc.IccUtils; 71 72 import java.util.ArrayList; 73 import java.util.Collections; 74 import java.util.List; 75 import java.util.UUID; 76 77 public class RadioResponse extends IRadioResponse.Stub { 78 // The number of the required config values for broadcast SMS stored in the C struct 79 // RIL_CDMA_BroadcastServiceInfo 80 private static final int CDMA_BSI_NO_OF_INTS_STRUCT = 3; 81 82 private static final int CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES = 31; 83 84 private static final String RADIO_POWER_FAILURE_BUGREPORT_UUID = 85 "316f3801-fa21-4954-a42f-0041eada3b31"; 86 private static final String RADIO_POWER_FAILURE_RF_HARDWARE_ISSUE_UUID = 87 "316f3801-fa21-4954-a42f-0041eada3b32"; 88 private static final String RADIO_POWER_FAILURE_NO_RF_CALIBRATION_UUID = 89 "316f3801-fa21-4954-a42f-0041eada3b33"; 90 91 RIL mRil; 92 RadioResponse(RIL ril)93 public RadioResponse(RIL ril) { 94 mRil = ril; 95 } 96 97 /** 98 * Helper function to send response msg 99 * @param msg Response message to be sent 100 * @param ret Return object to be included in the response message 101 */ sendMessageResponse(Message msg, Object ret)102 static void sendMessageResponse(Message msg, Object ret) { 103 if (msg != null) { 104 AsyncResult.forMessage(msg, ret, null); 105 msg.sendToTarget(); 106 } 107 } 108 109 /** 110 * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for 111 * radio request which take long time to respond. 112 * For more details, refer https://source.android.com/devices/tech/connect/ril.html 113 * 114 * @param serial Serial no. of the request whose acknowledgement is sent. 115 */ acknowledgeRequest(int serial)116 public void acknowledgeRequest(int serial) { 117 mRil.processRequestAck(serial); 118 } 119 120 /** 121 * @param responseInfo Response info struct containing response type, serial no. and error 122 * @param cardStatus ICC card status as defined by CardStatus in types.hal 123 */ getIccCardStatusResponse(RadioResponseInfo responseInfo, CardStatus cardStatus)124 public void getIccCardStatusResponse(RadioResponseInfo responseInfo, CardStatus cardStatus) { 125 responseIccCardStatus(responseInfo, cardStatus); 126 } 127 128 /** 129 * @param responseInfo Response info struct containing response type, serial no. and error 130 * @param cardStatus ICC card status as defined by CardStatus in 1.2/types.hal 131 */ getIccCardStatusResponse_1_2(RadioResponseInfo responseInfo, android.hardware.radio.V1_2.CardStatus cardStatus)132 public void getIccCardStatusResponse_1_2(RadioResponseInfo responseInfo, 133 android.hardware.radio.V1_2.CardStatus cardStatus) { 134 responseIccCardStatus_1_2(responseInfo, cardStatus); 135 } 136 137 /** 138 * @param responseInfo Response info struct containing response type, serial no. and error 139 * @param cardStatus ICC card status as defined by CardStatus in 1.4/types.hal 140 */ getIccCardStatusResponse_1_4(RadioResponseInfo responseInfo, android.hardware.radio.V1_4.CardStatus cardStatus)141 public void getIccCardStatusResponse_1_4(RadioResponseInfo responseInfo, 142 android.hardware.radio.V1_4.CardStatus cardStatus) { 143 responseIccCardStatus_1_4(responseInfo, cardStatus); 144 } 145 146 /** 147 * @param responseInfo Response info struct containing response type, serial no. and error 148 * @param cardStatus ICC card status as defined by CardStatus in 1.5/types.hal 149 */ getIccCardStatusResponse_1_5(RadioResponseInfo responseInfo, android.hardware.radio.V1_5.CardStatus cardStatus)150 public void getIccCardStatusResponse_1_5(RadioResponseInfo responseInfo, 151 android.hardware.radio.V1_5.CardStatus cardStatus) { 152 responseIccCardStatus_1_5(responseInfo, cardStatus); 153 } 154 155 /** 156 * @param responseInfo Response info struct containing response type, serial no. and error 157 * @param remainingAttempts Number of retries remaining, must be equal to -1 if unknown. 158 */ supplyIccPinForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts)159 public void supplyIccPinForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts) { 160 responseInts(responseInfo, remainingAttempts); 161 } 162 163 /** 164 * @param responseInfo Response info struct containing response type, serial no. and error 165 * @param remainingAttempts Number of retries remaining, must be equal to -1 if unknown. 166 */ supplyIccPukForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts)167 public void supplyIccPukForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts) { 168 responseInts(responseInfo, remainingAttempts); 169 } 170 171 /** 172 * @param responseInfo Response info struct containing response type, serial no. and error 173 * @param remainingAttempts Number of retries remaining, must be equal to -1 if unknown. 174 */ supplyIccPin2ForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts)175 public void supplyIccPin2ForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts) { 176 responseInts(responseInfo, remainingAttempts); 177 } 178 179 /** 180 * @param responseInfo Response info struct containing response type, serial no. and error 181 * @param remainingAttempts Number of retries remaining, must be equal to -1 if unknown. 182 */ supplyIccPuk2ForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts)183 public void supplyIccPuk2ForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts) { 184 responseInts(responseInfo, remainingAttempts); 185 } 186 187 /** 188 * @param responseInfo Response info struct containing response type, serial no. and error 189 * @param remainingAttempts Number of retries remaining, must be equal to -1 if unknown. 190 */ changeIccPinForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts)191 public void changeIccPinForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts) { 192 responseInts(responseInfo, remainingAttempts); 193 } 194 195 /** 196 * @param responseInfo Response info struct containing response type, serial no. and error 197 * @param remainingAttempts Number of retries remaining, must be equal to -1 if unknown. 198 */ changeIccPin2ForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts)199 public void changeIccPin2ForAppResponse(RadioResponseInfo responseInfo, int remainingAttempts) { 200 responseInts(responseInfo, remainingAttempts); 201 } 202 203 /** 204 * @param responseInfo Response info struct containing response type, serial no. and error 205 * @param retriesRemaining Number of retries remaining, must be equal to -1 if unknown. 206 */ supplyNetworkDepersonalizationResponse(RadioResponseInfo responseInfo, int retriesRemaining)207 public void supplyNetworkDepersonalizationResponse(RadioResponseInfo responseInfo, 208 int retriesRemaining) { 209 responseInts(responseInfo, retriesRemaining); 210 } 211 212 213 /** 214 * @param info Response info struct containing response type, serial no. and error 215 * @param persoType SIM Personalisation type 216 * @param remainingRetries postiive values indicates number of retries remaining, 217 * must be equal to -1 if number of retries is infinite. 218 */ supplySimDepersonalizationResponse(RadioResponseInfo info, int persoType, int remainingRetries)219 public void supplySimDepersonalizationResponse(RadioResponseInfo info, 220 int persoType, int remainingRetries) { 221 responseInts(info, persoType, remainingRetries); 222 } 223 224 /** 225 * @param responseInfo Response info struct containing response type, serial no. and error 226 * @param calls Current call list 227 */ getCurrentCallsResponse(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.Call> calls)228 public void getCurrentCallsResponse(RadioResponseInfo responseInfo, 229 ArrayList<android.hardware.radio.V1_0.Call> calls) { 230 responseCurrentCalls(responseInfo, calls); 231 } 232 233 /** 234 * @param responseInfo Response info struct containing response type, serial no. and error 235 * @param calls Current call list 236 */ getCurrentCallsResponse_1_2(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.Call> calls)237 public void getCurrentCallsResponse_1_2(RadioResponseInfo responseInfo, 238 ArrayList<android.hardware.radio.V1_2.Call> calls) { 239 responseCurrentCalls_1_2(responseInfo, calls); 240 } 241 242 /** 243 * @param responseInfo Response info struct containing response type, serial no. and error 244 * @param calls Current call list 245 */ getCurrentCallsResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_6.Call> calls)246 public void getCurrentCallsResponse_1_6( 247 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 248 ArrayList<android.hardware.radio.V1_6.Call> calls) { 249 responseCurrentCalls_1_6(responseInfo, calls); 250 } 251 252 /** 253 * @param responseInfo Response info struct containing response type, serial no. and error 254 */ dialResponse(RadioResponseInfo responseInfo)255 public void dialResponse(RadioResponseInfo responseInfo) { 256 responseVoid(responseInfo); 257 } 258 259 /** 260 * @param responseInfo Response info struct containing response type, serial no. and error 261 * @param imsi String containing the IMSI 262 */ getIMSIForAppResponse(RadioResponseInfo responseInfo, String imsi)263 public void getIMSIForAppResponse(RadioResponseInfo responseInfo, String imsi) { 264 responseString(responseInfo, imsi); 265 } 266 267 /** 268 * @param responseInfo Response info struct containing response type, serial no. and error 269 */ hangupConnectionResponse(RadioResponseInfo responseInfo)270 public void hangupConnectionResponse(RadioResponseInfo responseInfo) { 271 responseVoid(responseInfo); 272 } 273 274 /** 275 * @param responseInfo Response info struct containing response type, serial no. and error 276 */ hangupWaitingOrBackgroundResponse(RadioResponseInfo responseInfo)277 public void hangupWaitingOrBackgroundResponse(RadioResponseInfo responseInfo) { 278 responseVoid(responseInfo); 279 } 280 281 /** 282 * @param responseInfo Response info struct containing response type, serial no. and error 283 */ hangupForegroundResumeBackgroundResponse(RadioResponseInfo responseInfo)284 public void hangupForegroundResumeBackgroundResponse(RadioResponseInfo responseInfo) { 285 responseVoid(responseInfo); 286 } 287 288 /** 289 * @param responseInfo Response info struct containing response type, serial no. and error 290 */ switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo responseInfo)291 public void switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo responseInfo) { 292 responseVoid(responseInfo); 293 } 294 295 /** 296 * @param responseInfo Response info struct containing response type, serial no. and error 297 */ conferenceResponse(RadioResponseInfo responseInfo)298 public void conferenceResponse(RadioResponseInfo responseInfo) { 299 responseVoid(responseInfo); 300 } 301 302 /** 303 * @param responseInfo Response info struct containing response type, serial no. and error 304 */ rejectCallResponse(RadioResponseInfo responseInfo)305 public void rejectCallResponse(RadioResponseInfo responseInfo) { 306 responseVoid(responseInfo); 307 } 308 309 /** 310 * @param responseInfo Response info struct containing response type, serial no. and error 311 * @param fcInfo Contains LastCallFailCause and vendor cause code. GSM failure reasons 312 * are mapped to cause codes defined in TS 24.008 Annex H where possible. CDMA 313 * failure reasons are derived from the possible call failure scenarios 314 * described in the "CDMA IS-2000 Release A (C.S0005-A v6.0)" standard. 315 */ getLastCallFailCauseResponse(RadioResponseInfo responseInfo, LastCallFailCauseInfo fcInfo)316 public void getLastCallFailCauseResponse(RadioResponseInfo responseInfo, 317 LastCallFailCauseInfo fcInfo) { 318 responseLastCallFailCauseInfo(responseInfo, fcInfo); 319 } 320 getSignalStrengthResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.SignalStrength sigStrength)321 public void getSignalStrengthResponse(RadioResponseInfo responseInfo, 322 android.hardware.radio.V1_0.SignalStrength sigStrength) { 323 responseSignalStrength(responseInfo, sigStrength); 324 } 325 326 /** 327 * @param responseInfo Response info struct containing response type, serial no. and error 328 * @param signalStrength Current signal strength of camped/connected cells 329 */ getSignalStrengthResponse_1_2( RadioResponseInfo responseInfo, android.hardware.radio.V1_2.SignalStrength signalStrength)330 public void getSignalStrengthResponse_1_2( 331 RadioResponseInfo responseInfo, 332 android.hardware.radio.V1_2.SignalStrength signalStrength) { 333 responseSignalStrength_1_2(responseInfo, signalStrength); 334 } 335 336 /** 337 * @param responseInfo Response info struct containing response type, serial no. and error 338 * @param signalStrength Current signal strength of camped/connected cells 339 */ getSignalStrengthResponse_1_4( RadioResponseInfo responseInfo, android.hardware.radio.V1_4.SignalStrength signalStrength)340 public void getSignalStrengthResponse_1_4( 341 RadioResponseInfo responseInfo, 342 android.hardware.radio.V1_4.SignalStrength signalStrength) { 343 responseSignalStrength_1_4(responseInfo, signalStrength); 344 } 345 346 /** 347 * @param responseInfo Response info struct containing response type, serial no. and error 348 * @param signalStrength Current signal strength of camped/connected cells 349 */ getSignalStrengthResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, android.hardware.radio.V1_6.SignalStrength signalStrength)350 public void getSignalStrengthResponse_1_6( 351 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 352 android.hardware.radio.V1_6.SignalStrength signalStrength) { 353 responseSignalStrength_1_6(responseInfo, signalStrength); 354 } 355 356 /** 357 * @param responseInfo Response info struct containing response type, serial no. and error 358 * @param voiceRegResponse Current Voice registration response as defined by VoiceRegStateResult 359 * in types.hal 360 */ getVoiceRegistrationStateResponse(RadioResponseInfo responseInfo, VoiceRegStateResult voiceRegResponse)361 public void getVoiceRegistrationStateResponse(RadioResponseInfo responseInfo, 362 VoiceRegStateResult voiceRegResponse) { 363 RILRequest rr = mRil.processResponse(responseInfo); 364 365 if (rr != null) { 366 if (responseInfo.error == RadioError.NONE) { 367 sendMessageResponse(rr.mResult, voiceRegResponse); 368 } 369 mRil.processResponseDone(rr, responseInfo, voiceRegResponse); 370 } 371 } 372 373 /** 374 * @param responseInfo Response info struct containing response type, serial no. and error 375 * @param voiceRegResponse Current Voice registration response as defined by VoiceRegStateResult 376 * in 1.2/types.hal 377 */ getVoiceRegistrationStateResponse_1_2(RadioResponseInfo responseInfo, android.hardware.radio.V1_2.VoiceRegStateResult voiceRegResponse)378 public void getVoiceRegistrationStateResponse_1_2(RadioResponseInfo responseInfo, 379 android.hardware.radio.V1_2.VoiceRegStateResult voiceRegResponse) { 380 RILRequest rr = mRil.processResponse(responseInfo); 381 382 if (rr != null) { 383 if (responseInfo.error == RadioError.NONE) { 384 sendMessageResponse(rr.mResult, voiceRegResponse); 385 } 386 mRil.processResponseDone(rr, responseInfo, voiceRegResponse); 387 } 388 } 389 390 /** 391 * @param responseInfo Response info struct containing response type, serial no. and error 392 * @param voiceRegResponse Current Voice registration response as defined by VoiceRegStateResult 393 * in 1.5/types.hal 394 */ getVoiceRegistrationStateResponse_1_5(RadioResponseInfo responseInfo, android.hardware.radio.V1_5.RegStateResult voiceRegResponse)395 public void getVoiceRegistrationStateResponse_1_5(RadioResponseInfo responseInfo, 396 android.hardware.radio.V1_5.RegStateResult voiceRegResponse) { 397 RILRequest rr = mRil.processResponse(responseInfo); 398 if (rr == null) { 399 return; 400 } 401 402 if (responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED) { 403 // Move the data needed for fallback call from rr which will be released soon 404 final int request = rr.getRequest(); 405 final Message result = rr.getResult(); 406 407 mRil.mRilHandler.post(() -> { 408 mRil.setCompatVersion(request, RIL.RADIO_HAL_VERSION_1_4); 409 mRil.getVoiceRegistrationState(result); 410 }); 411 412 mRil.processResponseFallback(rr, responseInfo, voiceRegResponse); 413 return; 414 } else if (responseInfo.error == RadioError.NONE) { 415 sendMessageResponse(rr.mResult, voiceRegResponse); 416 } 417 mRil.processResponseDone(rr, responseInfo, voiceRegResponse); 418 } 419 420 /** 421 * @param responseInfo Response info struct containing response type, serial no. and error 422 * @param voiceRegResponse Current Voice registration response as defined by VoiceRegStateResult 423 * in 1.6/types.hal 424 */ getVoiceRegistrationStateResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, android.hardware.radio.V1_6.RegStateResult voiceRegResponse)425 public void getVoiceRegistrationStateResponse_1_6( 426 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 427 android.hardware.radio.V1_6.RegStateResult voiceRegResponse) { 428 RILRequest rr = mRil.processResponse_1_6(responseInfo); 429 if (rr != null) { 430 if (responseInfo.error == RadioError.NONE) { 431 sendMessageResponse(rr.mResult, voiceRegResponse); 432 } 433 mRil.processResponseDone_1_6(rr, responseInfo, voiceRegResponse); 434 } 435 } 436 437 /** 438 * @param responseInfo Response info struct containing response type, serial no. and error 439 * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in 440 * types.hal 441 */ getDataRegistrationStateResponse(RadioResponseInfo responseInfo, DataRegStateResult dataRegResponse)442 public void getDataRegistrationStateResponse(RadioResponseInfo responseInfo, 443 DataRegStateResult dataRegResponse) { 444 RILRequest rr = mRil.processResponse(responseInfo); 445 446 if (rr != null) { 447 if (responseInfo.error == RadioError.NONE) { 448 sendMessageResponse(rr.mResult, dataRegResponse); 449 } 450 mRil.processResponseDone(rr, responseInfo, dataRegResponse); 451 } 452 } 453 454 /** 455 * @param responseInfo Response info struct containing response type, serial no. and error 456 * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in 457 * 1.2/types.hal 458 */ getDataRegistrationStateResponse_1_2(RadioResponseInfo responseInfo, android.hardware.radio.V1_2.DataRegStateResult dataRegResponse)459 public void getDataRegistrationStateResponse_1_2(RadioResponseInfo responseInfo, 460 android.hardware.radio.V1_2.DataRegStateResult dataRegResponse) { 461 RILRequest rr = mRil.processResponse(responseInfo); 462 463 if (rr != null) { 464 if (responseInfo.error == RadioError.NONE) { 465 sendMessageResponse(rr.mResult, dataRegResponse); 466 } 467 mRil.processResponseDone(rr, responseInfo, dataRegResponse); 468 } 469 } 470 471 /** 472 * @param responseInfo Response info struct containing response type, serial no. and error 473 * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in 474 * 1.4/types.hal 475 */ getDataRegistrationStateResponse_1_4(RadioResponseInfo responseInfo, android.hardware.radio.V1_4.DataRegStateResult dataRegResponse)476 public void getDataRegistrationStateResponse_1_4(RadioResponseInfo responseInfo, 477 android.hardware.radio.V1_4.DataRegStateResult dataRegResponse) { 478 RILRequest rr = mRil.processResponse(responseInfo); 479 480 if (rr != null) { 481 if (responseInfo.error == RadioError.NONE) { 482 sendMessageResponse(rr.mResult, dataRegResponse); 483 } 484 mRil.processResponseDone(rr, responseInfo, dataRegResponse); 485 } 486 } 487 488 /** 489 * @param responseInfo Response info struct containing response type, serial no. and error 490 * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in 491 * 1.5/types.hal 492 */ getDataRegistrationStateResponse_1_5(RadioResponseInfo responseInfo, android.hardware.radio.V1_5.RegStateResult dataRegResponse)493 public void getDataRegistrationStateResponse_1_5(RadioResponseInfo responseInfo, 494 android.hardware.radio.V1_5.RegStateResult dataRegResponse) { 495 RILRequest rr = mRil.processResponse(responseInfo); 496 if (rr == null) { 497 return; 498 } 499 500 if (responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED) { 501 // Move the data needed for fallback call from rr which will be released soon 502 final int request = rr.getRequest(); 503 final Message result = rr.getResult(); 504 505 mRil.mRilHandler.post(() -> { 506 mRil.setCompatVersion(request, RIL.RADIO_HAL_VERSION_1_4); 507 mRil.getDataRegistrationState(result); 508 }); 509 510 mRil.processResponseFallback(rr, responseInfo, dataRegResponse); 511 return; 512 } else if (responseInfo.error == RadioError.NONE) { 513 sendMessageResponse(rr.mResult, dataRegResponse); 514 } 515 mRil.processResponseDone(rr, responseInfo, dataRegResponse); 516 } 517 518 /** 519 * @param responseInfo Response info struct containing response type, serial no. and error 520 * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in 521 * 1.6/types.hal 522 */ getDataRegistrationStateResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, android.hardware.radio.V1_6.RegStateResult dataRegResponse)523 public void getDataRegistrationStateResponse_1_6( 524 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 525 android.hardware.radio.V1_6.RegStateResult dataRegResponse) { 526 RILRequest rr = mRil.processResponse_1_6(responseInfo); 527 528 if (rr != null) { 529 if (responseInfo.error == RadioError.NONE) { 530 sendMessageResponse(rr.mResult, dataRegResponse); 531 } 532 mRil.processResponseDone_1_6(rr, responseInfo, dataRegResponse); 533 } 534 } 535 536 /** 537 * @param responseInfo Response info struct containing response type, serial no. and error 538 * @param longName is long alpha ONS or EONS or empty string if unregistered 539 * @param shortName is short alpha ONS or EONS or empty string if unregistered 540 * @param numeric is 5 or 6 digit numeric code (MCC + MNC) or empty string if unregistered 541 */ getOperatorResponse(RadioResponseInfo responseInfo, String longName, String shortName, String numeric)542 public void getOperatorResponse(RadioResponseInfo responseInfo, 543 String longName, 544 String shortName, 545 String numeric) { 546 responseStrings(responseInfo, longName, shortName, numeric); 547 } 548 549 /** 550 * @param responseInfo Response info struct containing response type, serial no. and error 551 */ setRadioPowerResponse(RadioResponseInfo responseInfo)552 public void setRadioPowerResponse(RadioResponseInfo responseInfo) { 553 responseVoid(responseInfo); 554 mRil.mLastRadioPowerResult = responseInfo.error; 555 } 556 557 /** 558 * @param responseInfo Response info struct containing response type, serial no. and error 559 */ sendDtmfResponse(RadioResponseInfo responseInfo)560 public void sendDtmfResponse(RadioResponseInfo responseInfo) { 561 responseVoid(responseInfo); 562 } 563 564 /** 565 * @param responseInfo Response info struct containing response type, serial no. and error 566 * @param sms Response to sms sent as defined by SendSmsResult in types.hal 567 */ sendSmsResponse(RadioResponseInfo responseInfo, SendSmsResult sms)568 public void sendSmsResponse(RadioResponseInfo responseInfo, 569 SendSmsResult sms) { 570 responseSms(responseInfo, sms); 571 } 572 573 /** 574 * @param responseInfo Response info struct containing response type, serial no. and error which 575 * is defined in 1.6/types.hal 576 * @param sms Response to sms sent as defined by SendSmsResult in types.hal 577 */ sendSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms)578 public void sendSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 579 SendSmsResult sms) { 580 responseSms_1_6(responseInfo, sms); 581 } 582 583 /** 584 * @param responseInfo Response info struct containing response type, serial no. and error 585 * @param sms Response to sms sent as defined by SendSmsResult in types.hal 586 */ sendSMSExpectMoreResponse(RadioResponseInfo responseInfo, SendSmsResult sms)587 public void sendSMSExpectMoreResponse(RadioResponseInfo responseInfo, 588 SendSmsResult sms) { 589 responseSms(responseInfo, sms); 590 } 591 592 /** 593 * @param responseInfo Response info struct containing response type, serial no. and error which 594 * is defined in 1.6/types.hal 595 * @param sms Response to sms sent as defined by SendSmsResult in 1.6/types.hal 596 */ sendSmsExpectMoreResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms)597 public void sendSmsExpectMoreResponse_1_6( 598 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 599 SendSmsResult sms) { 600 responseSms_1_6(responseInfo, sms); 601 } 602 603 /** 604 * @param responseInfo Response info struct containing response type, serial no. and error 605 * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in 606 * types.hal 607 */ setupDataCallResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.SetupDataCallResult setupDataCallResult)608 public void setupDataCallResponse(RadioResponseInfo responseInfo, 609 android.hardware.radio.V1_0.SetupDataCallResult setupDataCallResult) { 610 responseSetupDataCall(responseInfo, setupDataCallResult); 611 } 612 613 /** 614 * @param responseInfo Response info struct containing response type, serial no. and error 615 * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in 616 * 1.4/types.hal 617 */ setupDataCallResponse_1_4(RadioResponseInfo responseInfo, android.hardware.radio.V1_4.SetupDataCallResult setupDataCallResult)618 public void setupDataCallResponse_1_4(RadioResponseInfo responseInfo, 619 android.hardware.radio.V1_4.SetupDataCallResult setupDataCallResult) { 620 responseSetupDataCall(responseInfo, setupDataCallResult); 621 } 622 623 /** 624 * @param responseInfo Response info struct containing response type, serial no. and error 625 * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in 626 * 1.5/types.hal 627 */ setupDataCallResponse_1_5(RadioResponseInfo responseInfo, android.hardware.radio.V1_5.SetupDataCallResult setupDataCallResult)628 public void setupDataCallResponse_1_5(RadioResponseInfo responseInfo, 629 android.hardware.radio.V1_5.SetupDataCallResult setupDataCallResult) { 630 responseSetupDataCall(responseInfo, setupDataCallResult); 631 } 632 633 634 /** 635 * @param responseInfo Response info struct containing response type, serial no. and error 636 * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in 637 * 1.6/types.hal 638 */ setupDataCallResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, android.hardware.radio.V1_6.SetupDataCallResult setupDataCallResult)639 public void setupDataCallResponse_1_6( 640 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 641 android.hardware.radio.V1_6.SetupDataCallResult setupDataCallResult) { 642 responseSetupDataCall_1_6(responseInfo, setupDataCallResult); 643 } 644 645 @Override getDataCallListResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info, ArrayList<SetupDataCallResult> dcResponse)646 public void getDataCallListResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info, 647 ArrayList<SetupDataCallResult> dcResponse) { 648 responseDataCallList(info, dcResponse); 649 } 650 651 @Override setSimCardPowerResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info)652 public void setSimCardPowerResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info) { 653 responseVoid_1_6(info); 654 } 655 656 @Override setAllowedNetworkTypesBitmapResponse( android.hardware.radio.V1_6.RadioResponseInfo info)657 public void setAllowedNetworkTypesBitmapResponse( 658 android.hardware.radio.V1_6.RadioResponseInfo info) { 659 responseVoid_1_6(info); 660 } 661 662 @Override getAllowedNetworkTypesBitmapResponse( android.hardware.radio.V1_6.RadioResponseInfo info, int halRadioAccessFamilyBitmap)663 public void getAllowedNetworkTypesBitmapResponse( 664 android.hardware.radio.V1_6.RadioResponseInfo info, 665 int halRadioAccessFamilyBitmap) { 666 int networkTypeBitmask = RIL.convertToNetworkTypeBitMask(halRadioAccessFamilyBitmap); 667 mRil.mAllowedNetworkTypesBitmask = networkTypeBitmask; 668 responseInts_1_6(info, networkTypeBitmask); 669 } 670 671 /** 672 * @param responseInfo Response info struct containing response type, serial no. and error 673 * @param iccIo ICC io operation response as defined by IccIoResult in types.hal 674 */ iccIOForAppResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.IccIoResult iccIo)675 public void iccIOForAppResponse(RadioResponseInfo responseInfo, 676 android.hardware.radio.V1_0.IccIoResult iccIo) { 677 responseIccIo(responseInfo, iccIo); 678 } 679 680 /** 681 * @param responseInfo Response info struct containing response type, serial no. and error 682 */ sendUssdResponse(RadioResponseInfo responseInfo)683 public void sendUssdResponse(RadioResponseInfo responseInfo) { 684 responseVoid(responseInfo); 685 } 686 687 /** 688 * @param responseInfo Response info struct containing response type, serial no. and error 689 */ cancelPendingUssdResponse(RadioResponseInfo responseInfo)690 public void cancelPendingUssdResponse(RadioResponseInfo responseInfo) { 691 responseVoid(responseInfo); 692 } 693 694 /** 695 * @param responseInfo Response info struct containing response type, serial no. and error 696 * @param n is "n" parameter from TS 27.007 7.7 697 * @param m is "m" parameter from TS 27.007 7.7 698 */ getClirResponse(RadioResponseInfo responseInfo, int n, int m)699 public void getClirResponse(RadioResponseInfo responseInfo, int n, int m) { 700 responseInts(responseInfo, n, m); 701 } 702 703 /** 704 * @param responseInfo Response info struct containing response type, serial no. and error 705 */ setClirResponse(RadioResponseInfo responseInfo)706 public void setClirResponse(RadioResponseInfo responseInfo) { 707 responseVoid(responseInfo); 708 } 709 710 /** 711 * @param responseInfo Response info struct containing response type, serial no. and error 712 * @param callForwardInfos points to a vector of CallForwardInfo, one for 713 * each distinct registered phone number. 714 */ getCallForwardStatusResponse(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.CallForwardInfo> callForwardInfos)715 public void getCallForwardStatusResponse(RadioResponseInfo responseInfo, 716 ArrayList<android.hardware.radio.V1_0.CallForwardInfo> 717 callForwardInfos) { 718 responseCallForwardInfo(responseInfo, callForwardInfos); 719 } 720 721 /** 722 * @param responseInfo Response info struct containing response type, serial no. and error 723 */ setCallForwardResponse(RadioResponseInfo responseInfo)724 public void setCallForwardResponse(RadioResponseInfo responseInfo) { 725 responseVoid(responseInfo); 726 } 727 728 /** 729 * @param responseInfo Response info struct containing response type, serial no. and error 730 * @param enable If current call waiting state is disabled, enable = false else true 731 * @param serviceClass If enable, then callWaitingResp[1] 732 * must follow, with the TS 27.007 service class bit vector of services 733 * for which call waiting is enabled. 734 * For example, if callWaitingResp[0] is 1 and 735 * callWaitingResp[1] is 3, then call waiting is enabled for data 736 * and voice and disabled for everything else. 737 */ getCallWaitingResponse(RadioResponseInfo responseInfo, boolean enable, int serviceClass)738 public void getCallWaitingResponse(RadioResponseInfo responseInfo, 739 boolean enable, 740 int serviceClass) { 741 responseInts(responseInfo, enable ? 1 : 0, serviceClass); 742 } 743 744 /** 745 * @param responseInfo Response info struct containing response type, serial no. and error 746 */ setCallWaitingResponse(RadioResponseInfo responseInfo)747 public void setCallWaitingResponse(RadioResponseInfo responseInfo) { 748 responseVoid(responseInfo); 749 } 750 751 /** 752 * @param responseInfo Response info struct containing response type, serial no. and error 753 */ acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo responseInfo)754 public void acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo responseInfo) { 755 responseVoid(responseInfo); 756 } 757 758 /** 759 * @param responseInfo Response info struct containing response type, serial no. and error 760 */ acceptCallResponse(RadioResponseInfo responseInfo)761 public void acceptCallResponse(RadioResponseInfo responseInfo) { 762 responseVoid(responseInfo); 763 } 764 765 /** 766 * @param responseInfo Response info struct containing response type, serial no. and error 767 */ deactivateDataCallResponse(RadioResponseInfo responseInfo)768 public void deactivateDataCallResponse(RadioResponseInfo responseInfo) { 769 responseVoid(responseInfo); 770 } 771 772 /** 773 * 774 * @param responseInfo Response info struct containing response type, serial no. and error 775 * @param response 0 is the TS 27.007 service class bit vector of 776 * services for which the specified barring facility 777 * is active. "0" means "disabled for all" 778 */ getFacilityLockForAppResponse(RadioResponseInfo responseInfo, int response)779 public void getFacilityLockForAppResponse(RadioResponseInfo responseInfo, int response) { 780 responseInts(responseInfo, response); 781 } 782 783 /** 784 * 785 * @param responseInfo Response info struct containing response type, serial no. and error 786 * @param retry 0 is the number of retries remaining, or -1 if unknown 787 */ setFacilityLockForAppResponse(RadioResponseInfo responseInfo, int retry)788 public void setFacilityLockForAppResponse(RadioResponseInfo responseInfo, int retry) { 789 responseInts(responseInfo, retry); 790 } 791 792 /** 793 * @param responseInfo Response info struct containing response type, serial no. and error 794 */ setBarringPasswordResponse(RadioResponseInfo responseInfo)795 public void setBarringPasswordResponse(RadioResponseInfo responseInfo) { 796 responseVoid(responseInfo); 797 } 798 799 /** 800 * 801 * @param responseInfo Response info struct containing response type, serial no. and error 802 * @param selection false for automatic selection, true for manual selection 803 */ getNetworkSelectionModeResponse(RadioResponseInfo responseInfo, boolean selection)804 public void getNetworkSelectionModeResponse(RadioResponseInfo responseInfo, boolean selection) { 805 responseInts(responseInfo, selection ? 1 : 0); 806 } 807 808 /** 809 * @param responseInfo Response info struct containing response type, serial no. and error 810 */ setNetworkSelectionModeAutomaticResponse(RadioResponseInfo responseInfo)811 public void setNetworkSelectionModeAutomaticResponse(RadioResponseInfo responseInfo) { 812 responseVoid(responseInfo); 813 } 814 815 /** 816 * @param responseInfo Response info struct containing response type, serial no. and error 817 */ setNetworkSelectionModeManualResponse(RadioResponseInfo responseInfo)818 public void setNetworkSelectionModeManualResponse(RadioResponseInfo responseInfo) { 819 responseVoid(responseInfo); 820 } 821 822 /** 823 * @param responseInfo Response info struct containing response type, serial no. and error 824 */ setNetworkSelectionModeManualResponse_1_5(RadioResponseInfo responseInfo)825 public void setNetworkSelectionModeManualResponse_1_5(RadioResponseInfo responseInfo) { 826 responseVoid(responseInfo); 827 } 828 829 /** 830 * 831 * @param responseInfo Response info struct containing response type, serial no. and error 832 * @param networkInfos List of network operator information as OperatorInfos defined in 833 * types.hal 834 */ getAvailableNetworksResponse(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.OperatorInfo> networkInfos)835 public void getAvailableNetworksResponse(RadioResponseInfo responseInfo, 836 ArrayList<android.hardware.radio.V1_0.OperatorInfo> 837 networkInfos) { 838 responseOperatorInfos(responseInfo, networkInfos); 839 } 840 841 /** 842 * 843 * @param responseInfo Response info struct containing response type, serial no. and error 844 */ startNetworkScanResponse(RadioResponseInfo responseInfo)845 public void startNetworkScanResponse(RadioResponseInfo responseInfo) { 846 responseScanStatus(responseInfo, null /*fallbackHalVersion*/); 847 } 848 849 /** 850 * The same method as startNetworkScanResponse, except disallowing error codes 851 * OPERATION_NOT_ALLOWED. 852 * 853 * @param responseInfo Response info struct containing response type, serial no. and error 854 */ startNetworkScanResponse_1_4(RadioResponseInfo responseInfo)855 public void startNetworkScanResponse_1_4(RadioResponseInfo responseInfo) { 856 responseScanStatus(responseInfo, null /*fallbackHalVersion*/); 857 } 858 859 /** 860 * The same method as startNetworkScanResponse_1_4. 861 * 862 * @param responseInfo Response info struct containing response type, serial no. and error 863 */ startNetworkScanResponse_1_5(RadioResponseInfo responseInfo)864 public void startNetworkScanResponse_1_5(RadioResponseInfo responseInfo) { 865 responseScanStatus(responseInfo, RIL.RADIO_HAL_VERSION_1_4); 866 } 867 868 /** 869 * 870 * @param responseInfo Response info struct containing response type, serial no. and error 871 */ stopNetworkScanResponse(RadioResponseInfo responseInfo)872 public void stopNetworkScanResponse(RadioResponseInfo responseInfo) { 873 responseScanStatus(responseInfo, null /*fallbackHalVersion*/); 874 } 875 876 /** 877 * @param responseInfo Response info struct containing response type, serial no. and error 878 */ startDtmfResponse(RadioResponseInfo responseInfo)879 public void startDtmfResponse(RadioResponseInfo responseInfo) { 880 responseVoid(responseInfo); 881 } 882 883 /** 884 * @param responseInfo Response info struct containing response type, serial no. and error 885 */ stopDtmfResponse(RadioResponseInfo responseInfo)886 public void stopDtmfResponse(RadioResponseInfo responseInfo) { 887 responseVoid(responseInfo); 888 } 889 890 /** 891 * 892 * @param responseInfo Response info struct containing response type, serial no. and error 893 * @param version string containing version string for log reporting 894 */ getBasebandVersionResponse(RadioResponseInfo responseInfo, String version)895 public void getBasebandVersionResponse(RadioResponseInfo responseInfo, String version) { 896 responseString(responseInfo, version); 897 } 898 899 /** 900 * @param responseInfo Response info struct containing response type, serial no. and error 901 */ separateConnectionResponse(RadioResponseInfo responseInfo)902 public void separateConnectionResponse(RadioResponseInfo responseInfo) { 903 responseVoid(responseInfo); 904 } 905 906 /** 907 * @param responseInfo Response info struct containing response type, serial no. and error 908 */ setMuteResponse(RadioResponseInfo responseInfo)909 public void setMuteResponse(RadioResponseInfo responseInfo) { 910 responseVoid(responseInfo); 911 } 912 913 /** 914 * 915 * @param responseInfo Response info struct containing response type, serial no. and error 916 * @param enable true for "mute enabled" and false for "mute disabled" 917 */ getMuteResponse(RadioResponseInfo responseInfo, boolean enable)918 public void getMuteResponse(RadioResponseInfo responseInfo, boolean enable) { 919 responseInts(responseInfo, enable ? 1 : 0); 920 } 921 922 /** 923 * 924 * @param responseInfo Response info struct containing response type, serial no. and error 925 * @param status indicates CLIP status 926 */ getClipResponse(RadioResponseInfo responseInfo, int status)927 public void getClipResponse(RadioResponseInfo responseInfo, int status) { 928 responseInts(responseInfo, status); 929 } 930 931 /** 932 * @param responseInfo Response info struct containing response type, serial no. and error 933 * @param dataCallResultList Response to get data call list as defined by setupDataCallResult in 934 * types.hal 935 */ getDataCallListResponse(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.SetupDataCallResult> dataCallResultList)936 public void getDataCallListResponse(RadioResponseInfo responseInfo, 937 ArrayList<android.hardware.radio.V1_0.SetupDataCallResult> dataCallResultList) { 938 responseDataCallList(responseInfo, dataCallResultList); 939 } 940 941 /** 942 * @param responseInfo Response info struct containing response type, serial no. and error 943 * @param dataCallResultList Response to get data call list as defined by setupDataCallResult in 944 * 1.4/types.hal 945 */ getDataCallListResponse_1_4(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_4.SetupDataCallResult> dataCallResultList)946 public void getDataCallListResponse_1_4(RadioResponseInfo responseInfo, 947 ArrayList<android.hardware.radio.V1_4.SetupDataCallResult> dataCallResultList) { 948 responseDataCallList(responseInfo, dataCallResultList); 949 } 950 951 /** 952 * @param responseInfo Response info struct containing response type, serial no. and error 953 * @param dataCallResultList Response to get data call list as defined by setupDataCallResult in 954 * 1.5/types.hal 955 */ getDataCallListResponse_1_5(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_5.SetupDataCallResult> dataCallResultList)956 public void getDataCallListResponse_1_5(RadioResponseInfo responseInfo, 957 ArrayList<android.hardware.radio.V1_5.SetupDataCallResult> dataCallResultList) { 958 responseDataCallList(responseInfo, dataCallResultList); 959 } 960 sendOemRilRequestRawResponse(RadioResponseInfo responseInfo, ArrayList<Byte> var2)961 public void sendOemRilRequestRawResponse(RadioResponseInfo responseInfo, 962 ArrayList<Byte> var2) {} 963 964 /** 965 * @param responseInfo Response info struct containing response type, serial no. and error 966 */ setSuppServiceNotificationsResponse(RadioResponseInfo responseInfo)967 public void setSuppServiceNotificationsResponse(RadioResponseInfo responseInfo) { 968 responseVoid(responseInfo); 969 } 970 971 /** 972 * @param responseInfo Response info struct containing response type, serial no. and error 973 * @param index record index where the message is stored 974 */ writeSmsToSimResponse(RadioResponseInfo responseInfo, int index)975 public void writeSmsToSimResponse(RadioResponseInfo responseInfo, int index) { 976 responseInts(responseInfo, index); 977 } 978 979 /** 980 * @param responseInfo Response info struct containing response type, serial no. and error 981 */ deleteSmsOnSimResponse(RadioResponseInfo responseInfo)982 public void deleteSmsOnSimResponse(RadioResponseInfo responseInfo) { 983 responseVoid(responseInfo); 984 } 985 986 /** 987 * @param responseInfo Response info struct containing response type, serial no. and error 988 */ setBandModeResponse(RadioResponseInfo responseInfo)989 public void setBandModeResponse(RadioResponseInfo responseInfo) { 990 responseVoid(responseInfo); 991 } 992 993 /** 994 * 995 * @param responseInfo Response info struct containing response type, serial no. and error 996 * @param bandModes List of RadioBandMode listing supported modes 997 */ getAvailableBandModesResponse(RadioResponseInfo responseInfo, ArrayList<Integer> bandModes)998 public void getAvailableBandModesResponse(RadioResponseInfo responseInfo, 999 ArrayList<Integer> bandModes) { 1000 responseIntArrayList(responseInfo, bandModes); 1001 } 1002 1003 /** 1004 * 1005 * @param responseInfo Response info struct containing response type, serial no. and error 1006 * @param commandResponse SAT/USAT response in hexadecimal format 1007 * string starting with first byte of response 1008 */ sendEnvelopeResponse(RadioResponseInfo responseInfo, String commandResponse)1009 public void sendEnvelopeResponse(RadioResponseInfo responseInfo, String commandResponse) { 1010 responseString(responseInfo, commandResponse); 1011 } 1012 1013 /** 1014 * @param responseInfo Response info struct containing response type, serial no. and error 1015 */ sendTerminalResponseToSimResponse(RadioResponseInfo responseInfo)1016 public void sendTerminalResponseToSimResponse(RadioResponseInfo responseInfo) { 1017 responseVoid(responseInfo); 1018 } 1019 1020 /** 1021 * @param responseInfo Response info struct containing response type, serial no. and error 1022 */ handleStkCallSetupRequestFromSimResponse(RadioResponseInfo responseInfo)1023 public void handleStkCallSetupRequestFromSimResponse(RadioResponseInfo responseInfo) { 1024 responseVoid(responseInfo); 1025 } 1026 1027 /** 1028 * @param responseInfo Response info struct containing response type, serial no. and error 1029 */ explicitCallTransferResponse(RadioResponseInfo responseInfo)1030 public void explicitCallTransferResponse(RadioResponseInfo responseInfo) { 1031 responseVoid(responseInfo); 1032 } 1033 1034 /** 1035 * @param responseInfo Response info struct containing response type, serial no. and error 1036 */ setPreferredNetworkTypeResponse(RadioResponseInfo responseInfo)1037 public void setPreferredNetworkTypeResponse(RadioResponseInfo responseInfo) { 1038 responseVoid(responseInfo); 1039 } 1040 1041 /** 1042 * Callback of setPreferredNetworkTypeBitmap defined in IRadio.hal. 1043 * @param responseInfo Response info struct containing response type, serial no. and error 1044 */ setPreferredNetworkTypeBitmapResponse(RadioResponseInfo responseInfo)1045 public void setPreferredNetworkTypeBitmapResponse(RadioResponseInfo responseInfo) { 1046 responseVoid(responseInfo); 1047 } 1048 1049 /** 1050 * 1051 * @param responseInfo Response info struct containing response type, serial no. and error 1052 * @param nwType RadioPreferredNetworkType defined in types.hal 1053 */ getPreferredNetworkTypeResponse(RadioResponseInfo responseInfo, int nwType)1054 public void getPreferredNetworkTypeResponse(RadioResponseInfo responseInfo, int nwType) { 1055 mRil.mAllowedNetworkTypesBitmask = RadioAccessFamily.getRafFromNetworkType(nwType); 1056 responseInts(responseInfo, RadioAccessFamily.getRafFromNetworkType(nwType)); 1057 } 1058 1059 /** 1060 * Callback of the getPreferredNetworkTypeBitmap defined in the IRadio.hal. 1061 * @param responseInfo Response info struct containing response type, serial no. and error 1062 * @param halRadioAccessFamilyBitmap a 32-bit bitmap of 1063 * {@link android.hardware.radio.V1_0.RadioAccessFamily}. 1064 */ getPreferredNetworkTypeBitmapResponse( RadioResponseInfo responseInfo, int halRadioAccessFamilyBitmap)1065 public void getPreferredNetworkTypeBitmapResponse( 1066 RadioResponseInfo responseInfo, int halRadioAccessFamilyBitmap) { 1067 1068 int networkTypeBitmask = RIL.convertToNetworkTypeBitMask(halRadioAccessFamilyBitmap); 1069 mRil.mAllowedNetworkTypesBitmask = networkTypeBitmask; 1070 responseInts(responseInfo, networkTypeBitmask); 1071 } 1072 1073 /** 1074 * 1075 * @param responseInfo Response info struct containing response type, serial no. and error 1076 * @param cells Vector of neighboring radio cell information 1077 */ getNeighboringCidsResponse(RadioResponseInfo responseInfo, ArrayList<NeighboringCell> cells)1078 public void getNeighboringCidsResponse(RadioResponseInfo responseInfo, 1079 ArrayList<NeighboringCell> cells) { 1080 responseCellList(responseInfo, cells); 1081 } 1082 1083 /** 1084 * @param responseInfo Response info struct containing response type, serial no. and error 1085 */ setLocationUpdatesResponse(RadioResponseInfo responseInfo)1086 public void setLocationUpdatesResponse(RadioResponseInfo responseInfo) { 1087 responseVoid(responseInfo); 1088 } 1089 1090 /** 1091 * @param responseInfo Response info struct containing response type, serial no. and error 1092 */ setCdmaSubscriptionSourceResponse(RadioResponseInfo responseInfo)1093 public void setCdmaSubscriptionSourceResponse(RadioResponseInfo responseInfo) { 1094 responseVoid(responseInfo); 1095 } 1096 1097 /** 1098 * @param responseInfo Response info struct containing response type, serial no. and error 1099 */ setCdmaRoamingPreferenceResponse(RadioResponseInfo responseInfo)1100 public void setCdmaRoamingPreferenceResponse(RadioResponseInfo responseInfo) { 1101 responseVoid(responseInfo); 1102 } 1103 1104 /** 1105 * 1106 * @param responseInfo Response info struct containing response type, serial no. and error 1107 * @param type CdmaRoamingType defined in types.hal 1108 */ getCdmaRoamingPreferenceResponse(RadioResponseInfo responseInfo, int type)1109 public void getCdmaRoamingPreferenceResponse(RadioResponseInfo responseInfo, int type) { 1110 responseInts(responseInfo, type); 1111 } 1112 1113 /** 1114 * @param responseInfo Response info struct containing response type, serial no. and error 1115 */ setTTYModeResponse(RadioResponseInfo responseInfo)1116 public void setTTYModeResponse(RadioResponseInfo responseInfo) { 1117 responseVoid(responseInfo); 1118 } 1119 1120 /** 1121 * 1122 * @param responseInfo Response info struct containing response type, serial no. and error 1123 * @param mode TTY mode 1124 */ getTTYModeResponse(RadioResponseInfo responseInfo, int mode)1125 public void getTTYModeResponse(RadioResponseInfo responseInfo, int mode) { 1126 responseInts(responseInfo, mode); 1127 } 1128 1129 /** 1130 * @param responseInfo Response info struct containing response type, serial no. and error 1131 */ setPreferredVoicePrivacyResponse(RadioResponseInfo responseInfo)1132 public void setPreferredVoicePrivacyResponse(RadioResponseInfo responseInfo) { 1133 responseVoid(responseInfo); 1134 } 1135 1136 /** 1137 * 1138 * @param responseInfo Response info struct containing response type, serial no. and error 1139 * @param enable false for Standard Privacy Mode (Public Long Code Mask) 1140 * true for Enhanced Privacy Mode (Private Long Code Mask) 1141 */ getPreferredVoicePrivacyResponse(RadioResponseInfo responseInfo, boolean enable)1142 public void getPreferredVoicePrivacyResponse(RadioResponseInfo responseInfo, 1143 boolean enable) { 1144 responseInts(responseInfo, enable ? 1 : 0); 1145 } 1146 1147 /** 1148 * @param responseInfo Response info struct containing response type, serial no. and error 1149 */ sendCDMAFeatureCodeResponse(RadioResponseInfo responseInfo)1150 public void sendCDMAFeatureCodeResponse(RadioResponseInfo responseInfo) { 1151 responseVoid(responseInfo); 1152 } 1153 1154 /** 1155 * @param responseInfo Response info struct containing response type, serial no. and error 1156 */ sendBurstDtmfResponse(RadioResponseInfo responseInfo)1157 public void sendBurstDtmfResponse(RadioResponseInfo responseInfo) { 1158 responseVoid(responseInfo); 1159 } 1160 1161 /** 1162 * 1163 * @param responseInfo Response info struct containing response type, serial no. and error 1164 * @param sms Sms result struct as defined by SendSmsResult in types.hal 1165 */ sendCdmaSmsResponse(RadioResponseInfo responseInfo, SendSmsResult sms)1166 public void sendCdmaSmsResponse(RadioResponseInfo responseInfo, SendSmsResult sms) { 1167 responseSms(responseInfo, sms); 1168 } 1169 1170 /** 1171 * 1172 * @param responseInfo Response info struct containing response type, serial no. and error which 1173 * is defined in 1.6/types.hal 1174 * @param sms Sms result struct as defined by SendSmsResult in types.hal 1175 */ sendCdmaSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms)1176 public void sendCdmaSmsResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 1177 SendSmsResult sms) { 1178 responseSms_1_6(responseInfo, sms); 1179 } 1180 1181 /** 1182 * @param responseInfo Response info struct containing response type, serial no. and error 1183 * @param sms Response to sms sent as defined by SendSmsResult in types.hal 1184 */ sendCdmaSmsExpectMoreResponse(RadioResponseInfo responseInfo, SendSmsResult sms)1185 public void sendCdmaSmsExpectMoreResponse(RadioResponseInfo responseInfo, 1186 SendSmsResult sms) { 1187 responseSms(responseInfo, sms); 1188 } 1189 1190 /** 1191 * 1192 * @param responseInfo Response info struct containing response type, serial no. and error which 1193 * is defined in 1.6/types.hal 1194 * @param sms Sms result struct as defined by SendSmsResult in types.hal 1195 */ sendCdmaSmsExpectMoreResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms)1196 public void sendCdmaSmsExpectMoreResponse_1_6( 1197 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms) { 1198 responseSms_1_6(responseInfo, sms); 1199 } 1200 1201 /** 1202 * @param responseInfo Response info struct containing response type, serial no. and error 1203 */ setDataThrottlingResponse( android.hardware.radio.V1_6.RadioResponseInfo responseInfo)1204 public void setDataThrottlingResponse( 1205 android.hardware.radio.V1_6.RadioResponseInfo responseInfo) { 1206 responseVoid_1_6(responseInfo); 1207 } 1208 1209 /** 1210 * @param responseInfo Response info struct containing response type, serial no. and error 1211 */ acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo responseInfo)1212 public void acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo responseInfo) { 1213 responseVoid(responseInfo); 1214 } 1215 1216 /** 1217 * 1218 * @param responseInfo Response info struct containing response type, serial no. and error 1219 * @param configs Vector of GSM/WCDMA Cell broadcast configs 1220 */ getGsmBroadcastConfigResponse(RadioResponseInfo responseInfo, ArrayList<GsmBroadcastSmsConfigInfo> configs)1221 public void getGsmBroadcastConfigResponse(RadioResponseInfo responseInfo, 1222 ArrayList<GsmBroadcastSmsConfigInfo> configs) { 1223 responseGmsBroadcastConfig(responseInfo, configs); 1224 } 1225 1226 /** 1227 * @param responseInfo Response info struct containing response type, serial no. and error 1228 */ setGsmBroadcastConfigResponse(RadioResponseInfo responseInfo)1229 public void setGsmBroadcastConfigResponse(RadioResponseInfo responseInfo) { 1230 responseVoid(responseInfo); 1231 } 1232 1233 /** 1234 * @param responseInfo Response info struct containing response type, serial no. and error 1235 */ setGsmBroadcastActivationResponse(RadioResponseInfo responseInfo)1236 public void setGsmBroadcastActivationResponse(RadioResponseInfo responseInfo) { 1237 responseVoid(responseInfo); 1238 } 1239 1240 /** 1241 * 1242 * @param responseInfo Response info struct containing response type, serial no. and error 1243 * @param configs Vector of CDMA Broadcast SMS configs. 1244 */ getCdmaBroadcastConfigResponse(RadioResponseInfo responseInfo, ArrayList<CdmaBroadcastSmsConfigInfo> configs)1245 public void getCdmaBroadcastConfigResponse(RadioResponseInfo responseInfo, 1246 ArrayList<CdmaBroadcastSmsConfigInfo> configs) { 1247 responseCdmaBroadcastConfig(responseInfo, configs); 1248 } 1249 1250 /** 1251 * @param responseInfo Response info struct containing response type, serial no. and error 1252 */ setCdmaBroadcastConfigResponse(RadioResponseInfo responseInfo)1253 public void setCdmaBroadcastConfigResponse(RadioResponseInfo responseInfo) { 1254 responseVoid(responseInfo); 1255 } 1256 1257 /** 1258 * @param responseInfo Response info struct containing response type, serial no. and error 1259 */ setCdmaBroadcastActivationResponse(RadioResponseInfo responseInfo)1260 public void setCdmaBroadcastActivationResponse(RadioResponseInfo responseInfo) { 1261 responseVoid(responseInfo); 1262 } 1263 1264 /** 1265 * 1266 * @param responseInfo Response info struct containing response type, serial no. and error 1267 * @param mdn MDN if CDMA subscription is available 1268 * @param hSid is a comma separated list of H_SID (Home SID) if 1269 * CDMA subscription is available, in decimal format 1270 * @param hNid is a comma separated list of H_NID (Home NID) if 1271 * CDMA subscription is available, in decimal format 1272 * @param min MIN (10 digits, MIN2+MIN1) if CDMA subscription is available 1273 * @param prl PRL version if CDMA subscription is available 1274 */ getCDMASubscriptionResponse(RadioResponseInfo responseInfo, String mdn, String hSid, String hNid, String min, String prl)1275 public void getCDMASubscriptionResponse(RadioResponseInfo responseInfo, String mdn, 1276 String hSid, String hNid, String min, String prl) { 1277 responseStrings(responseInfo, mdn, hSid, hNid, min, prl); 1278 } 1279 1280 /** 1281 * 1282 * @param responseInfo Response info struct containing response type, serial no. and error 1283 * @param index record index where the cmda sms message is stored 1284 */ writeSmsToRuimResponse(RadioResponseInfo responseInfo, int index)1285 public void writeSmsToRuimResponse(RadioResponseInfo responseInfo, int index) { 1286 responseInts(responseInfo, index); 1287 } 1288 1289 /** 1290 * @param responseInfo Response info struct containing response type, serial no. and error 1291 */ deleteSmsOnRuimResponse(RadioResponseInfo responseInfo)1292 public void deleteSmsOnRuimResponse(RadioResponseInfo responseInfo) { 1293 responseVoid(responseInfo); 1294 } 1295 1296 /** 1297 * @param responseInfo Response info struct containing response type, serial no. and error 1298 * @param imei IMEI if GSM subscription is available 1299 * @param imeisv IMEISV if GSM subscription is available 1300 * @param esn ESN if CDMA subscription is available 1301 * @param meid MEID if CDMA subscription is available 1302 */ getDeviceIdentityResponse(RadioResponseInfo responseInfo, String imei, String imeisv, String esn, String meid)1303 public void getDeviceIdentityResponse(RadioResponseInfo responseInfo, String imei, 1304 String imeisv, String esn, String meid) { 1305 responseStrings(responseInfo, imei, imeisv, esn, meid); 1306 } 1307 1308 /** 1309 * @param responseInfo Response info struct containing response type, serial no. and error 1310 */ exitEmergencyCallbackModeResponse(RadioResponseInfo responseInfo)1311 public void exitEmergencyCallbackModeResponse(RadioResponseInfo responseInfo) { 1312 responseVoid(responseInfo); 1313 } 1314 1315 /** 1316 * @param responseInfo Response info struct containing response type, serial no. and error 1317 * @param smsc Short Message Service Center address on the device 1318 */ getSmscAddressResponse(RadioResponseInfo responseInfo, String smsc)1319 public void getSmscAddressResponse(RadioResponseInfo responseInfo, String smsc) { 1320 responseString(responseInfo, smsc); 1321 } 1322 1323 /** 1324 * @param responseInfo Response info struct containing response type, serial no. and error 1325 */ setSmscAddressResponse(RadioResponseInfo responseInfo)1326 public void setSmscAddressResponse(RadioResponseInfo responseInfo) { 1327 responseVoid(responseInfo); 1328 } 1329 1330 /** 1331 * @param responseInfo Response info struct containing response type, serial no. and error 1332 */ reportSmsMemoryStatusResponse(RadioResponseInfo responseInfo)1333 public void reportSmsMemoryStatusResponse(RadioResponseInfo responseInfo) { 1334 responseVoid(responseInfo); 1335 } 1336 1337 /** 1338 * @param responseInfo Response info struct containing response type, serial no. and error 1339 */ reportStkServiceIsRunningResponse(RadioResponseInfo responseInfo)1340 public void reportStkServiceIsRunningResponse(RadioResponseInfo responseInfo) { 1341 responseVoid(responseInfo); 1342 } 1343 1344 /** 1345 * 1346 * @param responseInfo Response info struct containing response type, serial no. and error 1347 * @param source CDMA subscription source 1348 */ getCdmaSubscriptionSourceResponse(RadioResponseInfo responseInfo, int source)1349 public void getCdmaSubscriptionSourceResponse(RadioResponseInfo responseInfo, int source) { 1350 responseInts(responseInfo, source); 1351 } 1352 1353 /** 1354 * This method is deprecated and should not be used. 1355 * 1356 * @param responseInfo Response info struct containing response type, serial no. and error 1357 * @param response response string of the challenge/response algo for ISIM auth in base64 format 1358 */ requestIsimAuthenticationResponse(RadioResponseInfo responseInfo, String response)1359 public void requestIsimAuthenticationResponse(RadioResponseInfo responseInfo, String response) { 1360 throw new RuntimeException("Inexplicable response received for requestIsimAuthentication"); 1361 } 1362 1363 /** 1364 * @param responseInfo Response info struct containing response type, serial no. and error 1365 */ acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo responseInfo)1366 public void acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo responseInfo) { 1367 responseVoid(responseInfo); 1368 } 1369 1370 /** 1371 * 1372 * @param responseInfo Response info struct containing response type, serial no. and error 1373 * @param iccIo IccIoResult as defined in types.hal corresponding to ICC IO response 1374 */ sendEnvelopeWithStatusResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.IccIoResult iccIo)1375 public void sendEnvelopeWithStatusResponse(RadioResponseInfo responseInfo, 1376 android.hardware.radio.V1_0.IccIoResult iccIo) { 1377 responseIccIo(responseInfo, iccIo); 1378 } 1379 1380 /** 1381 * 1382 * @param responseInfo Response info struct containing response type, serial no. and error 1383 * @param rat Current voice RAT 1384 */ getVoiceRadioTechnologyResponse(RadioResponseInfo responseInfo, int rat)1385 public void getVoiceRadioTechnologyResponse(RadioResponseInfo responseInfo, int rat) { 1386 responseInts(responseInfo, rat); 1387 } 1388 getCellInfoListResponse(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.CellInfo> cellInfo)1389 public void getCellInfoListResponse(RadioResponseInfo responseInfo, 1390 ArrayList<android.hardware.radio.V1_0.CellInfo> cellInfo) { 1391 responseCellInfoList(responseInfo, cellInfo); 1392 } 1393 1394 /** 1395 * @param responseInfo Response info struct containing response type, serial no. and error 1396 * @param cellInfo List of current cell information known to radio 1397 */ getCellInfoListResponse_1_2( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo)1398 public void getCellInfoListResponse_1_2( 1399 RadioResponseInfo responseInfo, 1400 ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo) { 1401 responseCellInfoList_1_2(responseInfo, cellInfo); 1402 } 1403 1404 /** 1405 * @param responseInfo Response info struct containing response type, serial no. and error. 1406 * @param cellInfo List of current cell information known to radio. 1407 */ getCellInfoListResponse_1_4( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_4.CellInfo> cellInfo)1408 public void getCellInfoListResponse_1_4( 1409 RadioResponseInfo responseInfo, 1410 ArrayList<android.hardware.radio.V1_4.CellInfo> cellInfo) { 1411 responseCellInfoList_1_4(responseInfo, cellInfo); 1412 } 1413 1414 /** 1415 * @param responseInfo Response info struct containing response type, serial no. and error. 1416 * @param cellInfo List of current cell information known to radio. 1417 */ getCellInfoListResponse_1_5( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_5.CellInfo> cellInfo)1418 public void getCellInfoListResponse_1_5( 1419 RadioResponseInfo responseInfo, 1420 ArrayList<android.hardware.radio.V1_5.CellInfo> cellInfo) { 1421 responseCellInfoList_1_5(responseInfo, cellInfo); 1422 } 1423 1424 /** 1425 * @param responseInfo Response info struct containing response type, serial no. and error. 1426 * @param cellInfo List of current cell information known to radio. 1427 */ getCellInfoListResponse_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_6.CellInfo> cellInfo)1428 public void getCellInfoListResponse_1_6( 1429 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 1430 ArrayList<android.hardware.radio.V1_6.CellInfo> cellInfo) { 1431 responseCellInfoList_1_6(responseInfo, cellInfo); 1432 } 1433 1434 /** 1435 * @param responseInfo Response info struct containing response type, serial no. and error 1436 */ setCellInfoListRateResponse(RadioResponseInfo responseInfo)1437 public void setCellInfoListRateResponse(RadioResponseInfo responseInfo) { 1438 responseVoid(responseInfo); 1439 } 1440 1441 /** 1442 * @param responseInfo Response info struct containing response type, serial no. and error 1443 */ setInitialAttachApnResponse(RadioResponseInfo responseInfo)1444 public void setInitialAttachApnResponse(RadioResponseInfo responseInfo) { 1445 responseVoid(responseInfo); 1446 } 1447 1448 /** 1449 * @param responseInfo Response info struct containing response type, serial no. and error 1450 */ setInitialAttachApnResponse_1_5(RadioResponseInfo responseInfo)1451 public void setInitialAttachApnResponse_1_5(RadioResponseInfo responseInfo) { 1452 responseVoid(responseInfo); 1453 } 1454 1455 /** 1456 * 1457 * @param responseInfo Response info struct containing response type, serial no. and error 1458 * @param isRegistered false = not registered, true = registered 1459 * @param ratFamily RadioTechnologyFamily as defined in types.hal. This value is valid only if 1460 * isRegistered is true. 1461 */ getImsRegistrationStateResponse(RadioResponseInfo responseInfo, boolean isRegistered, int ratFamily)1462 public void getImsRegistrationStateResponse(RadioResponseInfo responseInfo, 1463 boolean isRegistered, int ratFamily) { 1464 responseInts( 1465 responseInfo, 1466 isRegistered ? 1 : 0, 1467 ratFamily == RadioTechnologyFamily.THREE_GPP 1468 ? PhoneConstants.PHONE_TYPE_GSM 1469 : PhoneConstants.PHONE_TYPE_CDMA); 1470 } 1471 1472 /** 1473 * 1474 * @param responseInfo Response info struct containing response type, serial no. and error 1475 * @param sms Response to sms sent as defined by SendSmsResult in types.hal 1476 */ sendImsSmsResponse(RadioResponseInfo responseInfo, SendSmsResult sms)1477 public void sendImsSmsResponse(RadioResponseInfo responseInfo, SendSmsResult sms) { 1478 responseSms(responseInfo, sms); 1479 } 1480 1481 /** 1482 * 1483 * @param responseInfo Response info struct containing response type, serial no. and error 1484 * @param result IccIoResult as defined in types.hal 1485 */ iccTransmitApduBasicChannelResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.IccIoResult result)1486 public void iccTransmitApduBasicChannelResponse(RadioResponseInfo responseInfo, 1487 android.hardware.radio.V1_0.IccIoResult 1488 result) { 1489 responseIccIo(responseInfo, result); 1490 } 1491 1492 /** 1493 * 1494 * @param responseInfo Response info struct containing response type, serial no. and error 1495 * @param channelId session id of the logical channel. 1496 * @param selectResponse Contains the select response for the open channel command with one 1497 * byte per integer 1498 */ iccOpenLogicalChannelResponse(RadioResponseInfo responseInfo, int channelId, ArrayList<Byte> selectResponse)1499 public void iccOpenLogicalChannelResponse(RadioResponseInfo responseInfo, int channelId, 1500 ArrayList<Byte> selectResponse) { 1501 ArrayList<Integer> arr = new ArrayList<>(); 1502 arr.add(channelId); 1503 for (int i = 0; i < selectResponse.size(); i++) { 1504 arr.add((int) selectResponse.get(i)); 1505 } 1506 responseIntArrayList(responseInfo, arr); 1507 } 1508 1509 /** 1510 * @param responseInfo Response info struct containing response type, serial no. and error 1511 */ iccCloseLogicalChannelResponse(RadioResponseInfo responseInfo)1512 public void iccCloseLogicalChannelResponse(RadioResponseInfo responseInfo) { 1513 responseVoid(responseInfo); 1514 } 1515 1516 /** 1517 * 1518 * @param responseInfo Response info struct containing response type, serial no. and error 1519 * @param result IccIoResult as defined in types.hal 1520 */ iccTransmitApduLogicalChannelResponse( RadioResponseInfo responseInfo, android.hardware.radio.V1_0.IccIoResult result)1521 public void iccTransmitApduLogicalChannelResponse( 1522 RadioResponseInfo responseInfo, 1523 android.hardware.radio.V1_0.IccIoResult result) { 1524 responseIccIo(responseInfo, result); 1525 } 1526 1527 /** 1528 * 1529 * @param responseInfo Response info struct containing response type, serial no. and error 1530 * @param result string containing the contents of the NV item 1531 */ nvReadItemResponse(RadioResponseInfo responseInfo, String result)1532 public void nvReadItemResponse(RadioResponseInfo responseInfo, String result) { 1533 responseString(responseInfo, result); 1534 } 1535 1536 /** 1537 * @param responseInfo Response info struct containing response type, serial no. and error 1538 */ nvWriteItemResponse(RadioResponseInfo responseInfo)1539 public void nvWriteItemResponse(RadioResponseInfo responseInfo) { 1540 responseVoid(responseInfo); 1541 } 1542 1543 /** 1544 * @param responseInfo Response info struct containing response type, serial no. and error 1545 */ nvWriteCdmaPrlResponse(RadioResponseInfo responseInfo)1546 public void nvWriteCdmaPrlResponse(RadioResponseInfo responseInfo) { 1547 responseVoid(responseInfo); 1548 } 1549 1550 /** 1551 * @param responseInfo Response info struct containing response type, serial no. and error 1552 */ nvResetConfigResponse(RadioResponseInfo responseInfo)1553 public void nvResetConfigResponse(RadioResponseInfo responseInfo) { 1554 responseVoid(responseInfo); 1555 } 1556 1557 /** 1558 * @param responseInfo Response info struct containing response type, serial no. and error 1559 */ setUiccSubscriptionResponse(RadioResponseInfo responseInfo)1560 public void setUiccSubscriptionResponse(RadioResponseInfo responseInfo) { 1561 responseVoid(responseInfo); 1562 } 1563 1564 /** 1565 * @param responseInfo Response info struct containing response type, serial no. and error 1566 */ setDataAllowedResponse(RadioResponseInfo responseInfo)1567 public void setDataAllowedResponse(RadioResponseInfo responseInfo) { 1568 responseVoid(responseInfo); 1569 } 1570 getHardwareConfigResponse( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.HardwareConfig> config)1571 public void getHardwareConfigResponse( 1572 RadioResponseInfo responseInfo, 1573 ArrayList<android.hardware.radio.V1_0.HardwareConfig> config) { 1574 responseHardwareConfig(responseInfo, config); 1575 } 1576 1577 /** 1578 * 1579 * @param responseInfo Response info struct containing response type, serial no. and error 1580 * @param result IccIoResult as defined in types.hal 1581 */ requestIccSimAuthenticationResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.IccIoResult result)1582 public void requestIccSimAuthenticationResponse(RadioResponseInfo responseInfo, 1583 android.hardware.radio.V1_0.IccIoResult 1584 result) { 1585 RILRequest rr = mRil.processResponse(responseInfo); 1586 1587 if (rr != null) { 1588 IccIoResult ret = new IccIoResult( 1589 result.sw1, 1590 result.sw2, 1591 TextUtils.isEmpty(result.simResponse) 1592 ? null : result.simResponse.getBytes()); 1593 if (responseInfo.error == RadioError.NONE) { 1594 sendMessageResponse(rr.mResult, ret); 1595 } 1596 mRil.processResponseDone(rr, responseInfo, ret); 1597 } 1598 } 1599 1600 /** 1601 * @param responseInfo Response info struct containing response type, serial no. and error 1602 */ setDataProfileResponse(RadioResponseInfo responseInfo)1603 public void setDataProfileResponse(RadioResponseInfo responseInfo) { 1604 responseVoid(responseInfo); 1605 } 1606 1607 /** 1608 * @param responseInfo Response info struct containing response type, serial no. and error 1609 */ setDataProfileResponse_1_5(RadioResponseInfo responseInfo)1610 public void setDataProfileResponse_1_5(RadioResponseInfo responseInfo) { 1611 responseVoid(responseInfo); 1612 } 1613 1614 /** 1615 * @param responseInfo Response info struct containing response type, serial no. and error 1616 */ requestShutdownResponse(RadioResponseInfo responseInfo)1617 public void requestShutdownResponse(RadioResponseInfo responseInfo) { 1618 responseVoid(responseInfo); 1619 } 1620 getRadioCapabilityResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.RadioCapability rc)1621 public void getRadioCapabilityResponse(RadioResponseInfo responseInfo, 1622 android.hardware.radio.V1_0.RadioCapability rc) { 1623 RILRequest rr = mRil.processResponse(responseInfo); 1624 1625 if (rr != null) { 1626 RadioCapability ret = RIL.convertHalRadioCapability(rc, mRil); 1627 if (responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED 1628 || responseInfo.error == RadioError.GENERIC_FAILURE) { 1629 // we should construct the RAF bitmask the radio 1630 // supports based on preferred network bitmasks 1631 ret = mRil.makeStaticRadioCapability(); 1632 responseInfo.error = RadioError.NONE; 1633 } 1634 if (responseInfo.error == RadioError.NONE) { 1635 sendMessageResponse(rr.mResult, ret); 1636 } 1637 mRil.processResponseDone(rr, responseInfo, ret); 1638 } 1639 } 1640 setRadioCapabilityResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.RadioCapability rc)1641 public void setRadioCapabilityResponse(RadioResponseInfo responseInfo, 1642 android.hardware.radio.V1_0.RadioCapability rc) { 1643 responseRadioCapability(responseInfo, rc); 1644 } 1645 1646 /** 1647 * 1648 * @param responseInfo Response info struct containing response type, serial no. and error 1649 * @param statusInfo LceStatusInfo indicating LCE status 1650 */ startLceServiceResponse(RadioResponseInfo responseInfo, LceStatusInfo statusInfo)1651 public void startLceServiceResponse(RadioResponseInfo responseInfo, LceStatusInfo statusInfo) { 1652 responseLceStatus(responseInfo, statusInfo); 1653 } 1654 1655 /** 1656 * 1657 * @param responseInfo Response info struct containing response type, serial no. and error 1658 * @param statusInfo LceStatusInfo indicating LCE status 1659 */ stopLceServiceResponse(RadioResponseInfo responseInfo, LceStatusInfo statusInfo)1660 public void stopLceServiceResponse(RadioResponseInfo responseInfo, LceStatusInfo statusInfo) { 1661 responseLceStatus(responseInfo, statusInfo); 1662 } 1663 pullLceDataResponse(RadioResponseInfo responseInfo, LceDataInfo lceInfo)1664 public void pullLceDataResponse(RadioResponseInfo responseInfo, LceDataInfo lceInfo) { 1665 responseLceData(responseInfo, lceInfo); 1666 } 1667 1668 /** 1669 * 1670 * @param responseInfo Response info struct containing response type, serial no. and error 1671 * @param activityInfo modem activity information 1672 */ getModemActivityInfoResponse(RadioResponseInfo responseInfo, ActivityStatsInfo activityInfo)1673 public void getModemActivityInfoResponse(RadioResponseInfo responseInfo, 1674 ActivityStatsInfo activityInfo) { 1675 responseActivityData(responseInfo, activityInfo); 1676 } 1677 1678 /** 1679 * 1680 * @param responseInfo Response info struct containing response type, serial no. and error 1681 * @param isEnabled Indicates whether NR dual connectivity is enabled or not, True if enabled 1682 * else false. 1683 */ isNrDualConnectivityEnabledResponse( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, boolean isEnabled)1684 public void isNrDualConnectivityEnabledResponse( 1685 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 1686 boolean isEnabled) { 1687 RILRequest rr = mRil.processResponse_1_6(responseInfo); 1688 1689 if (rr != null) { 1690 if (responseInfo.error == RadioError.NONE) { 1691 sendMessageResponse(rr.mResult, isEnabled); 1692 } 1693 mRil.processResponseDone_1_6(rr, responseInfo, isEnabled); 1694 } 1695 } 1696 1697 /** 1698 * 1699 * @param info Response info struct containing response type, serial no. and error 1700 */ setNrDualConnectivityStateResponse( android.hardware.radio.V1_6.RadioResponseInfo info)1701 public void setNrDualConnectivityStateResponse( 1702 android.hardware.radio.V1_6.RadioResponseInfo info) { 1703 responseVoid_1_6(info); 1704 } 1705 1706 /** 1707 * 1708 * @param responseInfo Response info struct containing response type, serial no. and error 1709 * @param numAllowed number of allowed carriers which have been set correctly. 1710 * On success, it must match the length of list Carriers->allowedCarriers. 1711 * if Length of allowed carriers list is 0, numAllowed = 0. 1712 */ setAllowedCarriersResponse(RadioResponseInfo responseInfo, int numAllowed)1713 public void setAllowedCarriersResponse(RadioResponseInfo responseInfo, int numAllowed) { 1714 // The number of allowed carriers set correctly is not really useful. Even if one is 1715 // missing, the operation has failed, as the list should be treated as a single 1716 // configuration item. So, ignoring the value of numAllowed and considering only the 1717 // value of the responseInfo.error. 1718 int ret = TelephonyManager.SET_CARRIER_RESTRICTION_ERROR; 1719 RILRequest rr = mRil.processResponse(responseInfo); 1720 if (rr != null) { 1721 mRil.riljLog("setAllowedCarriersResponse - error = " + responseInfo.error); 1722 1723 if (responseInfo.error == RadioError.NONE) { 1724 ret = TelephonyManager.SET_CARRIER_RESTRICTION_SUCCESS; 1725 sendMessageResponse(rr.mResult, ret); 1726 } else if (responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED) { 1727 // Handle the case REQUEST_NOT_SUPPORTED as a valid response 1728 responseInfo.error = RadioError.NONE; 1729 ret = TelephonyManager.SET_CARRIER_RESTRICTION_NOT_SUPPORTED; 1730 sendMessageResponse(rr.mResult, ret); 1731 } 1732 mRil.processResponseDone(rr, responseInfo, ret); 1733 } 1734 } 1735 1736 /** 1737 * 1738 * @param responseInfo Response info struct containing response type, serial no. and error 1739 */ setAllowedCarriersResponse_1_4(RadioResponseInfo responseInfo)1740 public void setAllowedCarriersResponse_1_4(RadioResponseInfo responseInfo) { 1741 int ret = TelephonyManager.SET_CARRIER_RESTRICTION_ERROR; 1742 RILRequest rr = mRil.processResponse(responseInfo); 1743 if (rr != null) { 1744 mRil.riljLog("setAllowedCarriersResponse_1_4 - error = " + responseInfo.error); 1745 1746 if (responseInfo.error == RadioError.NONE) { 1747 ret = TelephonyManager.SET_CARRIER_RESTRICTION_SUCCESS; 1748 sendMessageResponse(rr.mResult, ret); 1749 } 1750 mRil.processResponseDone(rr, responseInfo, ret); 1751 } 1752 } 1753 1754 /** 1755 * @param responseInfo Response info struct containing response type, serial no. and error 1756 * @param allAllowed true only when all carriers are allowed. Ignore "carriers" struct. 1757 * If false, consider "carriers" struct 1758 * @param carriers Carrier restriction information. 1759 */ getAllowedCarriersResponse(RadioResponseInfo responseInfo, boolean allAllowed, CarrierRestrictions carriers)1760 public void getAllowedCarriersResponse(RadioResponseInfo responseInfo, boolean allAllowed, 1761 CarrierRestrictions carriers) { 1762 CarrierRestrictionsWithPriority carrierRestrictions = new CarrierRestrictionsWithPriority(); 1763 carrierRestrictions.allowedCarriers = carriers.allowedCarriers; 1764 carrierRestrictions.excludedCarriers = carriers.excludedCarriers; 1765 carrierRestrictions.allowedCarriersPrioritized = true; 1766 1767 responseCarrierRestrictions(responseInfo, allAllowed, carrierRestrictions, 1768 SimLockMultiSimPolicy.NO_MULTISIM_POLICY); 1769 } 1770 1771 /** 1772 * @param responseInfo Response info struct containing response type, serial no. and error 1773 * @param carrierRestrictions Carrier restriction information. 1774 * @param multiSimPolicy Policy for multi-sim devices. 1775 */ getAllowedCarriersResponse_1_4(RadioResponseInfo responseInfo, CarrierRestrictionsWithPriority carrierRestrictions, int multiSimPolicy)1776 public void getAllowedCarriersResponse_1_4(RadioResponseInfo responseInfo, 1777 CarrierRestrictionsWithPriority carrierRestrictions, 1778 int multiSimPolicy) { 1779 // The API in IRadio 1.4 does not support the flag allAllowed, so setting it to false, so 1780 // that values in carrierRestrictions are used. 1781 responseCarrierRestrictions(responseInfo, false, carrierRestrictions, multiSimPolicy); 1782 } 1783 1784 /** 1785 * @param responseInfo Response info struct containing response type, serial no. and error 1786 */ sendDeviceStateResponse(RadioResponseInfo responseInfo)1787 public void sendDeviceStateResponse(RadioResponseInfo responseInfo) { 1788 responseVoid(responseInfo); 1789 } 1790 1791 /** 1792 * @param responseInfo Response info struct containing response type, serial no. and error 1793 */ setCarrierInfoForImsiEncryptionResponse(RadioResponseInfo responseInfo)1794 public void setCarrierInfoForImsiEncryptionResponse(RadioResponseInfo responseInfo) { 1795 responseVoid(responseInfo); 1796 } 1797 1798 /** 1799 * @param responseInfo Response info struct containing response type, serial no. and error 1800 */ setIndicationFilterResponse(RadioResponseInfo responseInfo)1801 public void setIndicationFilterResponse(RadioResponseInfo responseInfo) { 1802 responseVoid(responseInfo); 1803 } 1804 1805 /** 1806 * @param responseInfo Response info struct containing response type, serial no. and error 1807 */ setIndicationFilterResponse_1_5(RadioResponseInfo responseInfo)1808 public void setIndicationFilterResponse_1_5(RadioResponseInfo responseInfo) { 1809 responseVoid(responseInfo); 1810 } 1811 1812 /** 1813 * @param responseInfo Response info struct containing response type, serial no. and error 1814 */ setSimCardPowerResponse(RadioResponseInfo responseInfo)1815 public void setSimCardPowerResponse(RadioResponseInfo responseInfo) { 1816 responseVoid(responseInfo); 1817 } 1818 1819 /** 1820 * @param responseInfo Response info struct containing response type, serial no. and error 1821 */ setSignalStrengthReportingCriteriaResponse(RadioResponseInfo responseInfo)1822 public void setSignalStrengthReportingCriteriaResponse(RadioResponseInfo responseInfo) { 1823 responseVoid(responseInfo); 1824 } 1825 1826 /** 1827 * @param responseInfo Response info struct containing response type, serial no. and error 1828 */ setSignalStrengthReportingCriteriaResponse_1_5(RadioResponseInfo responseInfo)1829 public void setSignalStrengthReportingCriteriaResponse_1_5(RadioResponseInfo responseInfo) { 1830 responseVoid(responseInfo); 1831 } 1832 1833 /** 1834 * @param responseInfo Response info struct containing response type, serial no. and error 1835 */ setLinkCapacityReportingCriteriaResponse(RadioResponseInfo responseInfo)1836 public void setLinkCapacityReportingCriteriaResponse(RadioResponseInfo responseInfo) { 1837 responseVoid(responseInfo); 1838 } 1839 1840 /** 1841 * @param responseInfo Response info struct containing response type, serial no. and error 1842 */ setLinkCapacityReportingCriteriaResponse_1_5(RadioResponseInfo responseInfo)1843 public void setLinkCapacityReportingCriteriaResponse_1_5(RadioResponseInfo responseInfo) { 1844 responseVoid(responseInfo); 1845 } 1846 1847 /** 1848 * @param responseInfo Response info struct containing response type, serial no. and error 1849 */ setSimCardPowerResponse_1_1(RadioResponseInfo responseInfo)1850 public void setSimCardPowerResponse_1_1(RadioResponseInfo responseInfo) { 1851 responseVoid(responseInfo); 1852 } 1853 1854 1855 /** 1856 * @param responseInfo Response info struct containing response type, serial no. and error 1857 * @param keepaliveStatus status of the keepalive with a handle for the session 1858 */ startKeepaliveResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_1.KeepaliveStatus keepaliveStatus)1859 public void startKeepaliveResponse(RadioResponseInfo responseInfo, 1860 android.hardware.radio.V1_1.KeepaliveStatus keepaliveStatus) { 1861 1862 RILRequest rr = mRil.processResponse(responseInfo); 1863 if (rr == null) return; 1864 1865 KeepaliveStatus ret = null; 1866 try { 1867 switch(responseInfo.error) { 1868 case RadioError.NONE: 1869 int convertedStatus = convertHalKeepaliveStatusCode(keepaliveStatus.code); 1870 if (convertedStatus < 0) { 1871 ret = new KeepaliveStatus(KeepaliveStatus.ERROR_UNSUPPORTED); 1872 } else { 1873 ret = new KeepaliveStatus(keepaliveStatus.sessionHandle, convertedStatus); 1874 } 1875 // If responseInfo.error is NONE, response function sends the response message 1876 // even if result is actually an error. 1877 sendMessageResponse(rr.mResult, ret); 1878 break; 1879 case RadioError.REQUEST_NOT_SUPPORTED: 1880 ret = new KeepaliveStatus(KeepaliveStatus.ERROR_UNSUPPORTED); 1881 break; 1882 case RadioError.NO_RESOURCES: 1883 ret = new KeepaliveStatus(KeepaliveStatus.ERROR_NO_RESOURCES); 1884 break; 1885 default: 1886 ret = new KeepaliveStatus(KeepaliveStatus.ERROR_UNKNOWN); 1887 break; 1888 } 1889 } finally { 1890 // If responseInfo.error != NONE, the processResponseDone sends the response message. 1891 mRil.processResponseDone(rr, responseInfo, ret); 1892 } 1893 } 1894 1895 /** 1896 * @param responseInfo Response info struct containing response type, serial no. and error 1897 */ stopKeepaliveResponse(RadioResponseInfo responseInfo)1898 public void stopKeepaliveResponse(RadioResponseInfo responseInfo) { 1899 RILRequest rr = mRil.processResponse(responseInfo); 1900 if (rr == null) return; 1901 1902 try { 1903 if (responseInfo.error == RadioError.NONE) { 1904 sendMessageResponse(rr.mResult, null); 1905 } else { 1906 //TODO: Error code translation 1907 } 1908 } finally { 1909 mRil.processResponseDone(rr, responseInfo, null); 1910 } 1911 } 1912 convertHalKeepaliveStatusCode(int halCode)1913 private int convertHalKeepaliveStatusCode(int halCode) { 1914 switch (halCode) { 1915 case android.hardware.radio.V1_1.KeepaliveStatusCode.ACTIVE: 1916 return KeepaliveStatus.STATUS_ACTIVE; 1917 case android.hardware.radio.V1_1.KeepaliveStatusCode.INACTIVE: 1918 return KeepaliveStatus.STATUS_INACTIVE; 1919 case android.hardware.radio.V1_1.KeepaliveStatusCode.PENDING: 1920 return KeepaliveStatus.STATUS_PENDING; 1921 default: 1922 mRil.riljLog("Invalid Keepalive Status" + halCode); 1923 return -1; 1924 } 1925 } 1926 convertHalCardStatus(CardStatus cardStatus)1927 private IccCardStatus convertHalCardStatus(CardStatus cardStatus) { 1928 IccCardStatus iccCardStatus = new IccCardStatus(); 1929 iccCardStatus.setCardState(cardStatus.cardState); 1930 iccCardStatus.setUniversalPinState(cardStatus.universalPinState); 1931 iccCardStatus.mGsmUmtsSubscriptionAppIndex = cardStatus.gsmUmtsSubscriptionAppIndex; 1932 iccCardStatus.mCdmaSubscriptionAppIndex = cardStatus.cdmaSubscriptionAppIndex; 1933 iccCardStatus.mImsSubscriptionAppIndex = cardStatus.imsSubscriptionAppIndex; 1934 int numApplications = cardStatus.applications.size(); 1935 1936 // limit to maximum allowed applications 1937 if (numApplications 1938 > com.android.internal.telephony.uicc.IccCardStatus.CARD_MAX_APPS) { 1939 numApplications = 1940 com.android.internal.telephony.uicc.IccCardStatus.CARD_MAX_APPS; 1941 } 1942 iccCardStatus.mApplications = new IccCardApplicationStatus[numApplications]; 1943 for (int i = 0; i < numApplications; i++) { 1944 AppStatus rilAppStatus = cardStatus.applications.get(i); 1945 IccCardApplicationStatus appStatus = new IccCardApplicationStatus(); 1946 appStatus.app_type = appStatus.AppTypeFromRILInt(rilAppStatus.appType); 1947 appStatus.app_state = appStatus.AppStateFromRILInt(rilAppStatus.appState); 1948 appStatus.perso_substate = appStatus.PersoSubstateFromRILInt( 1949 rilAppStatus.persoSubstate); 1950 appStatus.aid = rilAppStatus.aidPtr; 1951 appStatus.app_label = rilAppStatus.appLabelPtr; 1952 appStatus.pin1_replaced = rilAppStatus.pin1Replaced; 1953 appStatus.pin1 = appStatus.PinStateFromRILInt(rilAppStatus.pin1); 1954 appStatus.pin2 = appStatus.PinStateFromRILInt(rilAppStatus.pin2); 1955 iccCardStatus.mApplications[i] = appStatus; 1956 mRil.riljLog("IccCardApplicationStatus " + i + ":" + appStatus.toString()); 1957 } 1958 return iccCardStatus; 1959 } 1960 convertHalCardStatus_1_5( android.hardware.radio.V1_5.CardStatus cardStatus)1961 private IccCardStatus convertHalCardStatus_1_5( 1962 android.hardware.radio.V1_5.CardStatus cardStatus) { 1963 IccCardStatus iccCardStatus = new IccCardStatus(); 1964 iccCardStatus.setCardState(cardStatus.base.base.base.cardState); 1965 iccCardStatus.setUniversalPinState(cardStatus.base.base.base.universalPinState); 1966 iccCardStatus.mGsmUmtsSubscriptionAppIndex = 1967 cardStatus.base.base.base.gsmUmtsSubscriptionAppIndex; 1968 iccCardStatus.mCdmaSubscriptionAppIndex = 1969 cardStatus.base.base.base.cdmaSubscriptionAppIndex; 1970 iccCardStatus.mImsSubscriptionAppIndex = 1971 cardStatus.base.base.base.imsSubscriptionAppIndex; 1972 iccCardStatus.physicalSlotIndex = cardStatus.base.base.physicalSlotId; 1973 iccCardStatus.atr = cardStatus.base.base.atr; 1974 iccCardStatus.iccid = cardStatus.base.base.iccid; 1975 iccCardStatus.eid = cardStatus.base.eid; 1976 int numApplications = cardStatus.applications.size(); 1977 1978 // limit to maximum allowed applications 1979 if (numApplications 1980 > com.android.internal.telephony.uicc.IccCardStatus.CARD_MAX_APPS) { 1981 numApplications = 1982 com.android.internal.telephony.uicc.IccCardStatus.CARD_MAX_APPS; 1983 } 1984 iccCardStatus.mApplications = new IccCardApplicationStatus[numApplications]; 1985 for (int i = 0; i < numApplications; i++) { 1986 android.hardware.radio.V1_5.AppStatus rilAppStatus = cardStatus.applications.get(i); 1987 IccCardApplicationStatus appStatus = new IccCardApplicationStatus(); 1988 appStatus.app_type = appStatus.AppTypeFromRILInt(rilAppStatus.base.appType); 1989 appStatus.app_state = appStatus.AppStateFromRILInt(rilAppStatus.base.appState); 1990 appStatus.perso_substate = appStatus.PersoSubstateFromRILInt( 1991 rilAppStatus.persoSubstate); 1992 appStatus.aid = rilAppStatus.base.aidPtr; 1993 appStatus.app_label = rilAppStatus.base.appLabelPtr; 1994 appStatus.pin1_replaced = rilAppStatus.base.pin1Replaced; 1995 appStatus.pin1 = appStatus.PinStateFromRILInt(rilAppStatus.base.pin1); 1996 appStatus.pin2 = appStatus.PinStateFromRILInt(rilAppStatus.base.pin2); 1997 iccCardStatus.mApplications[i] = appStatus; 1998 mRil.riljLog("IccCardApplicationStatus " + i + ":" + appStatus.toString()); 1999 } 2000 return iccCardStatus; 2001 } 2002 2003 /** 2004 * @param responseInfo Response info struct containing response type, serial no. and error. 2005 */ getSimPhonebookRecordsResponse( android.hardware.radio.V1_6.RadioResponseInfo responseInfo)2006 public void getSimPhonebookRecordsResponse( 2007 android.hardware.radio.V1_6.RadioResponseInfo responseInfo) { 2008 responseVoid_1_6(responseInfo); 2009 } 2010 2011 /** 2012 * @param responseInfo Response info struct containing response type, serial no. and error. 2013 * @param pbCapacity Contains the adn, email, anr capacities in the sim card. 2014 */ getSimPhonebookCapacityResponse( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, android.hardware.radio.V1_6.PhonebookCapacity pbCapacity)2015 public void getSimPhonebookCapacityResponse( 2016 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2017 android.hardware.radio.V1_6.PhonebookCapacity pbCapacity) { 2018 AdnCapacity capacity = new AdnCapacity(pbCapacity); 2019 responseAdnCapacity(responseInfo, capacity); 2020 } 2021 2022 /** 2023 * @param responseInfo Response info struct containing response type, serial no. and error. 2024 * @param updatedRecordIndex The index of the updated record. 2025 */ updateSimPhonebookRecordsResponse( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, int updatedRecordIndex)2026 public void updateSimPhonebookRecordsResponse( 2027 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2028 int updatedRecordIndex) { 2029 responseInts_1_6(responseInfo, updatedRecordIndex); 2030 } 2031 responseAdnCapacity( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, AdnCapacity capacity)2032 private void responseAdnCapacity( 2033 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2034 AdnCapacity capacity) { 2035 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2036 if (rr != null) { 2037 if (responseInfo.error == RadioError.NONE) { 2038 sendMessageResponse(rr.mResult, capacity); 2039 } 2040 mRil.processResponseDone_1_6(rr, responseInfo, capacity); 2041 } 2042 } 2043 responseIccCardStatus(RadioResponseInfo responseInfo, CardStatus cardStatus)2044 private void responseIccCardStatus(RadioResponseInfo responseInfo, CardStatus cardStatus) { 2045 RILRequest rr = mRil.processResponse(responseInfo); 2046 2047 if (rr != null) { 2048 IccCardStatus iccCardStatus = convertHalCardStatus(cardStatus); 2049 mRil.riljLog("responseIccCardStatus: from HIDL: " + iccCardStatus); 2050 if (responseInfo.error == RadioError.NONE) { 2051 sendMessageResponse(rr.mResult, iccCardStatus); 2052 } 2053 mRil.processResponseDone(rr, responseInfo, iccCardStatus); 2054 } 2055 } 2056 responseIccCardStatus_1_2(RadioResponseInfo responseInfo, android.hardware.radio.V1_2.CardStatus cardStatus)2057 private void responseIccCardStatus_1_2(RadioResponseInfo responseInfo, 2058 android.hardware.radio.V1_2.CardStatus cardStatus) { 2059 RILRequest rr = mRil.processResponse(responseInfo); 2060 2061 if (rr != null) { 2062 IccCardStatus iccCardStatus = convertHalCardStatus(cardStatus.base); 2063 iccCardStatus.physicalSlotIndex = cardStatus.physicalSlotId; 2064 iccCardStatus.atr = cardStatus.atr; 2065 iccCardStatus.iccid = cardStatus.iccid; 2066 mRil.riljLog("responseIccCardStatus: from HIDL: " + iccCardStatus); 2067 if (responseInfo.error == RadioError.NONE) { 2068 sendMessageResponse(rr.mResult, iccCardStatus); 2069 } 2070 mRil.processResponseDone(rr, responseInfo, iccCardStatus); 2071 } 2072 } 2073 responseIccCardStatus_1_4(RadioResponseInfo responseInfo, android.hardware.radio.V1_4.CardStatus cardStatus)2074 private void responseIccCardStatus_1_4(RadioResponseInfo responseInfo, 2075 android.hardware.radio.V1_4.CardStatus cardStatus) { 2076 RILRequest rr = mRil.processResponse(responseInfo); 2077 2078 if (rr != null) { 2079 IccCardStatus iccCardStatus = convertHalCardStatus(cardStatus.base.base); 2080 iccCardStatus.physicalSlotIndex = cardStatus.base.physicalSlotId; 2081 iccCardStatus.atr = cardStatus.base.atr; 2082 iccCardStatus.iccid = cardStatus.base.iccid; 2083 iccCardStatus.eid = cardStatus.eid; 2084 mRil.riljLog("responseIccCardStatus: from HIDL: " + iccCardStatus); 2085 if (responseInfo.error == RadioError.NONE) { 2086 sendMessageResponse(rr.mResult, iccCardStatus); 2087 } 2088 mRil.processResponseDone(rr, responseInfo, iccCardStatus); 2089 } 2090 } 2091 responseIccCardStatus_1_5(RadioResponseInfo responseInfo, android.hardware.radio.V1_5.CardStatus cardStatus)2092 private void responseIccCardStatus_1_5(RadioResponseInfo responseInfo, 2093 android.hardware.radio.V1_5.CardStatus cardStatus) { 2094 RILRequest rr = mRil.processResponse(responseInfo); 2095 2096 if (rr != null) { 2097 IccCardStatus iccCardStatus = convertHalCardStatus_1_5(cardStatus); 2098 mRil.riljLog("responseIccCardStatus: from HIDL: " + iccCardStatus); 2099 if (responseInfo.error == RadioError.NONE) { 2100 sendMessageResponse(rr.mResult, iccCardStatus); 2101 } 2102 mRil.processResponseDone(rr, responseInfo, iccCardStatus); 2103 } 2104 } 2105 2106 /** 2107 * @param responseInfo Response info struct containing response type, serial no. and error 2108 */ emergencyDialResponse(RadioResponseInfo responseInfo)2109 public void emergencyDialResponse(RadioResponseInfo responseInfo) { 2110 responseVoid(responseInfo); 2111 } 2112 responseInts(RadioResponseInfo responseInfo, int ...var)2113 private void responseInts(RadioResponseInfo responseInfo, int ...var) { 2114 final ArrayList<Integer> ints = new ArrayList<>(); 2115 for (int i = 0; i < var.length; i++) { 2116 ints.add(var[i]); 2117 } 2118 responseIntArrayList(responseInfo, ints); 2119 } 2120 responseInts_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, int ...var)2121 private void responseInts_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2122 int ...var) { 2123 final ArrayList<Integer> ints = new ArrayList<>(); 2124 for (int i = 0; i < var.length; i++) { 2125 ints.add(var[i]); 2126 } 2127 responseIntArrayList_1_6(responseInfo, ints); 2128 } 2129 responseIntArrayList(RadioResponseInfo responseInfo, ArrayList<Integer> var)2130 private void responseIntArrayList(RadioResponseInfo responseInfo, ArrayList<Integer> var) { 2131 RILRequest rr = mRil.processResponse(responseInfo); 2132 2133 if (rr != null) { 2134 int[] ret = new int[var.size()]; 2135 for (int i = 0; i < var.size(); i++) { 2136 ret[i] = var.get(i); 2137 } 2138 if (responseInfo.error == RadioError.NONE) { 2139 sendMessageResponse(rr.mResult, ret); 2140 } 2141 mRil.processResponseDone(rr, responseInfo, ret); 2142 } 2143 } 2144 responseIntArrayList_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, ArrayList<Integer> var)2145 private void responseIntArrayList_1_6( 2146 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, ArrayList<Integer> var) { 2147 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2148 2149 if (rr != null) { 2150 int[] ret = new int[var.size()]; 2151 for (int i = 0; i < var.size(); i++) { 2152 ret[i] = var.get(i); 2153 } 2154 if (responseInfo.error == RadioError.NONE) { 2155 sendMessageResponse(rr.mResult, ret); 2156 } 2157 mRil.processResponseDone_1_6(rr, responseInfo, ret); 2158 } 2159 } 2160 responseCurrentCalls(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.Call> calls)2161 private void responseCurrentCalls(RadioResponseInfo responseInfo, 2162 ArrayList<android.hardware.radio.V1_0.Call> calls) { 2163 RILRequest rr = mRil.processResponse(responseInfo); 2164 2165 if (rr != null) { 2166 int num = calls.size(); 2167 ArrayList<DriverCall> dcCalls = new ArrayList<DriverCall>(num); 2168 DriverCall dc; 2169 2170 for (int i = 0; i < num; i++) { 2171 dc = convertToDriverCall(calls.get(i)); 2172 2173 dcCalls.add(dc); 2174 2175 if (dc.isVoicePrivacy) { 2176 mRil.mVoicePrivacyOnRegistrants.notifyRegistrants(); 2177 mRil.riljLog("InCall VoicePrivacy is enabled"); 2178 } else { 2179 mRil.mVoicePrivacyOffRegistrants.notifyRegistrants(); 2180 mRil.riljLog("InCall VoicePrivacy is disabled"); 2181 } 2182 } 2183 2184 Collections.sort(dcCalls); 2185 2186 if ((num == 0) && mRil.mTestingEmergencyCall.getAndSet(false)) { 2187 if (mRil.mEmergencyCallbackModeRegistrant != null) { 2188 mRil.riljLog("responseCurrentCalls: call ended, testing emergency call," 2189 + " notify ECM Registrants"); 2190 mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant(); 2191 } 2192 } 2193 2194 if (responseInfo.error == RadioError.NONE) { 2195 sendMessageResponse(rr.mResult, dcCalls); 2196 } 2197 mRil.processResponseDone(rr, responseInfo, dcCalls); 2198 } 2199 } 2200 responseCurrentCalls_1_2(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.Call> calls)2201 private void responseCurrentCalls_1_2(RadioResponseInfo responseInfo, 2202 ArrayList<android.hardware.radio.V1_2.Call> calls) { 2203 RILRequest rr = mRil.processResponse(responseInfo); 2204 2205 if (rr != null) { 2206 int num = calls.size(); 2207 ArrayList<DriverCall> dcCalls = new ArrayList<DriverCall>(num); 2208 DriverCall dc; 2209 2210 for (int i = 0; i < num; i++) { 2211 dc = convertToDriverCall_1_2(calls.get(i)); 2212 2213 dcCalls.add(dc); 2214 2215 if (dc.isVoicePrivacy) { 2216 mRil.mVoicePrivacyOnRegistrants.notifyRegistrants(); 2217 mRil.riljLog("InCall VoicePrivacy is enabled"); 2218 } else { 2219 mRil.mVoicePrivacyOffRegistrants.notifyRegistrants(); 2220 mRil.riljLog("InCall VoicePrivacy is disabled"); 2221 } 2222 } 2223 2224 Collections.sort(dcCalls); 2225 2226 if ((num == 0) && mRil.mTestingEmergencyCall.getAndSet(false)) { 2227 if (mRil.mEmergencyCallbackModeRegistrant != null) { 2228 mRil.riljLog("responseCurrentCalls: call ended, testing emergency call," 2229 + " notify ECM Registrants"); 2230 mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant(); 2231 } 2232 } 2233 2234 if (responseInfo.error == RadioError.NONE) { 2235 sendMessageResponse(rr.mResult, dcCalls); 2236 } 2237 mRil.processResponseDone(rr, responseInfo, dcCalls); 2238 } 2239 } 2240 responseCurrentCalls_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_6.Call> calls)2241 private void responseCurrentCalls_1_6( 2242 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2243 ArrayList<android.hardware.radio.V1_6.Call> calls) { 2244 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2245 2246 if (rr != null) { 2247 int num = calls.size(); 2248 ArrayList<DriverCall> dcCalls = new ArrayList<DriverCall>(num); 2249 DriverCall dc; 2250 2251 for (int i = 0; i < num; i++) { 2252 dc = convertToDriverCall_1_6(calls.get(i)); 2253 2254 dcCalls.add(dc); 2255 2256 if (dc.isVoicePrivacy) { 2257 mRil.mVoicePrivacyOnRegistrants.notifyRegistrants(); 2258 mRil.riljLog("InCall VoicePrivacy is enabled"); 2259 } else { 2260 mRil.mVoicePrivacyOffRegistrants.notifyRegistrants(); 2261 mRil.riljLog("InCall VoicePrivacy is disabled"); 2262 } 2263 } 2264 2265 Collections.sort(dcCalls); 2266 2267 if ((num == 0) && mRil.mTestingEmergencyCall.getAndSet(false)) { 2268 if (mRil.mEmergencyCallbackModeRegistrant != null) { 2269 mRil.riljLog("responseCurrentCalls: call ended, testing emergency call," 2270 + " notify ECM Registrants"); 2271 mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant(); 2272 } 2273 } 2274 2275 if (responseInfo.error == RadioError.NONE) { 2276 sendMessageResponse(rr.mResult, dcCalls); 2277 } 2278 mRil.processResponseDone_1_6(rr, responseInfo, dcCalls); 2279 } 2280 } 2281 convertToDriverCall(android.hardware.radio.V1_0.Call call)2282 private DriverCall convertToDriverCall(android.hardware.radio.V1_0.Call call) { 2283 DriverCall dc = new DriverCall(); 2284 // TODO: change name of function stateFromCLCC() in DriverCall.java to name 2285 // clarifying what is CLCC 2286 dc.state = DriverCall.stateFromCLCC((int) (call.state)); 2287 dc.index = call.index; 2288 dc.TOA = call.toa; 2289 dc.isMpty = call.isMpty; 2290 dc.isMT = call.isMT; 2291 dc.als = call.als; 2292 dc.isVoice = call.isVoice; 2293 dc.isVoicePrivacy = call.isVoicePrivacy; 2294 dc.number = call.number; 2295 dc.numberPresentation = DriverCall.presentationFromCLIP((int) (call.numberPresentation)); 2296 dc.name = call.name; 2297 dc.namePresentation = DriverCall.presentationFromCLIP((int) (call.namePresentation)); 2298 if (call.uusInfo.size() == 1) { 2299 dc.uusInfo = new UUSInfo(); 2300 dc.uusInfo.setType(call.uusInfo.get(0).uusType); 2301 dc.uusInfo.setDcs(call.uusInfo.get(0).uusDcs); 2302 if (!TextUtils.isEmpty(call.uusInfo.get(0).uusData)) { 2303 byte[] userData = call.uusInfo.get(0).uusData.getBytes(); 2304 dc.uusInfo.setUserData(userData); 2305 } else { 2306 mRil.riljLog("convertToDriverCall: uusInfo data is null or empty"); 2307 } 2308 2309 mRil.riljLogv(String.format("Incoming UUS : type=%d, dcs=%d, length=%d", 2310 dc.uusInfo.getType(), dc.uusInfo.getDcs(), 2311 dc.uusInfo.getUserData().length)); 2312 mRil.riljLogv("Incoming UUS : data (hex): " 2313 + IccUtils.bytesToHexString(dc.uusInfo.getUserData())); 2314 } else { 2315 mRil.riljLogv("Incoming UUS : NOT present!"); 2316 } 2317 2318 // Make sure there's a leading + on addresses with a TOA of 145 2319 dc.number = PhoneNumberUtils.stringFromStringAndTOA(dc.number, dc.TOA); 2320 2321 return dc; 2322 } 2323 convertToDriverCall_1_2(android.hardware.radio.V1_2.Call call)2324 private DriverCall convertToDriverCall_1_2(android.hardware.radio.V1_2.Call call) { 2325 android.hardware.radio.V1_0.Call earlierVersionCall = call.base; 2326 DriverCall dc = convertToDriverCall(earlierVersionCall); 2327 dc.audioQuality = (int) (call.audioQuality); 2328 return dc; 2329 } 2330 convertToDriverCall_1_6(android.hardware.radio.V1_6.Call call)2331 private DriverCall convertToDriverCall_1_6(android.hardware.radio.V1_6.Call call) { 2332 android.hardware.radio.V1_2.Call earlierVersionCall = call.base; 2333 DriverCall dc = convertToDriverCall_1_2(earlierVersionCall); 2334 dc.forwardedNumber = call.forwardedNumber; 2335 return dc; 2336 } 2337 responseVoid(RadioResponseInfo responseInfo)2338 private void responseVoid(RadioResponseInfo responseInfo) { 2339 RILRequest rr = mRil.processResponse(responseInfo); 2340 2341 if (rr != null) { 2342 Object ret = null; 2343 if (responseInfo.error == RadioError.NONE) { 2344 sendMessageResponse(rr.mResult, ret); 2345 } 2346 mRil.processResponseDone(rr, responseInfo, ret); 2347 } 2348 } 2349 responseVoid_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo)2350 private void responseVoid_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo) { 2351 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2352 2353 if (rr != null) { 2354 Object ret = null; 2355 if (responseInfo.error == RadioError.NONE) { 2356 sendMessageResponse(rr.mResult, ret); 2357 } 2358 mRil.processResponseDone_1_6(rr, responseInfo, ret); 2359 } 2360 } 2361 responseString(RadioResponseInfo responseInfo, String str)2362 private void responseString(RadioResponseInfo responseInfo, String str) { 2363 RILRequest rr = mRil.processResponse(responseInfo); 2364 2365 if (rr != null) { 2366 if (responseInfo.error == RadioError.NONE) { 2367 sendMessageResponse(rr.mResult, str); 2368 } 2369 mRil.processResponseDone(rr, responseInfo, str); 2370 } 2371 } 2372 responseStrings(RadioResponseInfo responseInfo, String ...str)2373 private void responseStrings(RadioResponseInfo responseInfo, String ...str) { 2374 ArrayList<String> strings = new ArrayList<>(); 2375 for (int i = 0; i < str.length; i++) { 2376 strings.add(str[i]); 2377 } 2378 responseStringArrayList(mRil, responseInfo, strings); 2379 } 2380 responseStringArrayList(RIL ril, RadioResponseInfo responseInfo, ArrayList<String> strings)2381 static void responseStringArrayList(RIL ril, RadioResponseInfo responseInfo, 2382 ArrayList<String> strings) { 2383 RILRequest rr = ril.processResponse(responseInfo); 2384 2385 if (rr != null) { 2386 String[] ret = new String[strings.size()]; 2387 for (int i = 0; i < strings.size(); i++) { 2388 ret[i] = strings.get(i); 2389 } 2390 if (responseInfo.error == RadioError.NONE) { 2391 sendMessageResponse(rr.mResult, ret); 2392 } 2393 ril.processResponseDone(rr, responseInfo, ret); 2394 } 2395 } 2396 responseLastCallFailCauseInfo(RadioResponseInfo responseInfo, LastCallFailCauseInfo fcInfo)2397 private void responseLastCallFailCauseInfo(RadioResponseInfo responseInfo, 2398 LastCallFailCauseInfo fcInfo) { 2399 RILRequest rr = mRil.processResponse(responseInfo); 2400 2401 if (rr != null) { 2402 LastCallFailCause ret = new LastCallFailCause(); 2403 ret.causeCode = fcInfo.causeCode; 2404 ret.vendorCause = fcInfo.vendorCause; 2405 if (responseInfo.error == RadioError.NONE) { 2406 sendMessageResponse(rr.mResult, ret); 2407 } 2408 mRil.processResponseDone(rr, responseInfo, ret); 2409 } 2410 } 2411 responseSignalStrength( RadioResponseInfo responseInfo, android.hardware.radio.V1_0.SignalStrength signalStrength)2412 private void responseSignalStrength( 2413 RadioResponseInfo responseInfo, 2414 android.hardware.radio.V1_0.SignalStrength signalStrength) { 2415 RILRequest rr = mRil.processResponse(responseInfo); 2416 2417 if (rr != null) { 2418 SignalStrength ret = new SignalStrength(signalStrength); 2419 if (responseInfo.error == RadioError.NONE) { 2420 sendMessageResponse(rr.mResult, ret); 2421 } 2422 mRil.processResponseDone(rr, responseInfo, ret); 2423 } 2424 } 2425 responseSignalStrength_1_2( RadioResponseInfo responseInfo, android.hardware.radio.V1_2.SignalStrength signalStrength)2426 private void responseSignalStrength_1_2( 2427 RadioResponseInfo responseInfo, 2428 android.hardware.radio.V1_2.SignalStrength signalStrength) { 2429 RILRequest rr = mRil.processResponse(responseInfo); 2430 2431 if (rr != null) { 2432 SignalStrength ret = new SignalStrength(signalStrength); 2433 if (responseInfo.error == RadioError.NONE) { 2434 sendMessageResponse(rr.mResult, ret); 2435 } 2436 mRil.processResponseDone(rr, responseInfo, ret); 2437 } 2438 } 2439 responseSignalStrength_1_4( RadioResponseInfo responseInfo, android.hardware.radio.V1_4.SignalStrength signalStrength)2440 private void responseSignalStrength_1_4( 2441 RadioResponseInfo responseInfo, 2442 android.hardware.radio.V1_4.SignalStrength signalStrength) { 2443 RILRequest rr = mRil.processResponse(responseInfo); 2444 2445 if (rr != null) { 2446 SignalStrength ret = new SignalStrength(signalStrength); 2447 if (responseInfo.error == RadioError.NONE) { 2448 sendMessageResponse(rr.mResult, ret); 2449 } 2450 mRil.processResponseDone(rr, responseInfo, ret); 2451 } 2452 } 2453 responseSignalStrength_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, android.hardware.radio.V1_6.SignalStrength signalStrength)2454 private void responseSignalStrength_1_6( 2455 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2456 android.hardware.radio.V1_6.SignalStrength signalStrength) { 2457 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2458 2459 if (rr != null) { 2460 SignalStrength ret = new SignalStrength(signalStrength); 2461 if (responseInfo.error == RadioError.NONE) { 2462 sendMessageResponse(rr.mResult, ret); 2463 } 2464 mRil.processResponseDone_1_6(rr, responseInfo, ret); 2465 } 2466 } 2467 responseSms(RadioResponseInfo responseInfo, SendSmsResult sms)2468 private void responseSms(RadioResponseInfo responseInfo, SendSmsResult sms) { 2469 RILRequest rr = mRil.processResponse(responseInfo); 2470 2471 if (rr != null) { 2472 long messageId = RIL.getOutgoingSmsMessageId(rr.mResult); 2473 SmsResponse ret = new SmsResponse(sms.messageRef, sms.ackPDU, sms.errorCode, messageId); 2474 if (responseInfo.error == RadioError.NONE) { 2475 sendMessageResponse(rr.mResult, ret); 2476 } 2477 mRil.processResponseDone(rr, responseInfo, ret); 2478 } 2479 } 2480 responseSms_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, SendSmsResult sms)2481 private void responseSms_1_6(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2482 SendSmsResult sms) { 2483 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2484 2485 if (rr != null) { 2486 long messageId = RIL.getOutgoingSmsMessageId(rr.mResult); 2487 SmsResponse ret = new SmsResponse(sms.messageRef, sms.ackPDU, sms.errorCode, messageId); 2488 if (responseInfo.error == RadioError.NONE) { 2489 sendMessageResponse(rr.mResult, ret); 2490 } 2491 mRil.processResponseDone_1_6(rr, responseInfo, ret); 2492 } 2493 } 2494 responseSetupDataCall(RadioResponseInfo responseInfo, Object setupDataCallResult)2495 private void responseSetupDataCall(RadioResponseInfo responseInfo, 2496 Object setupDataCallResult) { 2497 RILRequest rr = mRil.processResponse(responseInfo); 2498 2499 if (rr != null) { 2500 DataCallResponse response = RIL.convertDataCallResult(setupDataCallResult); 2501 if (responseInfo.error == RadioError.NONE) { 2502 sendMessageResponse(rr.mResult, response); 2503 } 2504 mRil.processResponseDone(rr, responseInfo, response); 2505 } 2506 } 2507 responseSetupDataCall_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, Object setupDataCallResult)2508 private void responseSetupDataCall_1_6( 2509 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2510 Object setupDataCallResult) { 2511 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2512 2513 if (rr != null) { 2514 DataCallResponse response = RIL.convertDataCallResult(setupDataCallResult); 2515 if (responseInfo.error == RadioError.NONE) { 2516 sendMessageResponse(rr.mResult, response); 2517 } 2518 mRil.processResponseDone_1_6(rr, responseInfo, response); 2519 } 2520 } 2521 responseIccIo(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.IccIoResult result)2522 private void responseIccIo(RadioResponseInfo responseInfo, 2523 android.hardware.radio.V1_0.IccIoResult result) { 2524 RILRequest rr = mRil.processResponse(responseInfo); 2525 2526 if (rr != null) { 2527 IccIoResult ret = new IccIoResult(result.sw1, result.sw2, result.simResponse); 2528 if (responseInfo.error == RadioError.NONE) { 2529 sendMessageResponse(rr.mResult, ret); 2530 } 2531 mRil.processResponseDone(rr, responseInfo, ret); 2532 } 2533 } 2534 responseCallForwardInfo(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.CallForwardInfo> callForwardInfos)2535 private void responseCallForwardInfo(RadioResponseInfo responseInfo, 2536 ArrayList<android.hardware.radio.V1_0.CallForwardInfo> 2537 callForwardInfos) { 2538 RILRequest rr = mRil.processResponse(responseInfo); 2539 if (rr != null) { 2540 CallForwardInfo[] ret = new CallForwardInfo[callForwardInfos.size()]; 2541 for (int i = 0; i < callForwardInfos.size(); i++) { 2542 ret[i] = new CallForwardInfo(); 2543 ret[i].status = callForwardInfos.get(i).status; 2544 ret[i].reason = callForwardInfos.get(i).reason; 2545 ret[i].serviceClass = callForwardInfos.get(i).serviceClass; 2546 ret[i].toa = callForwardInfos.get(i).toa; 2547 ret[i].number = callForwardInfos.get(i).number; 2548 ret[i].timeSeconds = callForwardInfos.get(i).timeSeconds; 2549 } 2550 if (responseInfo.error == RadioError.NONE) { 2551 sendMessageResponse(rr.mResult, ret); 2552 } 2553 mRil.processResponseDone(rr, responseInfo, ret); 2554 } 2555 } 2556 convertOpertatorInfoToString(int status)2557 private static String convertOpertatorInfoToString(int status) { 2558 if (status == android.hardware.radio.V1_0.OperatorStatus.UNKNOWN) { 2559 return "unknown"; 2560 } else if (status == android.hardware.radio.V1_0.OperatorStatus.AVAILABLE) { 2561 return "available"; 2562 } else if (status == android.hardware.radio.V1_0.OperatorStatus.CURRENT) { 2563 return "current"; 2564 } else if (status == android.hardware.radio.V1_0.OperatorStatus.FORBIDDEN) { 2565 return "forbidden"; 2566 } else { 2567 return ""; 2568 } 2569 } 2570 responseOperatorInfos(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.OperatorInfo> networkInfos)2571 private void responseOperatorInfos(RadioResponseInfo responseInfo, 2572 ArrayList<android.hardware.radio.V1_0.OperatorInfo> 2573 networkInfos) { 2574 RILRequest rr = mRil.processResponse(responseInfo); 2575 2576 if (rr != null) { 2577 ArrayList<OperatorInfo> ret = new ArrayList<OperatorInfo>(); 2578 for (int i = 0; i < networkInfos.size(); i++) { 2579 ret.add(new OperatorInfo(networkInfos.get(i).alphaLong, 2580 networkInfos.get(i).alphaShort, networkInfos.get(i).operatorNumeric, 2581 convertOpertatorInfoToString(networkInfos.get(i).status))); 2582 } 2583 if (responseInfo.error == RadioError.NONE) { 2584 sendMessageResponse(rr.mResult, ret); 2585 } 2586 mRil.processResponseDone(rr, responseInfo, ret); 2587 } 2588 } 2589 responseScanStatus(RadioResponseInfo responseInfo, HalVersion fallbackHalVersion)2590 private void responseScanStatus(RadioResponseInfo responseInfo, HalVersion fallbackHalVersion) { 2591 RILRequest rr = mRil.processResponse(responseInfo); 2592 if (rr == null) { 2593 return; 2594 } 2595 2596 final boolean needFallback = responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED 2597 && fallbackHalVersion != null && rr.mArguments != null && rr.mArguments.length > 0 2598 && rr.mArguments[0] instanceof NetworkScanRequest; 2599 if (needFallback) { 2600 // Move the data needed for fallback call from rr which will be released soon 2601 final int request = rr.getRequest(); 2602 final Message result = rr.getResult(); 2603 final NetworkScanRequest scanRequest = (NetworkScanRequest) rr.mArguments[0]; 2604 2605 mRil.mRilHandler.post(() -> { 2606 mRil.setCompatVersion(request, RIL.RADIO_HAL_VERSION_1_4); 2607 mRil.startNetworkScan(scanRequest, result); 2608 }); 2609 2610 mRil.processResponseFallback(rr, responseInfo, null); 2611 return; 2612 } 2613 2614 NetworkScanResult nsr = null; 2615 if (responseInfo.error == RadioError.NONE) { 2616 nsr = new NetworkScanResult( 2617 NetworkScanResult.SCAN_STATUS_PARTIAL, RadioError.NONE, null); 2618 sendMessageResponse(rr.mResult, nsr); 2619 } 2620 mRil.processResponseDone(rr, responseInfo, nsr); 2621 } 2622 responseDataCallList(RadioResponseInfo responseInfo, List<? extends Object> dataCallResultList)2623 private void responseDataCallList(RadioResponseInfo responseInfo, 2624 List<? extends Object> dataCallResultList) { 2625 RILRequest rr = mRil.processResponse(responseInfo); 2626 2627 if (rr != null) { 2628 ArrayList<DataCallResponse> response = 2629 RIL.convertDataCallResultList(dataCallResultList); 2630 if (responseInfo.error == RadioError.NONE) { 2631 sendMessageResponse(rr.mResult, response); 2632 } 2633 mRil.processResponseDone(rr, responseInfo, response); 2634 } 2635 } 2636 responseDataCallList(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, List<? extends Object> dataCallResultList)2637 private void responseDataCallList(android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2638 List<? extends Object> dataCallResultList) { 2639 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2640 2641 if (rr != null) { 2642 ArrayList<DataCallResponse> response = 2643 RIL.convertDataCallResultList(dataCallResultList); 2644 if (responseInfo.error == RadioError.NONE) { 2645 sendMessageResponse(rr.mResult, response); 2646 } 2647 mRil.processResponseDone_1_6(rr, responseInfo, response); 2648 } 2649 } 2650 responseCellList(RadioResponseInfo responseInfo, ArrayList<NeighboringCell> cells)2651 private void responseCellList(RadioResponseInfo responseInfo, 2652 ArrayList<NeighboringCell> cells) { 2653 RILRequest rr = mRil.processResponse(responseInfo); 2654 2655 if (rr != null) { 2656 int rssi; 2657 String location; 2658 ArrayList<NeighboringCellInfo> ret = new ArrayList<NeighboringCellInfo>(); 2659 NeighboringCellInfo cell; 2660 2661 int[] subId = SubscriptionManager.getSubId(mRil.mPhoneId); 2662 int radioType = 2663 ((TelephonyManager) mRil.mContext.getSystemService( 2664 Context.TELEPHONY_SERVICE)).getDataNetworkType(subId[0]); 2665 2666 if (radioType != TelephonyManager.NETWORK_TYPE_UNKNOWN) { 2667 for (int i = 0; i < cells.size(); i++) { 2668 rssi = cells.get(i).rssi; 2669 location = cells.get(i).cid; 2670 cell = new NeighboringCellInfo(rssi, location, radioType); 2671 ret.add(cell); 2672 } 2673 } 2674 if (responseInfo.error == RadioError.NONE) { 2675 sendMessageResponse(rr.mResult, ret); 2676 } 2677 mRil.processResponseDone(rr, responseInfo, ret); 2678 } 2679 } 2680 responseGmsBroadcastConfig(RadioResponseInfo responseInfo, ArrayList<GsmBroadcastSmsConfigInfo> configs)2681 private void responseGmsBroadcastConfig(RadioResponseInfo responseInfo, 2682 ArrayList<GsmBroadcastSmsConfigInfo> configs) { 2683 RILRequest rr = mRil.processResponse(responseInfo); 2684 2685 if (rr != null) { 2686 ArrayList<SmsBroadcastConfigInfo> ret = new ArrayList<SmsBroadcastConfigInfo>(); 2687 for (int i = 0; i < configs.size(); i++) { 2688 ret.add(new SmsBroadcastConfigInfo(configs.get(i).fromServiceId, 2689 configs.get(i).toServiceId, configs.get(i).fromCodeScheme, 2690 configs.get(i).toCodeScheme, configs.get(i).selected)); 2691 } 2692 if (responseInfo.error == RadioError.NONE) { 2693 sendMessageResponse(rr.mResult, ret); 2694 } 2695 mRil.processResponseDone(rr, responseInfo, ret); 2696 } 2697 } 2698 responseCdmaBroadcastConfig(RadioResponseInfo responseInfo, ArrayList<CdmaBroadcastSmsConfigInfo> configs)2699 private void responseCdmaBroadcastConfig(RadioResponseInfo responseInfo, 2700 ArrayList<CdmaBroadcastSmsConfigInfo> configs) { 2701 RILRequest rr = mRil.processResponse(responseInfo); 2702 2703 if (rr != null) { 2704 int[] ret = null; 2705 2706 int numServiceCategories = configs.size(); 2707 2708 if (numServiceCategories == 0) { 2709 // TODO: The logic of providing default values should 2710 // not be done by this transport layer. And needs to 2711 // be done by the vendor ril or application logic. 2712 int numInts; 2713 numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES 2714 * CDMA_BSI_NO_OF_INTS_STRUCT + 1; 2715 ret = new int[numInts]; 2716 2717 // Faking a default record for all possible records. 2718 ret[0] = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES; 2719 2720 // Loop over CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES set 'english' as 2721 // default language and selection status to false for all. 2722 for (int i = 1; i < numInts; i += CDMA_BSI_NO_OF_INTS_STRUCT) { 2723 ret[i + 0] = i / CDMA_BSI_NO_OF_INTS_STRUCT; 2724 ret[i + 1] = 1; 2725 ret[i + 2] = 0; 2726 } 2727 } else { 2728 int numInts; 2729 numInts = (numServiceCategories * CDMA_BSI_NO_OF_INTS_STRUCT) + 1; 2730 ret = new int[numInts]; 2731 2732 ret[0] = numServiceCategories; 2733 for (int i = 1, j = 0; j < configs.size(); 2734 j++, i = i + CDMA_BSI_NO_OF_INTS_STRUCT) { 2735 ret[i] = configs.get(j).serviceCategory; 2736 ret[i + 1] = configs.get(j).language; 2737 ret[i + 2] = configs.get(j).selected ? 1 : 0; 2738 } 2739 } 2740 if (responseInfo.error == RadioError.NONE) { 2741 sendMessageResponse(rr.mResult, ret); 2742 } 2743 mRil.processResponseDone(rr, responseInfo, ret); 2744 } 2745 } 2746 responseCellInfoList(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.CellInfo> cellInfo)2747 private void responseCellInfoList(RadioResponseInfo responseInfo, 2748 ArrayList<android.hardware.radio.V1_0.CellInfo> cellInfo) { 2749 RILRequest rr = mRil.processResponse(responseInfo); 2750 2751 if (rr != null) { 2752 ArrayList<CellInfo> ret = RIL.convertHalCellInfoList(cellInfo); 2753 if (responseInfo.error == RadioError.NONE) { 2754 sendMessageResponse(rr.mResult, ret); 2755 } 2756 mRil.processResponseDone(rr, responseInfo, ret); 2757 } 2758 } 2759 responseCellInfoList_1_2( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo)2760 private void responseCellInfoList_1_2( 2761 RadioResponseInfo responseInfo, 2762 ArrayList<android.hardware.radio.V1_2.CellInfo> cellInfo) { 2763 RILRequest rr = mRil.processResponse(responseInfo); 2764 2765 if (rr != null) { 2766 ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_2(cellInfo); 2767 if (responseInfo.error == RadioError.NONE) { 2768 sendMessageResponse(rr.mResult, ret); 2769 } 2770 mRil.processResponseDone(rr, responseInfo, ret); 2771 } 2772 } 2773 responseCellInfoList_1_4( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_4.CellInfo> cellInfo)2774 private void responseCellInfoList_1_4( 2775 RadioResponseInfo responseInfo, 2776 ArrayList<android.hardware.radio.V1_4.CellInfo> cellInfo) { 2777 RILRequest rr = mRil.processResponse(responseInfo); 2778 2779 if (rr != null) { 2780 ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_4(cellInfo); 2781 if (responseInfo.error == RadioError.NONE) { 2782 sendMessageResponse(rr.mResult, ret); 2783 } 2784 mRil.processResponseDone(rr, responseInfo, ret); 2785 } 2786 } 2787 responseCellInfoList_1_5(RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_5.CellInfo> cellInfo)2788 private void responseCellInfoList_1_5(RadioResponseInfo responseInfo, 2789 ArrayList<android.hardware.radio.V1_5.CellInfo> cellInfo) { 2790 RILRequest rr = mRil.processResponse(responseInfo); 2791 2792 if (rr != null) { 2793 ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_5(cellInfo); 2794 if (responseInfo.error == RadioError.NONE) { 2795 sendMessageResponse(rr.mResult, ret); 2796 } 2797 mRil.processResponseDone(rr, responseInfo, ret); 2798 } 2799 } 2800 responseCellInfoList_1_6( android.hardware.radio.V1_6.RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_6.CellInfo> cellInfo)2801 private void responseCellInfoList_1_6( 2802 android.hardware.radio.V1_6.RadioResponseInfo responseInfo, 2803 ArrayList<android.hardware.radio.V1_6.CellInfo> cellInfo) { 2804 RILRequest rr = mRil.processResponse_1_6(responseInfo); 2805 2806 if (rr != null) { 2807 ArrayList<CellInfo> ret = RIL.convertHalCellInfoList_1_6(cellInfo); 2808 if (responseInfo.error == RadioError.NONE) { 2809 sendMessageResponse(rr.mResult, ret); 2810 } 2811 mRil.processResponseDone_1_6(rr, responseInfo, ret); 2812 } 2813 } 2814 responseActivityData(RadioResponseInfo responseInfo, ActivityStatsInfo activityInfo)2815 private void responseActivityData(RadioResponseInfo responseInfo, 2816 ActivityStatsInfo activityInfo) { 2817 RILRequest rr = mRil.processResponse(responseInfo); 2818 2819 if (rr != null) { 2820 ModemActivityInfo ret = null; 2821 if (responseInfo.error == RadioError.NONE) { 2822 final int sleepModeTimeMs = activityInfo.sleepModeTimeMs; 2823 final int idleModeTimeMs = activityInfo.idleModeTimeMs; 2824 int [] txModeTimeMs = new int[ModemActivityInfo.getNumTxPowerLevels()]; 2825 for (int i = 0; i < ModemActivityInfo.getNumTxPowerLevels(); i++) { 2826 txModeTimeMs[i] = activityInfo.txmModetimeMs[i]; 2827 } 2828 final int rxModeTimeMs = activityInfo.rxModeTimeMs; 2829 ret = new ModemActivityInfo(SystemClock.elapsedRealtime(), sleepModeTimeMs, 2830 idleModeTimeMs, txModeTimeMs, rxModeTimeMs); 2831 } else { 2832 ret = new ModemActivityInfo(0, 0, 0, 2833 new int[ModemActivityInfo.getNumTxPowerLevels()], 0); 2834 responseInfo.error = RadioError.NONE; 2835 } 2836 sendMessageResponse(rr.mResult, ret); 2837 mRil.processResponseDone(rr, responseInfo, ret); 2838 } 2839 } 2840 responseHardwareConfig( RadioResponseInfo responseInfo, ArrayList<android.hardware.radio.V1_0.HardwareConfig> config)2841 private void responseHardwareConfig( 2842 RadioResponseInfo responseInfo, 2843 ArrayList<android.hardware.radio.V1_0.HardwareConfig> config) { 2844 RILRequest rr = mRil.processResponse(responseInfo); 2845 2846 if (rr != null) { 2847 ArrayList<HardwareConfig> ret = RIL.convertHalHwConfigList(config, mRil); 2848 if (responseInfo.error == RadioError.NONE) { 2849 sendMessageResponse(rr.mResult, ret); 2850 } 2851 mRil.processResponseDone(rr, responseInfo, ret); 2852 } 2853 } 2854 responseRadioCapability(RadioResponseInfo responseInfo, android.hardware.radio.V1_0.RadioCapability rc)2855 private void responseRadioCapability(RadioResponseInfo responseInfo, 2856 android.hardware.radio.V1_0.RadioCapability rc) { 2857 RILRequest rr = mRil.processResponse(responseInfo); 2858 2859 if (rr != null) { 2860 RadioCapability ret = RIL.convertHalRadioCapability(rc, mRil); 2861 if (responseInfo.error == RadioError.NONE) { 2862 sendMessageResponse(rr.mResult, ret); 2863 } 2864 mRil.processResponseDone(rr, responseInfo, ret); 2865 } 2866 } 2867 responseLceStatus(RadioResponseInfo responseInfo, LceStatusInfo statusInfo)2868 private void responseLceStatus(RadioResponseInfo responseInfo, LceStatusInfo statusInfo) { 2869 RILRequest rr = mRil.processResponse(responseInfo); 2870 2871 if (rr != null) { 2872 ArrayList<Integer> ret = new ArrayList<Integer>(); 2873 ret.add(statusInfo.lceStatus); 2874 ret.add(Byte.toUnsignedInt(statusInfo.actualIntervalMs)); 2875 if (responseInfo.error == RadioError.NONE) { 2876 sendMessageResponse(rr.mResult, ret); 2877 } 2878 mRil.processResponseDone(rr, responseInfo, ret); 2879 } 2880 } 2881 responseLceData(RadioResponseInfo responseInfo, LceDataInfo lceInfo)2882 private void responseLceData(RadioResponseInfo responseInfo, LceDataInfo lceInfo) { 2883 RILRequest rr = mRil.processResponse(responseInfo); 2884 2885 if (rr != null) { 2886 List<LinkCapacityEstimate> ret = RIL.convertHalLceData(lceInfo, mRil); 2887 if (responseInfo.error == RadioError.NONE) { 2888 sendMessageResponse(rr.mResult, ret); 2889 } 2890 mRil.processResponseDone(rr, responseInfo, ret); 2891 } 2892 } 2893 convertCarrierList(List<Carrier> carrierList)2894 private static List<CarrierIdentifier> convertCarrierList(List<Carrier> carrierList) { 2895 List<CarrierIdentifier> ret = new ArrayList<>(); 2896 for (int i = 0; i < carrierList.size(); i++) { 2897 String mcc = carrierList.get(i).mcc; 2898 String mnc = carrierList.get(i).mnc; 2899 String spn = null, imsi = null, gid1 = null, gid2 = null; 2900 int matchType = carrierList.get(i).matchType; 2901 String matchData = carrierList.get(i).matchData; 2902 if (matchType == CarrierIdentifier.MatchType.SPN) { 2903 spn = matchData; 2904 } else if (matchType == CarrierIdentifier.MatchType.IMSI_PREFIX) { 2905 imsi = matchData; 2906 } else if (matchType == CarrierIdentifier.MatchType.GID1) { 2907 gid1 = matchData; 2908 } else if (matchType == CarrierIdentifier.MatchType.GID2) { 2909 gid2 = matchData; 2910 } 2911 ret.add(new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, gid2)); 2912 } 2913 return ret; 2914 } 2915 responseCarrierRestrictions(RadioResponseInfo responseInfo, boolean allAllowed, CarrierRestrictionsWithPriority carriers, int multiSimPolicy)2916 private void responseCarrierRestrictions(RadioResponseInfo responseInfo, boolean allAllowed, 2917 CarrierRestrictionsWithPriority carriers, 2918 int multiSimPolicy) { 2919 RILRequest rr = mRil.processResponse(responseInfo); 2920 if (rr == null) { 2921 return; 2922 } 2923 CarrierRestrictionRules ret; 2924 2925 if (allAllowed) { 2926 ret = CarrierRestrictionRules.newBuilder().setAllCarriersAllowed().build(); 2927 } else { 2928 int policy = CarrierRestrictionRules.MULTISIM_POLICY_NONE; 2929 if (multiSimPolicy == SimLockMultiSimPolicy.ONE_VALID_SIM_MUST_BE_PRESENT) { 2930 policy = CarrierRestrictionRules.MULTISIM_POLICY_ONE_VALID_SIM_MUST_BE_PRESENT; 2931 } 2932 2933 int carrierRestrictionDefault = 2934 CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED; 2935 if (!carriers.allowedCarriersPrioritized) { 2936 carrierRestrictionDefault = 2937 CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_ALLOWED; 2938 } 2939 2940 ret = CarrierRestrictionRules.newBuilder() 2941 .setAllowedCarriers(convertCarrierList(carriers.allowedCarriers)) 2942 .setExcludedCarriers(convertCarrierList(carriers.excludedCarriers)) 2943 .setDefaultCarrierRestriction(carrierRestrictionDefault) 2944 .setMultiSimPolicy(policy) 2945 .build(); 2946 } 2947 2948 if (responseInfo.error == RadioError.NONE) { 2949 sendMessageResponse(rr.mResult, ret); 2950 } 2951 mRil.processResponseDone(rr, responseInfo, ret); 2952 } 2953 2954 /** 2955 * @param responseInfo Response info struct containing response type, serial number and error. 2956 */ enableModemResponse(RadioResponseInfo responseInfo)2957 public void enableModemResponse(RadioResponseInfo responseInfo) { 2958 responseVoid(responseInfo); 2959 } 2960 2961 /** 2962 * @param responseInfo Response info struct containing response type, serial no. and error 2963 * @param isEnabled whether the modem stack is enabled. 2964 */ getModemStackStatusResponse(RadioResponseInfo responseInfo, boolean isEnabled)2965 public void getModemStackStatusResponse(RadioResponseInfo responseInfo, boolean isEnabled) { 2966 RILRequest rr = mRil.processResponse(responseInfo); 2967 2968 if (rr != null) { 2969 if (responseInfo.error == RadioError.NONE) { 2970 sendMessageResponse(rr.mResult, isEnabled); 2971 } 2972 mRil.processResponseDone(rr, responseInfo, isEnabled); 2973 } 2974 } 2975 2976 /** 2977 * @param responseInfo Response info struct containing response type, serial number and error. 2978 */ setSystemSelectionChannelsResponse(RadioResponseInfo responseInfo)2979 public void setSystemSelectionChannelsResponse(RadioResponseInfo responseInfo) { 2980 responseVoid(responseInfo); 2981 } 2982 2983 /** 2984 * @param responseInfo Response info struct containing response type, serial no. and error. 2985 */ enableUiccApplicationsResponse(RadioResponseInfo responseInfo)2986 public void enableUiccApplicationsResponse(RadioResponseInfo responseInfo) { 2987 responseVoid(responseInfo); 2988 } 2989 2990 /** 2991 * @param responseInfo Response info struct containing response type, serial no. and error. 2992 * @param enabled whether Uicc applications are enabled. 2993 */ areUiccApplicationsEnabledResponse(RadioResponseInfo responseInfo, boolean enabled)2994 public void areUiccApplicationsEnabledResponse(RadioResponseInfo responseInfo, 2995 boolean enabled) { 2996 RILRequest rr = mRil.processResponse(responseInfo); 2997 2998 if (rr != null) { 2999 if (responseInfo.error == RadioError.NONE) { 3000 sendMessageResponse(rr.mResult, enabled); 3001 } 3002 mRil.processResponseDone(rr, responseInfo, enabled); 3003 } 3004 } 3005 3006 /** 3007 * @param info Response info struct containing response type, serial no. and error. 3008 */ setRadioPowerResponse_1_5(RadioResponseInfo info)3009 public void setRadioPowerResponse_1_5(RadioResponseInfo info) { 3010 responseVoid(info); 3011 mRil.mLastRadioPowerResult = info.error; 3012 if (info.error != RadioError.RADIO_NOT_AVAILABLE && info.error != RadioError.NONE) { 3013 AnomalyReporter.reportAnomaly( 3014 UUID.fromString(RADIO_POWER_FAILURE_BUGREPORT_UUID), "Radio power failure"); 3015 } 3016 } 3017 3018 /** 3019 * @param info Response info struct containing response type, serial no. and error. 3020 */ setRadioPowerResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info)3021 public void setRadioPowerResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info) { 3022 responseVoid_1_6(info); 3023 mRil.mLastRadioPowerResult = info.error; 3024 if (info.error == android.hardware.radio.V1_6.RadioError.RF_HARDWARE_ISSUE) { 3025 AnomalyReporter.reportAnomaly( 3026 UUID.fromString(RADIO_POWER_FAILURE_RF_HARDWARE_ISSUE_UUID), "RF HW damaged"); 3027 } else if (info.error == android.hardware.radio.V1_6.RadioError.NO_RF_CALIBRATION_INFO) { 3028 AnomalyReporter.reportAnomaly( 3029 UUID.fromString(RADIO_POWER_FAILURE_NO_RF_CALIBRATION_UUID), 3030 "No RF calibration data"); 3031 } else if (info.error != android.hardware.radio.V1_6.RadioError.RADIO_NOT_AVAILABLE 3032 && info.error != android.hardware.radio.V1_6.RadioError.NONE) { 3033 AnomalyReporter.reportAnomaly( 3034 UUID.fromString(RADIO_POWER_FAILURE_BUGREPORT_UUID), "Radio power failure"); 3035 } 3036 } 3037 3038 /** 3039 * @param info Response info struct containing response type, serial no. and error. 3040 */ setSystemSelectionChannelsResponse_1_5(RadioResponseInfo info)3041 public void setSystemSelectionChannelsResponse_1_5(RadioResponseInfo info) { 3042 responseVoid(info); 3043 } 3044 3045 3046 /** 3047 * @param info Response info struct containing response type, serial no. and error. 3048 * @param halSpecifiers List of RadioAccessSpecifiers that are scanned. 3049 */ getSystemSelectionChannelsResponse( android.hardware.radio.V1_6.RadioResponseInfo info, ArrayList<android.hardware.radio.V1_5.RadioAccessSpecifier> halSpecifiers)3050 public void getSystemSelectionChannelsResponse( 3051 android.hardware.radio.V1_6.RadioResponseInfo info, 3052 ArrayList<android.hardware.radio.V1_5.RadioAccessSpecifier> halSpecifiers) { 3053 RILRequest rr = mRil.processResponse_1_6(info); 3054 3055 if (rr != null) { 3056 ArrayList<RadioAccessSpecifier> specifiers = new ArrayList<>(); 3057 for (android.hardware.radio.V1_5.RadioAccessSpecifier specifier : halSpecifiers) { 3058 specifiers.add(convertRadioAccessSpecifier(specifier)); 3059 } 3060 mRil.riljLog("getSystemSelectionChannelsResponse: from HIDL: " + specifiers); 3061 if (info.error == RadioError.NONE) { 3062 sendMessageResponse(rr.mResult, specifiers); 3063 } 3064 mRil.processResponseDone_1_6(rr, info, specifiers); 3065 } 3066 } 3067 convertRadioAccessSpecifier( android.hardware.radio.V1_5.RadioAccessSpecifier specifier)3068 private static RadioAccessSpecifier convertRadioAccessSpecifier( 3069 android.hardware.radio.V1_5.RadioAccessSpecifier specifier) { 3070 if (specifier == null) return null; 3071 ArrayList<Integer> halBands = new ArrayList<>(); 3072 switch (specifier.bands.getDiscriminator()) { 3073 case android.hardware.radio.V1_5.RadioAccessSpecifier.Bands.hidl_discriminator 3074 .geranBands: 3075 halBands = specifier.bands.geranBands(); 3076 break; 3077 case android.hardware.radio.V1_5.RadioAccessSpecifier.Bands.hidl_discriminator 3078 .utranBands: 3079 halBands = specifier.bands.utranBands(); 3080 break; 3081 case android.hardware.radio.V1_5.RadioAccessSpecifier.Bands.hidl_discriminator 3082 .eutranBands: 3083 halBands = specifier.bands.eutranBands(); 3084 break; 3085 case android.hardware.radio.V1_5.RadioAccessSpecifier.Bands.hidl_discriminator 3086 .ngranBands: 3087 halBands = specifier.bands.ngranBands(); 3088 break; 3089 } 3090 return new RadioAccessSpecifier(convertRanToAnt(specifier.radioAccessNetwork), 3091 halBands.stream().mapToInt(Integer::intValue).toArray(), 3092 specifier.channels.stream().mapToInt(Integer::intValue).toArray()); 3093 } 3094 convertRanToAnt(int ran)3095 private static int convertRanToAnt(int ran) { 3096 switch (ran) { 3097 case android.hardware.radio.V1_5.RadioAccessNetworks.GERAN: 3098 return AccessNetworkConstants.AccessNetworkType.GERAN; 3099 case android.hardware.radio.V1_5.RadioAccessNetworks.UTRAN: 3100 return AccessNetworkConstants.AccessNetworkType.UTRAN; 3101 case android.hardware.radio.V1_5.RadioAccessNetworks.EUTRAN: 3102 return AccessNetworkConstants.AccessNetworkType.EUTRAN; 3103 case android.hardware.radio.V1_5.RadioAccessNetworks.NGRAN: 3104 return AccessNetworkConstants.AccessNetworkType.NGRAN; 3105 case android.hardware.radio.V1_5.RadioAccessNetworks.CDMA2000: 3106 return AccessNetworkConstants.AccessNetworkType.CDMA2000; 3107 case android.hardware.radio.V1_5.RadioAccessNetworks.UNKNOWN: 3108 default: 3109 return AccessNetworkConstants.AccessNetworkType.UNKNOWN; 3110 } 3111 } 3112 3113 /** 3114 * @param responseInfo Response info struct containing response type, serial no. and error. 3115 * @param cellIdentity CellIdentity for the barringInfos. 3116 * @param barringInfos List of BarringInfo for all the barring service types. 3117 */ getBarringInfoResponse(RadioResponseInfo responseInfo, android.hardware.radio.V1_5.CellIdentity cellIdentity, ArrayList<android.hardware.radio.V1_5.BarringInfo> barringInfos)3118 public void getBarringInfoResponse(RadioResponseInfo responseInfo, 3119 android.hardware.radio.V1_5.CellIdentity cellIdentity, 3120 ArrayList<android.hardware.radio.V1_5.BarringInfo> barringInfos) { 3121 RILRequest rr = mRil.processResponse(responseInfo); 3122 3123 if (rr != null) { 3124 BarringInfo bi = BarringInfo.create(cellIdentity, barringInfos); 3125 if (responseInfo.error == RadioError.NONE) { 3126 sendMessageResponse(rr.mResult, bi); 3127 // notify all registrants for the possible barring info change 3128 mRil.mBarringInfoChangedRegistrants.notifyRegistrants( 3129 new AsyncResult(null, bi, null)); 3130 } 3131 mRil.processResponseDone(rr, responseInfo, bi); 3132 } 3133 } 3134 3135 /** 3136 * @param info Response info struct containing response type, serial no. and error 3137 * @param id The pdu session id allocated 3138 */ allocatePduSessionIdResponse(android.hardware.radio.V1_6.RadioResponseInfo info, int id)3139 public void allocatePduSessionIdResponse(android.hardware.radio.V1_6.RadioResponseInfo info, 3140 int id) { 3141 RILRequest rr = mRil.processResponse_1_6(info); 3142 if (rr != null) { 3143 if (info.error == RadioError.NONE) { 3144 sendMessageResponse(rr.mResult, id); 3145 } 3146 mRil.processResponseDone_1_6(rr, info, id); 3147 } 3148 } 3149 3150 /** 3151 * @param info Response info struct containing response type, serial no. and error 3152 */ releasePduSessionIdResponse(android.hardware.radio.V1_6.RadioResponseInfo info)3153 public void releasePduSessionIdResponse(android.hardware.radio.V1_6.RadioResponseInfo info) { 3154 responseVoid_1_6(info); 3155 } 3156 3157 /** 3158 * @param info Response info struct containing response type, serial no. and error 3159 */ startHandoverResponse(android.hardware.radio.V1_6.RadioResponseInfo info)3160 public void startHandoverResponse(android.hardware.radio.V1_6.RadioResponseInfo info) { 3161 responseVoid_1_6(info); 3162 } 3163 3164 /** 3165 * @param info Response info struct containing response type, serial no. and error 3166 */ cancelHandoverResponse(android.hardware.radio.V1_6.RadioResponseInfo info)3167 public void cancelHandoverResponse(android.hardware.radio.V1_6.RadioResponseInfo info) { 3168 responseVoid_1_6(info); 3169 } 3170 3171 /** 3172 * @param info Response info struct containing response type, serial no. and error 3173 * @param slicingConfig Current slicing configuration 3174 */ getSlicingConfigResponse(android.hardware.radio.V1_6.RadioResponseInfo info, android.hardware.radio.V1_6.SlicingConfig slicingConfig)3175 public void getSlicingConfigResponse(android.hardware.radio.V1_6.RadioResponseInfo info, 3176 android.hardware.radio.V1_6.SlicingConfig slicingConfig) { 3177 RILRequest rr = mRil.processResponse_1_6(info); 3178 3179 if (rr != null) { 3180 NetworkSlicingConfig ret = new NetworkSlicingConfig(slicingConfig); 3181 if (info.error == RadioError.NONE) { 3182 sendMessageResponse(rr.mResult, ret); 3183 } 3184 mRil.processResponseDone_1_6(rr, info, ret); 3185 } 3186 } 3187 } 3188