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