ITelephony.aidl revision 4a6df3c3832e14bedb20d85d3b30bbe89989c621
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 17package com.android.internal.telephony; 18 19import android.app.PendingIntent; 20import android.content.Intent; 21import android.os.Bundle; 22import android.os.ResultReceiver; 23import android.net.Uri; 24import android.service.carrier.CarrierIdentifier; 25import android.telecom.PhoneAccount; 26import android.telecom.PhoneAccountHandle; 27import android.telephony.CellInfo; 28import android.telephony.ClientRequestStats; 29import android.telephony.IccOpenLogicalChannelResponse; 30import android.telephony.ModemActivityInfo; 31import android.telephony.NeighboringCellInfo; 32import android.telephony.RadioAccessFamily; 33import android.telephony.ServiceState; 34import android.telephony.TelephonyHistogram; 35import android.telephony.VisualVoicemailSmsFilterSettings; 36import com.android.ims.internal.IImsServiceController; 37import com.android.ims.internal.IImsServiceFeatureListener; 38import com.android.internal.telephony.CellNetworkScanResult; 39import com.android.internal.telephony.OperatorInfo; 40 41import java.util.List; 42 43 44/** 45 * Interface used to interact with the phone. Mostly this is used by the 46 * TelephonyManager class. A few places are still using this directly. 47 * Please clean them up if possible and use TelephonyManager instead. 48 * 49 * {@hide} 50 */ 51interface ITelephony { 52 53 /** 54 * Dial a number. This doesn't place the call. It displays 55 * the Dialer screen. 56 * @param number the number to be dialed. If null, this 57 * would display the Dialer screen with no number pre-filled. 58 */ 59 void dial(String number); 60 61 /** 62 * Place a call to the specified number. 63 * @param callingPackage The package making the call. 64 * @param number the number to be called. 65 */ 66 void call(String callingPackage, String number); 67 68 /** 69 * End call if there is a call in progress, otherwise does nothing. 70 * 71 * @return whether it hung up 72 */ 73 boolean endCall(); 74 75 /** 76 * End call on particular subId or go to the Home screen 77 * @param subId user preferred subId. 78 * @return whether it hung up 79 */ 80 boolean endCallForSubscriber(int subId); 81 82 /** 83 * Answer the currently-ringing call. 84 * 85 * If there's already a current active call, that call will be 86 * automatically put on hold. If both lines are currently in use, the 87 * current active call will be ended. 88 * 89 * TODO: provide a flag to let the caller specify what policy to use 90 * if both lines are in use. (The current behavior is hardwired to 91 * "answer incoming, end ongoing", which is how the CALL button 92 * is specced to behave.) 93 * 94 * TODO: this should be a oneway call (especially since it's called 95 * directly from the key queue thread). 96 */ 97 void answerRingingCall(); 98 99 /** 100 * Answer the currently-ringing call on particular subId . 101 * 102 * If there's already a current active call, that call will be 103 * automatically put on hold. If both lines are currently in use, the 104 * current active call will be ended. 105 * 106 * TODO: provide a flag to let the caller specify what policy to use 107 * if both lines are in use. (The current behavior is hardwired to 108 * "answer incoming, end ongoing", which is how the CALL button 109 * is specced to behave.) 110 * 111 * TODO: this should be a oneway call (especially since it's called 112 * directly from the key queue thread). 113 */ 114 void answerRingingCallForSubscriber(int subId); 115 116 /** 117 * Silence the ringer if an incoming call is currently ringing. 118 * (If vibrating, stop the vibrator also.) 119 * 120 * It's safe to call this if the ringer has already been silenced, or 121 * even if there's no incoming call. (If so, this method will do nothing.) 122 * 123 * TODO: this should be a oneway call too (see above). 124 * (Actually *all* the methods here that return void can 125 * probably be oneway.) 126 */ 127 void silenceRinger(); 128 129 /** 130 * Check if we are in either an active or holding call 131 * @param callingPackage the name of the package making the call. 132 * @return true if the phone state is OFFHOOK. 133 */ 134 boolean isOffhook(String callingPackage); 135 136 /** 137 * Check if a particular subId has an active or holding call 138 * 139 * @param subId user preferred subId. 140 * @param callingPackage the name of the package making the call. 141 * @return true if the phone state is OFFHOOK. 142 */ 143 boolean isOffhookForSubscriber(int subId, String callingPackage); 144 145 /** 146 * Check if an incoming phone call is ringing or call waiting 147 * on a particular subId. 148 * 149 * @param subId user preferred subId. 150 * @param callingPackage the name of the package making the call. 151 * @return true if the phone state is RINGING. 152 */ 153 boolean isRingingForSubscriber(int subId, String callingPackage); 154 155 /** 156 * Check if an incoming phone call is ringing or call waiting. 157 * @param callingPackage the name of the package making the call. 158 * @return true if the phone state is RINGING. 159 */ 160 boolean isRinging(String callingPackage); 161 162 /** 163 * Check if the phone is idle. 164 * @param callingPackage the name of the package making the call. 165 * @return true if the phone state is IDLE. 166 */ 167 boolean isIdle(String callingPackage); 168 169 /** 170 * Check if the phone is idle on a particular subId. 171 * 172 * @param subId user preferred subId. 173 * @param callingPackage the name of the package making the call. 174 * @return true if the phone state is IDLE. 175 */ 176 boolean isIdleForSubscriber(int subId, String callingPackage); 177 178 /** 179 * Check to see if the radio is on or not. 180 * @param callingPackage the name of the package making the call. 181 * @return returns true if the radio is on. 182 */ 183 boolean isRadioOn(String callingPackage); 184 185 /** 186 * Check to see if the radio is on or not on particular subId. 187 * @param subId user preferred subId. 188 * @param callingPackage the name of the package making the call. 189 * @return returns true if the radio is on. 190 */ 191 boolean isRadioOnForSubscriber(int subId, String callingPackage); 192 193 /** 194 * Supply a pin to unlock the SIM. Blocks until a result is determined. 195 * @param pin The pin to check. 196 * @return whether the operation was a success. 197 */ 198 boolean supplyPin(String pin); 199 200 /** 201 * Supply a pin to unlock the SIM for particular subId. 202 * Blocks until a result is determined. 203 * @param pin The pin to check. 204 * @param subId user preferred subId. 205 * @return whether the operation was a success. 206 */ 207 boolean supplyPinForSubscriber(int subId, String pin); 208 209 /** 210 * Supply puk to unlock the SIM and set SIM pin to new pin. 211 * Blocks until a result is determined. 212 * @param puk The puk to check. 213 * pin The new pin to be set in SIM 214 * @return whether the operation was a success. 215 */ 216 boolean supplyPuk(String puk, String pin); 217 218 /** 219 * Supply puk to unlock the SIM and set SIM pin to new pin. 220 * Blocks until a result is determined. 221 * @param puk The puk to check. 222 * pin The new pin to be set in SIM 223 * @param subId user preferred subId. 224 * @return whether the operation was a success. 225 */ 226 boolean supplyPukForSubscriber(int subId, String puk, String pin); 227 228 /** 229 * Supply a pin to unlock the SIM. Blocks until a result is determined. 230 * Returns a specific success/error code. 231 * @param pin The pin to check. 232 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 233 * retValue[1] = number of attempts remaining if known otherwise -1 234 */ 235 int[] supplyPinReportResult(String pin); 236 237 /** 238 * Supply a pin to unlock the SIM. Blocks until a result is determined. 239 * Returns a specific success/error code. 240 * @param pin The pin to check. 241 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 242 * retValue[1] = number of attempts remaining if known otherwise -1 243 */ 244 int[] supplyPinReportResultForSubscriber(int subId, String pin); 245 246 /** 247 * Supply puk to unlock the SIM and set SIM pin to new pin. 248 * Blocks until a result is determined. 249 * Returns a specific success/error code 250 * @param puk The puk to check 251 * pin The pin to check. 252 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 253 * retValue[1] = number of attempts remaining if known otherwise -1 254 */ 255 int[] supplyPukReportResult(String puk, String pin); 256 257 /** 258 * Supply puk to unlock the SIM and set SIM pin to new pin. 259 * Blocks until a result is determined. 260 * Returns a specific success/error code 261 * @param puk The puk to check 262 * pin The pin to check. 263 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 264 * retValue[1] = number of attempts remaining if known otherwise -1 265 */ 266 int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin); 267 268 /** 269 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 270 * without SEND (so <code>dial</code> is not appropriate). 271 * 272 * @param dialString the MMI command to be executed. 273 * @return true if MMI command is executed. 274 */ 275 boolean handlePinMmi(String dialString); 276 277 278 /** 279 * Handles USSD commands. 280 * 281 * @param ussdRequest the USSD command to be executed. 282 * @param wrappedCallback receives a callback result. 283 */ 284 void handleUssdRequest(String ussdRequest, in ResultReceiver wrappedCallback); 285 286 /** 287 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 288 * without SEND (so <code>dial</code> is not appropriate) for 289 * a particular subId. 290 * @param dialString the MMI command to be executed. 291 * @param subId user preferred subId. 292 * @return true if MMI command is executed. 293 */ 294 boolean handlePinMmiForSubscriber(int subId, String dialString); 295 296 /** 297 * Toggles the radio on or off. 298 */ 299 void toggleRadioOnOff(); 300 301 /** 302 * Toggles the radio on or off on particular subId. 303 * @param subId user preferred subId. 304 */ 305 void toggleRadioOnOffForSubscriber(int subId); 306 307 /** 308 * Set the radio to on or off 309 */ 310 boolean setRadio(boolean turnOn); 311 312 /** 313 * Set the radio to on or off on particular subId. 314 * @param subId user preferred subId. 315 */ 316 boolean setRadioForSubscriber(int subId, boolean turnOn); 317 318 /** 319 * Set the radio to on or off unconditionally 320 */ 321 boolean setRadioPower(boolean turnOn); 322 323 /** 324 * Request to update location information in service state 325 */ 326 void updateServiceLocation(); 327 328 /** 329 * Request to update location information for a subscrition in service state 330 * @param subId user preferred subId. 331 */ 332 void updateServiceLocationForSubscriber(int subId); 333 334 /** 335 * Enable location update notifications. 336 */ 337 void enableLocationUpdates(); 338 339 /** 340 * Enable location update notifications. 341 * @param subId user preferred subId. 342 */ 343 void enableLocationUpdatesForSubscriber(int subId); 344 345 /** 346 * Disable location update notifications. 347 */ 348 void disableLocationUpdates(); 349 350 /** 351 * Disable location update notifications. 352 * @param subId user preferred subId. 353 */ 354 void disableLocationUpdatesForSubscriber(int subId); 355 356 /** 357 * Allow mobile data connections. 358 */ 359 boolean enableDataConnectivity(); 360 361 /** 362 * Disallow mobile data connections. 363 */ 364 boolean disableDataConnectivity(); 365 366 /** 367 * Report whether data connectivity is possible. 368 */ 369 boolean isDataConnectivityPossible(); 370 371 Bundle getCellLocation(String callingPkg); 372 373 /** 374 * Returns the neighboring cell information of the device. 375 */ 376 List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg); 377 378 int getCallState(); 379 380 /** 381 * Returns the call state for a slot. 382 */ 383 int getCallStateForSlot(int slotIndex); 384 385 int getDataActivity(); 386 int getDataState(); 387 388 /** 389 * Returns the current active phone type as integer. 390 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE 391 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE 392 */ 393 int getActivePhoneType(); 394 395 /** 396 * Returns the current active phone type as integer for particular slot. 397 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE 398 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE 399 * @param slotIndex - slot to query. 400 */ 401 int getActivePhoneTypeForSlot(int slotIndex); 402 403 /** 404 * Returns the CDMA ERI icon index to display 405 * @param callingPackage package making the call. 406 */ 407 int getCdmaEriIconIndex(String callingPackage); 408 409 /** 410 * Returns the CDMA ERI icon index to display on particular subId. 411 * @param subId user preferred subId. 412 * @param callingPackage package making the call. 413 */ 414 int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage); 415 416 /** 417 * Returns the CDMA ERI icon mode, 418 * 0 - ON 419 * 1 - FLASHING 420 * @param callingPackage package making the call. 421 */ 422 int getCdmaEriIconMode(String callingPackage); 423 424 /** 425 * Returns the CDMA ERI icon mode on particular subId, 426 * 0 - ON 427 * 1 - FLASHING 428 * @param subId user preferred subId. 429 * @param callingPackage package making the call. 430 */ 431 int getCdmaEriIconModeForSubscriber(int subId, String callingPackage); 432 433 /** 434 * Returns the CDMA ERI text, 435 * @param callingPackage package making the call. 436 */ 437 String getCdmaEriText(String callingPackage); 438 439 /** 440 * Returns the CDMA ERI text for particular subId, 441 * @param subId user preferred subId. 442 * @param callingPackage package making the call. 443 */ 444 String getCdmaEriTextForSubscriber(int subId, String callingPackage); 445 446 /** 447 * Returns true if OTA service provisioning needs to run. 448 * Only relevant on some technologies, others will always 449 * return false. 450 */ 451 boolean needsOtaServiceProvisioning(); 452 453 /** 454 * Sets the voicemail number for a particular subscriber. 455 */ 456 boolean setVoiceMailNumber(int subId, String alphaTag, String number); 457 458 /** 459 * Sets the voice activation state for a particular subscriber. 460 */ 461 void setVoiceActivationState(int subId, int activationState); 462 463 /** 464 * Sets the data activation state for a particular subscriber. 465 */ 466 void setDataActivationState(int subId, int activationState); 467 468 /** 469 * Returns the voice activation state for a particular subscriber. 470 * @param subId user preferred sub 471 * @param callingPackage package queries voice activation state 472 */ 473 int getVoiceActivationState(int subId, String callingPackage); 474 475 /** 476 * Returns the data activation state for a particular subscriber. 477 * @param subId user preferred sub 478 * @param callingPackage package queris data activation state 479 */ 480 int getDataActivationState(int subId, String callingPackage); 481 482 /** 483 * Returns the unread count of voicemails 484 */ 485 int getVoiceMessageCount(); 486 487 /** 488 * Returns the unread count of voicemails for a subId. 489 * @param subId user preferred subId. 490 * Returns the unread count of voicemails 491 */ 492 int getVoiceMessageCountForSubscriber(int subId); 493 494 oneway void setVisualVoicemailEnabled(String callingPackage, 495 in PhoneAccountHandle accountHandle, boolean enabled); 496 497 boolean isVisualVoicemailEnabled(String callingPackage, 498 in PhoneAccountHandle accountHandle); 499 500 // Not oneway, caller needs to make sure the vaule is set before receiving a SMS 501 void enableVisualVoicemailSmsFilter(String callingPackage, int subId, 502 in VisualVoicemailSmsFilterSettings settings); 503 504 oneway void disableVisualVoicemailSmsFilter(String callingPackage, int subId); 505 506 // Get settings set by the calling package 507 VisualVoicemailSmsFilterSettings getVisualVoicemailSmsFilterSettings(String callingPackage, 508 int subId); 509 510 /** 511 * Get settings set by the current default dialer, Internal use only. 512 * Requires READ_PRIVILEGED_PHONE_STATE permission. 513 */ 514 VisualVoicemailSmsFilterSettings getActiveVisualVoicemailSmsFilterSettings(int subId); 515 516 /** 517 * Send a visual voicemail SMS. Internal use only. 518 * Requires caller to be the default dialer and have SEND_SMS permission 519 */ 520 oneway void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId, 521 in String number, in int port, in String text, in PendingIntent sentIntent); 522 523 /** 524 * Returns the network type for data transmission 525 * Legacy call, permission-free 526 */ 527 int getNetworkType(); 528 529 /** 530 * Returns the network type of a subId. 531 * @param subId user preferred subId. 532 * @param callingPackage package making the call. 533 */ 534 int getNetworkTypeForSubscriber(int subId, String callingPackage); 535 536 /** 537 * Returns the network type for data transmission 538 * @param callingPackage package making the call. 539 */ 540 int getDataNetworkType(String callingPackage); 541 542 /** 543 * Returns the data network type of a subId 544 * @param subId user preferred subId. 545 * @param callingPackage package making the call. 546 */ 547 int getDataNetworkTypeForSubscriber(int subId, String callingPackage); 548 549 /** 550 * Returns the voice network type of a subId 551 * @param subId user preferred subId. 552 * @param callingPackage package making the call. 553 * Returns the network type 554 */ 555 int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage); 556 557 /** 558 * Return true if an ICC card is present 559 */ 560 boolean hasIccCard(); 561 562 /** 563 * Return true if an ICC card is present for a subId. 564 * @param slotIndex user preferred slotIndex. 565 * Return true if an ICC card is present 566 */ 567 boolean hasIccCardUsingSlotIndex(int slotIndex); 568 569 /** 570 * Return if the current radio is LTE on CDMA. This 571 * is a tri-state return value as for a period of time 572 * the mode may be unknown. 573 * 574 * @param callingPackage the name of the calling package 575 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} 576 * or {@link PHone#LTE_ON_CDMA_TRUE} 577 */ 578 int getLteOnCdmaMode(String callingPackage); 579 580 /** 581 * Return if the current radio is LTE on CDMA. This 582 * is a tri-state return value as for a period of time 583 * the mode may be unknown. 584 * 585 * @param callingPackage the name of the calling package 586 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} 587 * or {@link PHone#LTE_ON_CDMA_TRUE} 588 */ 589 int getLteOnCdmaModeForSubscriber(int subId, String callingPackage); 590 591 /** 592 * Returns the all observed cell information of the device. 593 */ 594 List<CellInfo> getAllCellInfo(String callingPkg); 595 596 /** 597 * Sets minimum time in milli-seconds between onCellInfoChanged 598 */ 599 void setCellInfoListRate(int rateInMillis); 600 601 /** 602 * get default sim 603 * @return sim id 604 */ 605 int getDefaultSim(); 606 607 /** 608 * Opens a logical channel to the ICC card. 609 * 610 * Input parameters equivalent to TS 27.007 AT+CCHO command. 611 * 612 * @param subId The subscription to use. 613 * @param AID Application id. See ETSI 102.221 and 101.220. 614 * @param p2 P2 parameter (described in ISO 7816-4). 615 * @return an IccOpenLogicalChannelResponse object. 616 */ 617 IccOpenLogicalChannelResponse iccOpenLogicalChannel(int subId, String AID, int p2); 618 619 /** 620 * Closes a previously opened logical channel to the ICC card. 621 * 622 * Input parameters equivalent to TS 27.007 AT+CCHC command. 623 * 624 * @param subId The subscription to use. 625 * @param channel is the channel id to be closed as retruned by a 626 * successful iccOpenLogicalChannel. 627 * @return true if the channel was closed successfully. 628 */ 629 boolean iccCloseLogicalChannel(int subId, int channel); 630 631 /** 632 * Transmit an APDU to the ICC card over a logical channel. 633 * 634 * Input parameters equivalent to TS 27.007 AT+CGLA command. 635 * 636 * @param subId The subscription to use. 637 * @param channel is the channel id to be closed as retruned by a 638 * successful iccOpenLogicalChannel. 639 * @param cla Class of the APDU command. 640 * @param instruction Instruction of the APDU command. 641 * @param p1 P1 value of the APDU command. 642 * @param p2 P2 value of the APDU command. 643 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU 644 * is sent to the SIM. 645 * @param data Data to be sent with the APDU. 646 * @return The APDU response from the ICC card with the status appended at 647 * the end. 648 */ 649 String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction, 650 int p1, int p2, int p3, String data); 651 652 /** 653 * Transmit an APDU to the ICC card over the basic channel. 654 * 655 * Input parameters equivalent to TS 27.007 AT+CSIM command. 656 * 657 * @param subId The subscription to use. 658 * @param cla Class of the APDU command. 659 * @param instruction Instruction of the APDU command. 660 * @param p1 P1 value of the APDU command. 661 * @param p2 P2 value of the APDU command. 662 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU 663 * is sent to the SIM. 664 * @param data Data to be sent with the APDU. 665 * @return The APDU response from the ICC card with the status appended at 666 * the end. 667 */ 668 String iccTransmitApduBasicChannel(int subId, int cla, int instruction, 669 int p1, int p2, int p3, String data); 670 671 /** 672 * Returns the response APDU for a command APDU sent through SIM_IO. 673 * 674 * @param subId The subscription to use. 675 * @param fileID 676 * @param command 677 * @param p1 P1 value of the APDU command. 678 * @param p2 P2 value of the APDU command. 679 * @param p3 P3 value of the APDU command. 680 * @param filePath 681 * @return The APDU response. 682 */ 683 byte[] iccExchangeSimIO(int subId, int fileID, int command, int p1, int p2, int p3, 684 String filePath); 685 686 /** 687 * Send ENVELOPE to the SIM and returns the response. 688 * 689 * @param subId The subscription to use. 690 * @param contents String containing SAT/USAT response in hexadecimal 691 * format starting with command tag. See TS 102 223 for 692 * details. 693 * @return The APDU response from the ICC card, with the last 4 bytes 694 * being the status word. If the command fails, returns an empty 695 * string. 696 */ 697 String sendEnvelopeWithStatus(int subId, String content); 698 699 /** 700 * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. 701 * Used for device configuration by some CDMA operators. 702 * 703 * @param itemID the ID of the item to read. 704 * @return the NV item as a String, or null on any failure. 705 */ 706 String nvReadItem(int itemID); 707 708 /** 709 * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. 710 * Used for device configuration by some CDMA operators. 711 * 712 * @param itemID the ID of the item to read. 713 * @param itemValue the value to write, as a String. 714 * @return true on success; false on any failure. 715 */ 716 boolean nvWriteItem(int itemID, String itemValue); 717 718 /** 719 * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage. 720 * Used for device configuration by some CDMA operators. 721 * 722 * @param preferredRoamingList byte array containing the new PRL. 723 * @return true on success; false on any failure. 724 */ 725 boolean nvWriteCdmaPrl(in byte[] preferredRoamingList); 726 727 /** 728 * Perform the specified type of NV config reset. The radio will be taken offline 729 * and the device must be rebooted after the operation. Used for device 730 * configuration by some CDMA operators. 731 * 732 * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset). 733 * @return true on success; false on any failure. 734 */ 735 boolean nvResetConfig(int resetType); 736 737 /* 738 * Get the calculated preferred network type. 739 * Used for device configuration by some CDMA operators. 740 * @param callingPackage The package making the call. 741 * 742 * @return the calculated preferred network type, defined in RILConstants.java. 743 */ 744 int getCalculatedPreferredNetworkType(String callingPackage); 745 746 /* 747 * Get the preferred network type. 748 * Used for device configuration by some CDMA operators. 749 * 750 * @param subId the id of the subscription to query. 751 * @return the preferred network type, defined in RILConstants.java. 752 */ 753 int getPreferredNetworkType(int subId); 754 755 /** 756 * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning 757 * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for 758 * tethering. 759 * 760 * @return 0: Not required. 1: required. 2: Not set. 761 */ 762 int getTetherApnRequired(); 763 764 /** 765 * Get ImsServiceController binder from ImsResolver that corresponds to the subId and feature 766 * requested as well as registering the ImsServiceController for callbacks using the 767 * IImsServiceFeatureListener interface. 768 */ 769 IImsServiceController getImsServiceControllerAndListen(int slotIndex, int feature, 770 IImsServiceFeatureListener callback); 771 772 /** 773 * Set the network selection mode to automatic. 774 * 775 * @param subId the id of the subscription to update. 776 */ 777 void setNetworkSelectionModeAutomatic(int subId); 778 779 /** 780 * Perform a radio scan and return the list of avialble networks. 781 * 782 * @param subId the id of the subscription. 783 * @return CellNetworkScanResult containing status of scan and networks. 784 */ 785 CellNetworkScanResult getCellNetworkScanResults(int subId); 786 787 /** 788 * Ask the radio to connect to the input network and change selection mode to manual. 789 * 790 * @param subId the id of the subscription. 791 * @param operatorInfo the operator to attach to. 792 * @param persistSelection should the selection persist till reboot or its 793 * turned off? Will also result in notification being not shown to 794 * the user if the signal is lost. 795 * @return true if the request suceeded. 796 */ 797 boolean setNetworkSelectionModeManual(int subId, in OperatorInfo operator, 798 boolean persistSelection); 799 800 /** 801 * Set the preferred network type. 802 * Used for device configuration by some CDMA operators. 803 * 804 * @param subId the id of the subscription to update. 805 * @param networkType the preferred network type, defined in RILConstants.java. 806 * @return true on success; false on any failure. 807 */ 808 boolean setPreferredNetworkType(int subId, int networkType); 809 810 /** 811 * User enable/disable Mobile Data. 812 * 813 * @param enable true to turn on, else false 814 */ 815 void setDataEnabled(int subId, boolean enable); 816 817 /** 818 * Get the user enabled state of Mobile Data. 819 * 820 * @return true on enabled 821 */ 822 boolean getDataEnabled(int subId); 823 824 /** 825 * Get P-CSCF address from PCO after data connection is established or modified. 826 * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN 827 * @param callingPackage The package making the call. 828 */ 829 String[] getPcscfAddress(String apnType, String callingPackage); 830 831 /** 832 * Set IMS registration state 833 */ 834 void setImsRegistrationState(boolean registered); 835 836 /** 837 * Return MDN string for CDMA phone. 838 * @param subId user preferred subId. 839 */ 840 String getCdmaMdn(int subId); 841 842 /** 843 * Return MIN string for CDMA phone. 844 * @param subId user preferred subId. 845 */ 846 String getCdmaMin(int subId); 847 848 /** 849 * Has the calling application been granted special privileges by the carrier. 850 * 851 * If any of the packages in the calling UID has carrier privileges, the 852 * call will return true. This access is granted by the owner of the UICC 853 * card and does not depend on the registered carrier. 854 * 855 * TODO: Add a link to documentation. 856 * 857 * @param subId The subscription to use. 858 * @return carrier privilege status defined in TelephonyManager. 859 */ 860 int getCarrierPrivilegeStatus(int subId); 861 862 /** 863 * Similar to above, but check for the package whose name is pkgName. 864 */ 865 int checkCarrierPrivilegesForPackage(String pkgName); 866 867 /** 868 * Similar to above, but check across all phones. 869 */ 870 int checkCarrierPrivilegesForPackageAnyPhone(String pkgName); 871 872 /** 873 * Returns list of the package names of the carrier apps that should handle the input intent 874 * and have carrier privileges for the given phoneId. 875 * 876 * @param intent Intent that will be sent. 877 * @param phoneId The phoneId on which the carrier app has carrier privileges. 878 * @return list of carrier app package names that can handle the intent on phoneId. 879 * Returns null if there is an error and an empty list if there 880 * are no matching packages. 881 */ 882 List<String> getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId); 883 884 /** 885 * Set the line 1 phone number string and its alphatag for the current ICCID 886 * for display purpose only, for example, displayed in Phone Status. It won't 887 * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null 888 * value. 889 * 890 * @param subId the subscriber that the alphatag and dialing number belongs to. 891 * @param alphaTag alpha-tagging of the dailing nubmer 892 * @param number The dialing number 893 * @return true if the operation was executed correctly. 894 */ 895 boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number); 896 897 /** 898 * Returns the displayed dialing number string if it was set previously via 899 * {@link #setLine1NumberForDisplay}. Otherwise returns null. 900 * 901 * @param subId whose dialing number for line 1 is returned. 902 * @param callingPackage The package making the call. 903 * @return the displayed dialing number if set, or null if not set. 904 */ 905 String getLine1NumberForDisplay(int subId, String callingPackage); 906 907 /** 908 * Returns the displayed alphatag of the dialing number if it was set 909 * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null. 910 * 911 * @param subId whose alphatag associated with line 1 is returned. 912 * @param callingPackage The package making the call. 913 * @return the displayed alphatag of the dialing number if set, or null if 914 * not set. 915 */ 916 String getLine1AlphaTagForDisplay(int subId, String callingPackage); 917 918 String[] getMergedSubscriberIds(String callingPackage); 919 920 /** 921 * Override the operator branding for the current ICCID. 922 * 923 * Once set, whenever the SIM is present in the device, the service 924 * provider name (SPN) and the operator name will both be replaced by the 925 * brand value input. To unset the value, the same function should be 926 * called with a null brand value. 927 * 928 * <p>Requires Permission: 929 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} 930 * or has to be carrier app - see #hasCarrierPrivileges. 931 * 932 * @param subId The subscription to use. 933 * @param brand The brand name to display/set. 934 * @return true if the operation was executed correctly. 935 */ 936 boolean setOperatorBrandOverride(int subId, String brand); 937 938 /** 939 * Override the roaming indicator for the current ICCID. 940 * 941 * Using this call, the carrier app (see #hasCarrierPrivileges) can override 942 * the platform's notion of a network operator being considered roaming or not. 943 * The change only affects the ICCID that was active when this call was made. 944 * 945 * If null is passed as any of the input, the corresponding value is deleted. 946 * 947 * <p>Requires that the caller have carrier privilege. See #hasCarrierPrivileges. 948 * 949 * @param subId for which the roaming overrides apply. 950 * @param gsmRoamingList - List of MCCMNCs to be considered roaming for 3GPP RATs. 951 * @param gsmNonRoamingList - List of MCCMNCs to be considered not roaming for 3GPP RATs. 952 * @param cdmaRoamingList - List of SIDs to be considered roaming for 3GPP2 RATs. 953 * @param cdmaNonRoamingList - List of SIDs to be considered not roaming for 3GPP2 RATs. 954 * @return true if the operation was executed correctly. 955 */ 956 boolean setRoamingOverride(int subId, in List<String> gsmRoamingList, 957 in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList, 958 in List<String> cdmaNonRoamingList); 959 960 /** 961 * Returns the result and response from RIL for oem request 962 * 963 * @param oemReq the data is sent to ril. 964 * @param oemResp the respose data from RIL. 965 * @return negative value request was not handled or get error 966 * 0 request was handled succesfully, but no response data 967 * positive value success, data length of response 968 */ 969 int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp); 970 971 /** 972 * Check if any mobile Radios need to be shutdown. 973 * 974 * @return true is any mobile radio needs to be shutdown 975 */ 976 boolean needMobileRadioShutdown(); 977 978 /** 979 * Shutdown Mobile Radios 980 */ 981 void shutdownMobileRadios(); 982 983 /** 984 * Set phone radio type and access technology. 985 * 986 * @param rafs an RadioAccessFamily array to indicate all phone's 987 * new radio access family. The length of RadioAccessFamily 988 * must equ]]al to phone count. 989 */ 990 void setRadioCapability(in RadioAccessFamily[] rafs); 991 992 /** 993 * Get phone radio type and access technology. 994 * 995 * @param phoneId which phone you want to get 996 * @param callingPackage the name of the package making the call 997 * @return phone radio type and access technology 998 */ 999 int getRadioAccessFamily(in int phoneId, String callingPackage); 1000 1001 /** 1002 * Enables or disables video calling. 1003 * 1004 * @param enable Whether to enable video calling. 1005 */ 1006 void enableVideoCalling(boolean enable); 1007 1008 /** 1009 * Whether video calling has been enabled by the user. 1010 * 1011 * @param callingPackage The package making the call. 1012 * @return {@code true} if the user has enabled video calling, {@code false} otherwise. 1013 */ 1014 boolean isVideoCallingEnabled(String callingPackage); 1015 1016 /** 1017 * Whether the DTMF tone length can be changed. 1018 * 1019 * @return {@code true} if the DTMF tone length can be changed. 1020 */ 1021 boolean canChangeDtmfToneLength(); 1022 1023 /** 1024 * Whether the device is a world phone. 1025 * 1026 * @return {@code true} if the devices is a world phone. 1027 */ 1028 boolean isWorldPhone(); 1029 1030 /** 1031 * Whether the phone supports TTY mode. 1032 * 1033 * @return {@code true} if the device supports TTY mode. 1034 */ 1035 boolean isTtyModeSupported(); 1036 1037 /** 1038 * Whether the phone supports hearing aid compatibility. 1039 * 1040 * @return {@code true} if the device supports hearing aid compatibility. 1041 */ 1042 boolean isHearingAidCompatibilitySupported(); 1043 1044 /** 1045 * Get IMS Registration Status 1046 */ 1047 boolean isImsRegistered(); 1048 1049 /** 1050 * Returns the Status of Wi-Fi Calling 1051 */ 1052 boolean isWifiCallingAvailable(); 1053 1054 /** 1055 * Returns the Status of Volte 1056 */ 1057 boolean isVolteAvailable(); 1058 1059 /** 1060 * Returns the Status of VT (video telephony) 1061 */ 1062 boolean isVideoTelephonyAvailable(); 1063 1064 /** 1065 * Returns the unique device ID of phone, for example, the IMEI for 1066 * GSM and the MEID for CDMA phones. Return null if device ID is not available. 1067 * 1068 * @param callingPackage The package making the call. 1069 * <p>Requires Permission: 1070 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} 1071 */ 1072 String getDeviceId(String callingPackage); 1073 1074 /** 1075 * Returns the IMEI for the given slot. 1076 * 1077 * @param slotIndex - device slot. 1078 * @param callingPackage The package making the call. 1079 * <p>Requires Permission: 1080 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} 1081 */ 1082 String getImeiForSlot(int slotIndex, String callingPackage); 1083 1084 /** 1085 * Returns the MEID for the given slot. 1086 * 1087 * @param slotIndex - device slot. 1088 * @param callingPackage The package making the call. 1089 * <p>Requires Permission: 1090 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} 1091 */ 1092 String getMeidForSlot(int slotIndex, String callingPackage); 1093 1094 /** 1095 * Returns the device software version. 1096 * 1097 * @param slotIndex - device slot. 1098 * @param callingPackage The package making the call. 1099 * <p>Requires Permission: 1100 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} 1101 */ 1102 String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage); 1103 1104 /** 1105 * Returns the subscription ID associated with the specified PhoneAccount. 1106 */ 1107 int getSubIdForPhoneAccount(in PhoneAccount phoneAccount); 1108 1109 void factoryReset(int subId); 1110 1111 /** 1112 * An estimate of the users's current locale based on the default SIM. 1113 * 1114 * The returned string will be a well formed BCP-47 language tag, or {@code null} 1115 * if no locale could be derived. 1116 */ 1117 String getLocaleFromDefaultSim(); 1118 1119 /** 1120 * Requests the modem activity info asynchronously. 1121 * The implementor is expected to reply with the 1122 * {@link android.telephony.ModemActivityInfo} object placed into the Bundle with the key 1123 * {@link android.telephony.TelephonyManager#MODEM_ACTIVITY_RESULT_KEY}. 1124 * The result code is ignored. 1125 */ 1126 oneway void requestModemActivityInfo(in ResultReceiver result); 1127 1128 /** 1129 * Get the service state on specified subscription 1130 * @param subId Subscription id 1131 * @param callingPackage The package making the call 1132 * @return Service state on specified subscription. 1133 */ 1134 ServiceState getServiceStateForSubscriber(int subId, String callingPackage); 1135 1136 /** 1137 * Returns the URI for the per-account voicemail ringtone set in Phone settings. 1138 * 1139 * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the 1140 * voicemail ringtone. 1141 * @return The URI for the ringtone to play when receiving a voicemail from a specific 1142 * PhoneAccount. 1143 */ 1144 Uri getVoicemailRingtoneUri(in PhoneAccountHandle accountHandle); 1145 1146 /** 1147 * Returns whether vibration is set for voicemail notification in Phone settings. 1148 * 1149 * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the 1150 * voicemail vibration setting. 1151 * @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise. 1152 */ 1153 boolean isVoicemailVibrationEnabled(in PhoneAccountHandle accountHandle); 1154 1155 /** 1156 * Returns a list of packages that have carrier privileges. 1157 */ 1158 List<String> getPackagesWithCarrierPrivileges(); 1159 1160 /** 1161 * Return the application ID for the app type. 1162 * 1163 * @param subId the subscription ID that this request applies to. 1164 * @param appType the uicc app type, 1165 * @return Application ID for specificied app type or null if no uicc or error. 1166 */ 1167 String getAidForAppType(int subId, int appType); 1168 1169 /** 1170 * Return the Electronic Serial Number. 1171 * 1172 * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission 1173 * 1174 * @param subId the subscription ID that this request applies to. 1175 * @return ESN or null if error. 1176 * @hide 1177 */ 1178 String getEsn(int subId); 1179 1180 /** 1181 * Return the Preferred Roaming List Version 1182 * 1183 * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission 1184 * @param subId the subscription ID that this request applies to. 1185 * @return PRLVersion or null if error. 1186 * @hide 1187 */ 1188 String getCdmaPrlVersion(int subId); 1189 1190 /** 1191 * Get snapshot of Telephony histograms 1192 * @return List of Telephony histograms 1193 * Requires Permission: 1194 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} 1195 * Or the calling app has carrier privileges. 1196 */ 1197 List<TelephonyHistogram> getTelephonyHistograms(); 1198 1199 /** 1200 * Set the allowed carrier list for slotIndex 1201 * Require system privileges. In the future we may add this to carrier APIs. 1202 * 1203 * @return The number of carriers set successfully. Should match length of 1204 * carriers on success. 1205 */ 1206 int setAllowedCarriers(int slotIndex, in List<CarrierIdentifier> carriers); 1207 1208 /** 1209 * Get the allowed carrier list for slotIndex. 1210 * Require system privileges. In the future we may add this to carrier APIs. 1211 * 1212 * @return List of {@link android.service.carrier.CarrierIdentifier}; empty list 1213 * means all carriers are allowed. 1214 */ 1215 List<CarrierIdentifier> getAllowedCarriers(int slotIndex); 1216 1217 /** 1218 * Action set from carrier signalling broadcast receivers to enable/disable metered apns 1219 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required 1220 * @param subId the subscription ID that this action applies to. 1221 * @param enabled control enable or disable metered apns. 1222 * @hide 1223 */ 1224 void carrierActionSetMeteredApnsEnabled(int subId, boolean visible); 1225 1226 /** 1227 * Action set from carrier signalling broadcast receivers to enable/disable radio 1228 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required 1229 * @param subId the subscription ID that this action applies to. 1230 * @param enabled control enable or disable radio. 1231 * @hide 1232 */ 1233 void carrierActionSetRadioEnabled(int subId, boolean enabled); 1234 1235 /** 1236 * Get aggregated video call data usage since boot. 1237 * Permissions android.Manifest.permission.READ_NETWORK_USAGE_HISTORY is required. 1238 * @return total data usage in bytes 1239 * @hide 1240 */ 1241 long getVtDataUsage(); 1242 1243 /** 1244 * Policy control of data connection. Usually used when data limit is passed. 1245 * @param enabled True if enabling the data, otherwise disabling. 1246 * @param subId Subscription index 1247 * @hide 1248 */ 1249 void setPolicyDataEnabled(boolean enabled, int subId); 1250 1251 /** 1252 * Get Client request stats which will contain statistical information 1253 * on each request made by client. 1254 * @param callingPackage package making the call. 1255 * @param subId Subscription index 1256 * @hide 1257 */ 1258 List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid); 1259 1260 /** 1261 * Set SIM card power state. Request is equivalent to inserting or removing the card. 1262 * @param slotIndex SIM slot id 1263 * @param powerUp True if powering up the SIM, otherwise powering down 1264 * @hide 1265 * */ 1266 void setSimPowerStateForSlot(int slotIndex, boolean powerUp); 1267 1268 /** 1269 * Returns a list of Forbidden PLMNs from the specified SIM App 1270 * Returns null if the query fails. 1271 * 1272 * 1273 * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE 1274 * 1275 * @param subId subscription ID used for authentication 1276 * @param appType the icc application type, like {@link #APPTYPE_USIM} 1277 */ 1278 String[] getForbiddenPlmns(int subId, int appType); 1279 1280 /** 1281 * Check if phone is in emergency callback mode 1282 * @return true if phone is in emergency callback mode 1283 * @param subId the subscription ID that this action applies to. 1284 * @hide 1285 */ 1286 boolean getEmergencyCallbackMode(int subId); 1287} 1288