1 /* 2 * Copyright (C) 2007 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.Intent; 20 import android.os.Bundle; 21 import android.telecom.PhoneAccount; 22 import android.telephony.CellInfo; 23 import android.telephony.IccOpenLogicalChannelResponse; 24 import android.telephony.NeighboringCellInfo; 25 import android.telephony.RadioAccessFamily; 26 import android.telephony.ModemActivityInfo; 27 import com.android.internal.telephony.CellNetworkScanResult; 28 import com.android.internal.telephony.OperatorInfo; 29 import java.util.List; 30 31 32 /** 33 * Interface used to interact with the phone. Mostly this is used by the 34 * TelephonyManager class. A few places are still using this directly. 35 * Please clean them up if possible and use TelephonyManager instead. 36 * 37 * {@hide} 38 */ 39 interface ITelephony { 40 41 /** 42 * Dial a number. This doesn't place the call. It displays 43 * the Dialer screen. 44 * @param number the number to be dialed. If null, this 45 * would display the Dialer screen with no number pre-filled. 46 */ dial(String number)47 void dial(String number); 48 49 /** 50 * Place a call to the specified number. 51 * @param callingPackage The package making the call. 52 * @param number the number to be called. 53 */ call(String callingPackage, String number)54 void call(String callingPackage, String number); 55 56 /** 57 * End call if there is a call in progress, otherwise does nothing. 58 * 59 * @return whether it hung up 60 */ endCall()61 boolean endCall(); 62 63 /** 64 * End call on particular subId or go to the Home screen 65 * @param subId user preferred subId. 66 * @return whether it hung up 67 */ endCallForSubscriber(int subId)68 boolean endCallForSubscriber(int subId); 69 70 /** 71 * Answer the currently-ringing call. 72 * 73 * If there's already a current active call, that call will be 74 * automatically put on hold. If both lines are currently in use, the 75 * current active call will be ended. 76 * 77 * TODO: provide a flag to let the caller specify what policy to use 78 * if both lines are in use. (The current behavior is hardwired to 79 * "answer incoming, end ongoing", which is how the CALL button 80 * is specced to behave.) 81 * 82 * TODO: this should be a oneway call (especially since it's called 83 * directly from the key queue thread). 84 */ answerRingingCall()85 void answerRingingCall(); 86 87 /** 88 * Answer the currently-ringing call on particular subId . 89 * 90 * If there's already a current active call, that call will be 91 * automatically put on hold. If both lines are currently in use, the 92 * current active call will be ended. 93 * 94 * TODO: provide a flag to let the caller specify what policy to use 95 * if both lines are in use. (The current behavior is hardwired to 96 * "answer incoming, end ongoing", which is how the CALL button 97 * is specced to behave.) 98 * 99 * TODO: this should be a oneway call (especially since it's called 100 * directly from the key queue thread). 101 */ answerRingingCallForSubscriber(int subId)102 void answerRingingCallForSubscriber(int subId); 103 104 /** 105 * Silence the ringer if an incoming call is currently ringing. 106 * (If vibrating, stop the vibrator also.) 107 * 108 * It's safe to call this if the ringer has already been silenced, or 109 * even if there's no incoming call. (If so, this method will do nothing.) 110 * 111 * TODO: this should be a oneway call too (see above). 112 * (Actually *all* the methods here that return void can 113 * probably be oneway.) 114 */ silenceRinger()115 void silenceRinger(); 116 117 /** 118 * Check if we are in either an active or holding call 119 * @param callingPackage the name of the package making the call. 120 * @return true if the phone state is OFFHOOK. 121 */ isOffhook(String callingPackage)122 boolean isOffhook(String callingPackage); 123 124 /** 125 * Check if a particular subId has an active or holding call 126 * 127 * @param subId user preferred subId. 128 * @param callingPackage the name of the package making the call. 129 * @return true if the phone state is OFFHOOK. 130 */ isOffhookForSubscriber(int subId, String callingPackage)131 boolean isOffhookForSubscriber(int subId, String callingPackage); 132 133 /** 134 * Check if an incoming phone call is ringing or call waiting 135 * on a particular subId. 136 * 137 * @param subId user preferred subId. 138 * @param callingPackage the name of the package making the call. 139 * @return true if the phone state is RINGING. 140 */ isRingingForSubscriber(int subId, String callingPackage)141 boolean isRingingForSubscriber(int subId, String callingPackage); 142 143 /** 144 * Check if an incoming phone call is ringing or call waiting. 145 * @param callingPackage the name of the package making the call. 146 * @return true if the phone state is RINGING. 147 */ isRinging(String callingPackage)148 boolean isRinging(String callingPackage); 149 150 /** 151 * Check if the phone is idle. 152 * @param callingPackage the name of the package making the call. 153 * @return true if the phone state is IDLE. 154 */ isIdle(String callingPackage)155 boolean isIdle(String callingPackage); 156 157 /** 158 * Check if the phone is idle on a particular subId. 159 * 160 * @param subId user preferred subId. 161 * @param callingPackage the name of the package making the call. 162 * @return true if the phone state is IDLE. 163 */ isIdleForSubscriber(int subId, String callingPackage)164 boolean isIdleForSubscriber(int subId, String callingPackage); 165 166 /** 167 * Check to see if the radio is on or not. 168 * @param callingPackage the name of the package making the call. 169 * @return returns true if the radio is on. 170 */ isRadioOn(String callingPackage)171 boolean isRadioOn(String callingPackage); 172 173 /** 174 * Check to see if the radio is on or not on particular subId. 175 * @param subId user preferred subId. 176 * @param callingPackage the name of the package making the call. 177 * @return returns true if the radio is on. 178 */ isRadioOnForSubscriber(int subId, String callingPackage)179 boolean isRadioOnForSubscriber(int subId, String callingPackage); 180 181 /** 182 * Check if the SIM pin lock is enabled. 183 * @return true if the SIM pin lock is enabled. 184 * @param callingPackage The package making the call. 185 */ isSimPinEnabled(String callingPackage)186 boolean isSimPinEnabled(String callingPackage); 187 188 /** 189 * Supply a pin to unlock the SIM. Blocks until a result is determined. 190 * @param pin The pin to check. 191 * @return whether the operation was a success. 192 */ supplyPin(String pin)193 boolean supplyPin(String pin); 194 195 /** 196 * Supply a pin to unlock the SIM for particular subId. 197 * Blocks until a result is determined. 198 * @param pin The pin to check. 199 * @param subId user preferred subId. 200 * @return whether the operation was a success. 201 */ supplyPinForSubscriber(int subId, String pin)202 boolean supplyPinForSubscriber(int subId, String pin); 203 204 /** 205 * Supply puk to unlock the SIM and set SIM pin to new pin. 206 * Blocks until a result is determined. 207 * @param puk The puk to check. 208 * pin The new pin to be set in SIM 209 * @return whether the operation was a success. 210 */ supplyPuk(String puk, String pin)211 boolean supplyPuk(String puk, String pin); 212 213 /** 214 * Supply puk to unlock the SIM and set SIM pin to new pin. 215 * Blocks until a result is determined. 216 * @param puk The puk to check. 217 * pin The new pin to be set in SIM 218 * @param subId user preferred subId. 219 * @return whether the operation was a success. 220 */ supplyPukForSubscriber(int subId, String puk, String pin)221 boolean supplyPukForSubscriber(int subId, String puk, String pin); 222 223 /** 224 * Supply a pin to unlock the SIM. Blocks until a result is determined. 225 * Returns a specific success/error code. 226 * @param pin The pin to check. 227 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 228 * retValue[1] = number of attempts remaining if known otherwise -1 229 */ supplyPinReportResult(String pin)230 int[] supplyPinReportResult(String pin); 231 232 /** 233 * Supply a pin to unlock the SIM. Blocks until a result is determined. 234 * Returns a specific success/error code. 235 * @param pin The pin to check. 236 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 237 * retValue[1] = number of attempts remaining if known otherwise -1 238 */ supplyPinReportResultForSubscriber(int subId, String pin)239 int[] supplyPinReportResultForSubscriber(int subId, String pin); 240 241 /** 242 * Supply puk to unlock the SIM and set SIM pin to new pin. 243 * Blocks until a result is determined. 244 * Returns a specific success/error code 245 * @param puk The puk to check 246 * pin The pin to check. 247 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 248 * retValue[1] = number of attempts remaining if known otherwise -1 249 */ supplyPukReportResult(String puk, String pin)250 int[] supplyPukReportResult(String puk, String pin); 251 252 /** 253 * Supply puk to unlock the SIM and set SIM pin to new pin. 254 * Blocks until a result is determined. 255 * Returns a specific success/error code 256 * @param puk The puk to check 257 * pin The pin to check. 258 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 259 * retValue[1] = number of attempts remaining if known otherwise -1 260 */ supplyPukReportResultForSubscriber(int subId, String puk, String pin)261 int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin); 262 263 /** 264 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 265 * without SEND (so <code>dial</code> is not appropriate). 266 * 267 * @param dialString the MMI command to be executed. 268 * @return true if MMI command is executed. 269 */ handlePinMmi(String dialString)270 boolean handlePinMmi(String dialString); 271 272 /** 273 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 274 * without SEND (so <code>dial</code> is not appropriate) for 275 * a particular subId. 276 * @param dialString the MMI command to be executed. 277 * @param subId user preferred subId. 278 * @return true if MMI command is executed. 279 */ handlePinMmiForSubscriber(int subId, String dialString)280 boolean handlePinMmiForSubscriber(int subId, String dialString); 281 282 /** 283 * Toggles the radio on or off. 284 */ toggleRadioOnOff()285 void toggleRadioOnOff(); 286 287 /** 288 * Toggles the radio on or off on particular subId. 289 * @param subId user preferred subId. 290 */ toggleRadioOnOffForSubscriber(int subId)291 void toggleRadioOnOffForSubscriber(int subId); 292 293 /** 294 * Set the radio to on or off 295 */ setRadio(boolean turnOn)296 boolean setRadio(boolean turnOn); 297 298 /** 299 * Set the radio to on or off on particular subId. 300 * @param subId user preferred subId. 301 */ setRadioForSubscriber(int subId, boolean turnOn)302 boolean setRadioForSubscriber(int subId, boolean turnOn); 303 304 /** 305 * Set the radio to on or off unconditionally 306 */ setRadioPower(boolean turnOn)307 boolean setRadioPower(boolean turnOn); 308 309 /** 310 * Request to update location information in service state 311 */ updateServiceLocation()312 void updateServiceLocation(); 313 314 /** 315 * Request to update location information for a subscrition in service state 316 * @param subId user preferred subId. 317 */ updateServiceLocationForSubscriber(int subId)318 void updateServiceLocationForSubscriber(int subId); 319 320 /** 321 * Enable location update notifications. 322 */ enableLocationUpdates()323 void enableLocationUpdates(); 324 325 /** 326 * Enable location update notifications. 327 * @param subId user preferred subId. 328 */ enableLocationUpdatesForSubscriber(int subId)329 void enableLocationUpdatesForSubscriber(int subId); 330 331 /** 332 * Disable location update notifications. 333 */ disableLocationUpdates()334 void disableLocationUpdates(); 335 336 /** 337 * Disable location update notifications. 338 * @param subId user preferred subId. 339 */ disableLocationUpdatesForSubscriber(int subId)340 void disableLocationUpdatesForSubscriber(int subId); 341 342 /** 343 * Allow mobile data connections. 344 */ enableDataConnectivity()345 boolean enableDataConnectivity(); 346 347 /** 348 * Disallow mobile data connections. 349 */ disableDataConnectivity()350 boolean disableDataConnectivity(); 351 352 /** 353 * Report whether data connectivity is possible. 354 */ isDataConnectivityPossible()355 boolean isDataConnectivityPossible(); 356 getCellLocation(String callingPkg)357 Bundle getCellLocation(String callingPkg); 358 359 /** 360 * Returns the neighboring cell information of the device. 361 */ getNeighboringCellInfo(String callingPkg)362 List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg); 363 getCallState()364 int getCallState(); 365 366 /** 367 * Returns the call state for a subId. 368 */ getCallStateForSubscriber(int subId)369 int getCallStateForSubscriber(int subId); 370 getDataActivity()371 int getDataActivity(); getDataState()372 int getDataState(); 373 374 /** 375 * Returns the current active phone type as integer. 376 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE 377 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE 378 */ getActivePhoneType()379 int getActivePhoneType(); 380 381 /** 382 * Returns the current active phone type as integer for particular subId. 383 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE 384 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE 385 * @param subId user preferred subId. 386 */ getActivePhoneTypeForSubscriber(int subId)387 int getActivePhoneTypeForSubscriber(int subId); 388 389 /** 390 * Returns the CDMA ERI icon index to display 391 * @param callingPackage package making the call. 392 */ getCdmaEriIconIndex(String callingPackage)393 int getCdmaEriIconIndex(String callingPackage); 394 395 /** 396 * Returns the CDMA ERI icon index to display on particular subId. 397 * @param subId user preferred subId. 398 * @param callingPackage package making the call. 399 */ getCdmaEriIconIndexForSubscriber(int subId, String callingPackage)400 int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage); 401 402 /** 403 * Returns the CDMA ERI icon mode, 404 * 0 - ON 405 * 1 - FLASHING 406 * @param callingPackage package making the call. 407 */ getCdmaEriIconMode(String callingPackage)408 int getCdmaEriIconMode(String callingPackage); 409 410 /** 411 * Returns the CDMA ERI icon mode on particular subId, 412 * 0 - ON 413 * 1 - FLASHING 414 * @param subId user preferred subId. 415 * @param callingPackage package making the call. 416 */ getCdmaEriIconModeForSubscriber(int subId, String callingPackage)417 int getCdmaEriIconModeForSubscriber(int subId, String callingPackage); 418 419 /** 420 * Returns the CDMA ERI text, 421 * @param callingPackage package making the call. 422 */ getCdmaEriText(String callingPackage)423 String getCdmaEriText(String callingPackage); 424 425 /** 426 * Returns the CDMA ERI text for particular subId, 427 * @param subId user preferred subId. 428 * @param callingPackage package making the call. 429 */ getCdmaEriTextForSubscriber(int subId, String callingPackage)430 String getCdmaEriTextForSubscriber(int subId, String callingPackage); 431 432 /** 433 * Returns true if OTA service provisioning needs to run. 434 * Only relevant on some technologies, others will always 435 * return false. 436 */ needsOtaServiceProvisioning()437 boolean needsOtaServiceProvisioning(); 438 439 /** 440 * Sets the voicemail number for a particular subscriber. 441 */ setVoiceMailNumber(int subId, String alphaTag, String number)442 boolean setVoiceMailNumber(int subId, String alphaTag, String number); 443 444 /** 445 * Returns the unread count of voicemails 446 */ getVoiceMessageCount()447 int getVoiceMessageCount(); 448 449 /** 450 * Returns the unread count of voicemails for a subId. 451 * @param subId user preferred subId. 452 * Returns the unread count of voicemails 453 */ getVoiceMessageCountForSubscriber(int subId)454 int getVoiceMessageCountForSubscriber(int subId); 455 456 /** 457 * Returns the network type for data transmission 458 * Legacy call, permission-free 459 */ getNetworkType()460 int getNetworkType(); 461 462 /** 463 * Returns the network type of a subId. 464 * @param subId user preferred subId. 465 * @param callingPackage package making the call. 466 */ getNetworkTypeForSubscriber(int subId, String callingPackage)467 int getNetworkTypeForSubscriber(int subId, String callingPackage); 468 469 /** 470 * Returns the network type for data transmission 471 * @param callingPackage package making the call. 472 */ getDataNetworkType(String callingPackage)473 int getDataNetworkType(String callingPackage); 474 475 /** 476 * Returns the data network type of a subId 477 * @param subId user preferred subId. 478 * @param callingPackage package making the call. 479 */ getDataNetworkTypeForSubscriber(int subId, String callingPackage)480 int getDataNetworkTypeForSubscriber(int subId, String callingPackage); 481 482 /** 483 * Returns the voice network type of a subId 484 * @param subId user preferred subId. 485 * @param callingPackage package making the call. 486 * Returns the network type 487 */ getVoiceNetworkTypeForSubscriber(int subId, String callingPackage)488 int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage); 489 490 /** 491 * Return true if an ICC card is present 492 */ hasIccCard()493 boolean hasIccCard(); 494 495 /** 496 * Return true if an ICC card is present for a subId. 497 * @param slotId user preferred slotId. 498 * Return true if an ICC card is present 499 */ hasIccCardUsingSlotId(int slotId)500 boolean hasIccCardUsingSlotId(int slotId); 501 502 /** 503 * Return if the current radio is LTE on CDMA. This 504 * is a tri-state return value as for a period of time 505 * the mode may be unknown. 506 * 507 * @param callingPackage the name of the calling package 508 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} 509 * or {@link PHone#LTE_ON_CDMA_TRUE} 510 */ getLteOnCdmaMode(String callingPackage)511 int getLteOnCdmaMode(String callingPackage); 512 513 /** 514 * Return if the current radio is LTE on CDMA. This 515 * is a tri-state return value as for a period of time 516 * the mode may be unknown. 517 * 518 * @param callingPackage the name of the calling package 519 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} 520 * or {@link PHone#LTE_ON_CDMA_TRUE} 521 */ getLteOnCdmaModeForSubscriber(int subId, String callingPackage)522 int getLteOnCdmaModeForSubscriber(int subId, String callingPackage); 523 524 /** 525 * Returns the all observed cell information of the device. 526 */ getAllCellInfo(String callingPkg)527 List<CellInfo> getAllCellInfo(String callingPkg); 528 529 /** 530 * Sets minimum time in milli-seconds between onCellInfoChanged 531 */ setCellInfoListRate(int rateInMillis)532 void setCellInfoListRate(int rateInMillis); 533 534 /** 535 * get default sim 536 * @return sim id 537 */ getDefaultSim()538 int getDefaultSim(); 539 540 /** 541 * Opens a logical channel to the ICC card. 542 * 543 * Input parameters equivalent to TS 27.007 AT+CCHO command. 544 * 545 * @param AID Application id. See ETSI 102.221 and 101.220. 546 * @return an IccOpenLogicalChannelResponse object. 547 */ iccOpenLogicalChannel(String AID)548 IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID); 549 550 /** 551 * Closes a previously opened logical channel to the ICC card. 552 * 553 * Input parameters equivalent to TS 27.007 AT+CCHC command. 554 * 555 * @param channel is the channel id to be closed as retruned by a 556 * successful iccOpenLogicalChannel. 557 * @return true if the channel was closed successfully. 558 */ iccCloseLogicalChannel(int channel)559 boolean iccCloseLogicalChannel(int channel); 560 561 /** 562 * Transmit an APDU to the ICC card over a logical channel. 563 * 564 * Input parameters equivalent to TS 27.007 AT+CGLA command. 565 * 566 * @param channel is the channel id to be closed as retruned by a 567 * successful iccOpenLogicalChannel. 568 * @param cla Class of the APDU command. 569 * @param instruction Instruction of the APDU command. 570 * @param p1 P1 value of the APDU command. 571 * @param p2 P2 value of the APDU command. 572 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU 573 * is sent to the SIM. 574 * @param data Data to be sent with the APDU. 575 * @return The APDU response from the ICC card with the status appended at 576 * the end. 577 */ iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2, int p3, String data)578 String iccTransmitApduLogicalChannel(int channel, int cla, int instruction, 579 int p1, int p2, int p3, String data); 580 581 /** 582 * Transmit an APDU to the ICC card over the basic channel. 583 * 584 * Input parameters equivalent to TS 27.007 AT+CSIM command. 585 * 586 * @param cla Class of the APDU command. 587 * @param instruction Instruction of the APDU command. 588 * @param p1 P1 value of the APDU command. 589 * @param p2 P2 value of the APDU command. 590 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU 591 * is sent to the SIM. 592 * @param data Data to be sent with the APDU. 593 * @return The APDU response from the ICC card with the status appended at 594 * the end. 595 */ iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2, int p3, String data)596 String iccTransmitApduBasicChannel(int cla, int instruction, 597 int p1, int p2, int p3, String data); 598 599 /** 600 * Returns the response APDU for a command APDU sent through SIM_IO. 601 * 602 * @param fileID 603 * @param command 604 * @param p1 P1 value of the APDU command. 605 * @param p2 P2 value of the APDU command. 606 * @param p3 P3 value of the APDU command. 607 * @param filePath 608 * @return The APDU response. 609 */ iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3, String filePath)610 byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3, 611 String filePath); 612 613 /** 614 * Send ENVELOPE to the SIM and returns the response. 615 * 616 * @param contents String containing SAT/USAT response in hexadecimal 617 * format starting with command tag. See TS 102 223 for 618 * details. 619 * @return The APDU response from the ICC card, with the last 4 bytes 620 * being the status word. If the command fails, returns an empty 621 * string. 622 */ sendEnvelopeWithStatus(String content)623 String sendEnvelopeWithStatus(String content); 624 625 /** 626 * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. 627 * Used for device configuration by some CDMA operators. 628 * 629 * @param itemID the ID of the item to read. 630 * @return the NV item as a String, or null on any failure. 631 */ nvReadItem(int itemID)632 String nvReadItem(int itemID); 633 634 /** 635 * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. 636 * Used for device configuration by some CDMA operators. 637 * 638 * @param itemID the ID of the item to read. 639 * @param itemValue the value to write, as a String. 640 * @return true on success; false on any failure. 641 */ nvWriteItem(int itemID, String itemValue)642 boolean nvWriteItem(int itemID, String itemValue); 643 644 /** 645 * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage. 646 * Used for device configuration by some CDMA operators. 647 * 648 * @param preferredRoamingList byte array containing the new PRL. 649 * @return true on success; false on any failure. 650 */ nvWriteCdmaPrl(in byte[] preferredRoamingList)651 boolean nvWriteCdmaPrl(in byte[] preferredRoamingList); 652 653 /** 654 * Perform the specified type of NV config reset. The radio will be taken offline 655 * and the device must be rebooted after the operation. Used for device 656 * configuration by some CDMA operators. 657 * 658 * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset). 659 * @return true on success; false on any failure. 660 */ nvResetConfig(int resetType)661 boolean nvResetConfig(int resetType); 662 663 /* 664 * Get the calculated preferred network type. 665 * Used for device configuration by some CDMA operators. 666 * @param callingPackage The package making the call. 667 * 668 * @return the calculated preferred network type, defined in RILConstants.java. 669 */ getCalculatedPreferredNetworkType(String callingPackage)670 int getCalculatedPreferredNetworkType(String callingPackage); 671 672 /* 673 * Get the preferred network type. 674 * Used for device configuration by some CDMA operators. 675 * 676 * @param subId the id of the subscription to query. 677 * @return the preferred network type, defined in RILConstants.java. 678 */ getPreferredNetworkType(int subId)679 int getPreferredNetworkType(int subId); 680 681 /** 682 * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning 683 * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for 684 * tethering. 685 * 686 * @return 0: Not required. 1: required. 2: Not set. 687 */ getTetherApnRequired()688 int getTetherApnRequired(); 689 690 /** 691 * Set the network selection mode to automatic. 692 * 693 * @param subId the id of the subscription to update. 694 */ setNetworkSelectionModeAutomatic(int subId)695 void setNetworkSelectionModeAutomatic(int subId); 696 697 /** 698 * Perform a radio scan and return the list of avialble networks. 699 * 700 * @param subId the id of the subscription. 701 * @return CellNetworkScanResult containing status of scan and networks. 702 */ getCellNetworkScanResults(int subId)703 CellNetworkScanResult getCellNetworkScanResults(int subId); 704 705 /** 706 * Ask the radio to connect to the input network and change selection mode to manual. 707 * 708 * @param subId the id of the subscription. 709 * @param operatorInfo the operator to attach to. 710 * @return true if the request suceeded. 711 */ setNetworkSelectionModeManual(int subId, in OperatorInfo operator)712 boolean setNetworkSelectionModeManual(int subId, in OperatorInfo operator); 713 714 /** 715 * Set the preferred network type. 716 * Used for device configuration by some CDMA operators. 717 * 718 * @param subId the id of the subscription to update. 719 * @param networkType the preferred network type, defined in RILConstants.java. 720 * @return true on success; false on any failure. 721 */ setPreferredNetworkType(int subId, int networkType)722 boolean setPreferredNetworkType(int subId, int networkType); 723 724 /** 725 * User enable/disable Mobile Data. 726 * 727 * @param enable true to turn on, else false 728 */ setDataEnabled(int subId, boolean enable)729 void setDataEnabled(int subId, boolean enable); 730 731 /** 732 * Get the user enabled state of Mobile Data. 733 * 734 * @return true on enabled 735 */ getDataEnabled(int subId)736 boolean getDataEnabled(int subId); 737 738 /** 739 * Get P-CSCF address from PCO after data connection is established or modified. 740 * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN 741 * @param callingPackage The package making the call. 742 */ getPcscfAddress(String apnType, String callingPackage)743 String[] getPcscfAddress(String apnType, String callingPackage); 744 745 /** 746 * Set IMS registration state 747 */ setImsRegistrationState(boolean registered)748 void setImsRegistrationState(boolean registered); 749 750 /** 751 * Return MDN string for CDMA phone. 752 * @param subId user preferred subId. 753 */ getCdmaMdn(int subId)754 String getCdmaMdn(int subId); 755 756 /** 757 * Return MIN string for CDMA phone. 758 * @param subId user preferred subId. 759 */ getCdmaMin(int subId)760 String getCdmaMin(int subId); 761 762 /** 763 * Has the calling application been granted special privileges by the carrier. 764 * 765 * If any of the packages in the calling UID has carrier privileges, the 766 * call will return true. This access is granted by the owner of the UICC 767 * card and does not depend on the registered carrier. 768 * 769 * TODO: Add a link to documentation. 770 * 771 * @return carrier privilege status defined in TelephonyManager. 772 */ getCarrierPrivilegeStatus()773 int getCarrierPrivilegeStatus(); 774 775 /** 776 * Similar to above, but check for the package whose name is pkgName. 777 */ checkCarrierPrivilegesForPackage(String pkgName)778 int checkCarrierPrivilegesForPackage(String pkgName); 779 780 /** 781 * Similar to above, but check across all phones. 782 */ checkCarrierPrivilegesForPackageAnyPhone(String pkgName)783 int checkCarrierPrivilegesForPackageAnyPhone(String pkgName); 784 785 /** 786 * Returns list of the package names of the carrier apps that should handle the input intent 787 * and have carrier privileges for the given phoneId. 788 * 789 * @param intent Intent that will be sent. 790 * @param phoneId The phoneId on which the carrier app has carrier privileges. 791 * @return list of carrier app package names that can handle the intent on phoneId. 792 * Returns null if there is an error and an empty list if there 793 * are no matching packages. 794 */ getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId)795 List<String> getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId); 796 797 /** 798 * Set the line 1 phone number string and its alphatag for the current ICCID 799 * for display purpose only, for example, displayed in Phone Status. It won't 800 * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null 801 * value. 802 * 803 * @param subId the subscriber that the alphatag and dialing number belongs to. 804 * @param alphaTag alpha-tagging of the dailing nubmer 805 * @param number The dialing number 806 * @return true if the operation was executed correctly. 807 */ setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number)808 boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number); 809 810 /** 811 * Returns the displayed dialing number string if it was set previously via 812 * {@link #setLine1NumberForDisplay}. Otherwise returns null. 813 * 814 * @param subId whose dialing number for line 1 is returned. 815 * @param callingPackage The package making the call. 816 * @return the displayed dialing number if set, or null if not set. 817 */ getLine1NumberForDisplay(int subId, String callingPackage)818 String getLine1NumberForDisplay(int subId, String callingPackage); 819 820 /** 821 * Returns the displayed alphatag of the dialing number if it was set 822 * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null. 823 * 824 * @param subId whose alphatag associated with line 1 is returned. 825 * @param callingPackage The package making the call. 826 * @return the displayed alphatag of the dialing number if set, or null if 827 * not set. 828 */ getLine1AlphaTagForDisplay(int subId, String callingPackage)829 String getLine1AlphaTagForDisplay(int subId, String callingPackage); 830 getMergedSubscriberIds(String callingPackage)831 String[] getMergedSubscriberIds(String callingPackage); 832 833 /** 834 * Override the operator branding for the current ICCID. 835 * 836 * Once set, whenever the SIM is present in the device, the service 837 * provider name (SPN) and the operator name will both be replaced by the 838 * brand value input. To unset the value, the same function should be 839 * called with a null brand value. 840 * 841 * <p>Requires Permission: 842 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} 843 * or has to be carrier app - see #hasCarrierPrivileges. 844 * 845 * @param brand The brand name to display/set. 846 * @return true if the operation was executed correctly. 847 */ setOperatorBrandOverride(String brand)848 boolean setOperatorBrandOverride(String brand); 849 850 /** 851 * Override the roaming indicator for the current ICCID. 852 * 853 * Using this call, the carrier app (see #hasCarrierPrivileges) can override 854 * the platform's notion of a network operator being considered roaming or not. 855 * The change only affects the ICCID that was active when this call was made. 856 * 857 * If null is passed as any of the input, the corresponding value is deleted. 858 * 859 * <p>Requires that the caller have carrier privilege. See #hasCarrierPrivileges. 860 * 861 * @param gsmRoamingList - List of MCCMNCs to be considered roaming for 3GPP RATs. 862 * @param gsmNonRoamingList - List of MCCMNCs to be considered not roaming for 3GPP RATs. 863 * @param cdmaRoamingList - List of SIDs to be considered roaming for 3GPP2 RATs. 864 * @param cdmaNonRoamingList - List of SIDs to be considered not roaming for 3GPP2 RATs. 865 * @return true if the operation was executed correctly. 866 */ setRoamingOverride(in List<String> gsmRoamingList, in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList, in List<String> cdmaNonRoamingList)867 boolean setRoamingOverride(in List<String> gsmRoamingList, 868 in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList, 869 in List<String> cdmaNonRoamingList); 870 871 /** 872 * Returns the result and response from RIL for oem request 873 * 874 * @param oemReq the data is sent to ril. 875 * @param oemResp the respose data from RIL. 876 * @return negative value request was not handled or get error 877 * 0 request was handled succesfully, but no response data 878 * positive value success, data length of response 879 */ invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp)880 int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp); 881 882 /** 883 * Check if any mobile Radios need to be shutdown. 884 * 885 * @return true is any mobile radio needs to be shutdown 886 */ needMobileRadioShutdown()887 boolean needMobileRadioShutdown(); 888 889 /** 890 * Shutdown Mobile Radios 891 */ shutdownMobileRadios()892 void shutdownMobileRadios(); 893 894 /** 895 * Set phone radio type and access technology. 896 * 897 * @param rafs an RadioAccessFamily array to indicate all phone's 898 * new radio access family. The length of RadioAccessFamily 899 * must equ]]al to phone count. 900 */ setRadioCapability(in RadioAccessFamily[] rafs)901 void setRadioCapability(in RadioAccessFamily[] rafs); 902 903 /** 904 * Get phone radio type and access technology. 905 * 906 * @param phoneId which phone you want to get 907 * @param callingPackage the name of the package making the call 908 * @return phone radio type and access technology 909 */ getRadioAccessFamily(in int phoneId, String callingPackage)910 int getRadioAccessFamily(in int phoneId, String callingPackage); 911 912 /** 913 * Enables or disables video calling. 914 * 915 * @param enable Whether to enable video calling. 916 */ enableVideoCalling(boolean enable)917 void enableVideoCalling(boolean enable); 918 919 /** 920 * Whether video calling has been enabled by the user. 921 * 922 * @param callingPackage The package making the call. 923 * @return {@code true} if the user has enabled video calling, {@code false} otherwise. 924 */ isVideoCallingEnabled(String callingPackage)925 boolean isVideoCallingEnabled(String callingPackage); 926 927 /** 928 * Whether the DTMF tone length can be changed. 929 * 930 * @return {@code true} if the DTMF tone length can be changed. 931 */ canChangeDtmfToneLength()932 boolean canChangeDtmfToneLength(); 933 934 /** 935 * Whether the device is a world phone. 936 * 937 * @return {@code true} if the devices is a world phone. 938 */ isWorldPhone()939 boolean isWorldPhone(); 940 941 /** 942 * Whether the phone supports TTY mode. 943 * 944 * @return {@code true} if the device supports TTY mode. 945 */ isTtyModeSupported()946 boolean isTtyModeSupported(); 947 948 /** 949 * Whether the phone supports hearing aid compatibility. 950 * 951 * @return {@code true} if the device supports hearing aid compatibility. 952 */ isHearingAidCompatibilitySupported()953 boolean isHearingAidCompatibilitySupported(); 954 /** 955 * Get IMS Registration Status 956 */ isImsRegistered()957 boolean isImsRegistered(); 958 959 /** 960 * Returns the Status of Wi-Fi Calling 961 *@hide 962 */ isWifiCallingEnabled()963 boolean isWifiCallingEnabled(); 964 965 /** 966 * Returns the Status of Volte 967 *@hide 968 */ isVolteEnabled()969 boolean isVolteEnabled(); 970 971 /** 972 * Returns the unique device ID of phone, for example, the IMEI for 973 * GSM and the MEID for CDMA phones. Return null if device ID is not available. 974 * 975 * @param callingPackage The package making the call. 976 * <p>Requires Permission: 977 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} 978 */ getDeviceId(String callingPackage)979 String getDeviceId(String callingPackage); 980 981 /** 982 * Returns the subscription ID associated with the specified PhoneAccount. 983 */ getSubIdForPhoneAccount(in PhoneAccount phoneAccount)984 int getSubIdForPhoneAccount(in PhoneAccount phoneAccount); 985 factoryReset(int subId)986 void factoryReset(int subId); 987 988 /** 989 * An estimate of the users's current locale based on the default SIM. 990 * 991 * The returned string will be a well formed BCP-47 language tag, or {@code null} 992 * if no locale could be derived. 993 */ getLocaleFromDefaultSim()994 String getLocaleFromDefaultSim(); 995 996 /** 997 * Return the modem activity info. 998 *@hide 999 */ getModemActivityInfo()1000 ModemActivityInfo getModemActivityInfo(); 1001 } 1002