2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.internal.telephony;
19 import android.app.PendingIntent;
20 import android.content.Intent;
21 import android.os.Bundle;
22 import android.os.ResultReceiver;
23 import android.net.Uri;
24 import android.service.carrier.CarrierIdentifier;
25 import android.telecom.PhoneAccount;
26 import android.telecom.PhoneAccountHandle;
27 import android.telephony.CellInfo;
28 import android.telephony.ClientRequestStats;
29 import android.telephony.IccOpenLogicalChannelResponse;
30 import android.telephony.ModemActivityInfo;
31 import android.telephony.NeighboringCellInfo;
32 import android.telephony.RadioAccessFamily;
33 import android.telephony.ServiceState;
34 import android.telephony.TelephonyHistogram;
35 import android.telephony.VisualVoicemailSmsFilterSettings;
36 import com.android.ims.internal.IImsServiceController;
37 import com.android.ims.internal.IImsServiceFeatureListener;
38 import com.android.internal.telephony.CellNetworkScanResult;
39 import com.android.internal.telephony.OperatorInfo;
41 import java.util.List;
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.
51 interface ITelephony {
54 * Dial a number. This doesn't place the call. It displays
56 * @param number the number to be dialed. If null, this
57 * would display the Dialer screen with no number pre-filled.
59 void dial(String number);
62 * Place a call to the specified number.
63 * @param callingPackage The package making the call.
64 * @param number the number to be called.
66 void call(String callingPackage, String number);
69 * End call if there is a call in progress, otherwise does nothing.
71 * @return whether it hung up
76 * End call on particular subId or go to the Home screen
77 * @param subId user preferred subId.
78 * @return whether it hung up
80 boolean endCallForSubscriber(int subId);
83 * Answer the currently-ringing call.
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.
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.)
94 * TODO: this should be a oneway call (especially since it's called
95 * directly from the key queue thread).
97 void answerRingingCall();
100 * Answer the currently-ringing call on particular subId .
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.
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.)
111 * TODO: this should be a oneway call (especially since it's called
112 * directly from the key queue thread).
114 void answerRingingCallForSubscriber(int subId);
117 * Silence the ringer if an incoming call is currently ringing.
118 * (If vibrating, stop the vibrator also.)
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.)
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.)
127 void silenceRinger();
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.
134 boolean isOffhook(String callingPackage);
137 * Check if a particular subId has an active or holding call
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.
143 boolean isOffhookForSubscriber(int subId, String callingPackage);
146 * Check if an incoming phone call is ringing or call waiting
147 * on a particular subId.
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.
153 boolean isRingingForSubscriber(int subId, String callingPackage);
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.
160 boolean isRinging(String callingPackage);
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.
167 boolean isIdle(String callingPackage);
170 * Check if the phone is idle on a particular subId.
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.
176 boolean isIdleForSubscriber(int subId, String callingPackage);
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.
183 boolean isRadioOn(String callingPackage);
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.
191 boolean isRadioOnForSubscriber(int subId, String callingPackage);
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.
198 boolean supplyPin(String pin);
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.
207 boolean supplyPinForSubscriber(int subId, String pin);
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.
216 boolean supplyPuk(String puk, String pin);
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.
226 boolean supplyPukForSubscriber(int subId, String puk, String pin);
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
235 int[] supplyPinReportResult(String pin);
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
244 int[] supplyPinReportResultForSubscriber(int subId, String pin);
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
255 int[] supplyPukReportResult(String puk, String pin);
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
266 int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin);
269 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
270 * without SEND (so <code>dial</code> is not appropriate).
272 * @param dialString the MMI command to be executed.
273 * @return true if MMI command is executed.
275 boolean handlePinMmi(String dialString);
279 * Handles USSD commands.
281 * @param subId The subscription to use.
282 * @param ussdRequest the USSD command to be executed.
283 * @param wrappedCallback receives a callback result.
285 void handleUssdRequest(int subId, String ussdRequest, in ResultReceiver wrappedCallback);
288 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
289 * without SEND (so <code>dial</code> is not appropriate) for
290 * a particular subId.
291 * @param dialString the MMI command to be executed.
292 * @param subId user preferred subId.
293 * @return true if MMI command is executed.
295 boolean handlePinMmiForSubscriber(int subId, String dialString);
298 * Toggles the radio on or off.
300 void toggleRadioOnOff();
303 * Toggles the radio on or off on particular subId.
304 * @param subId user preferred subId.
306 void toggleRadioOnOffForSubscriber(int subId);
309 * Set the radio to on or off
311 boolean setRadio(boolean turnOn);
314 * Set the radio to on or off on particular subId.
315 * @param subId user preferred subId.
317 boolean setRadioForSubscriber(int subId, boolean turnOn);
320 * Set the radio to on or off unconditionally
322 boolean setRadioPower(boolean turnOn);
325 * Request to update location information in service state
327 void updateServiceLocation();
330 * Request to update location information for a subscrition in service state
331 * @param subId user preferred subId.
333 void updateServiceLocationForSubscriber(int subId);
336 * Enable location update notifications.
338 void enableLocationUpdates();
341 * Enable location update notifications.
342 * @param subId user preferred subId.
344 void enableLocationUpdatesForSubscriber(int subId);
347 * Disable location update notifications.
349 void disableLocationUpdates();
352 * Disable location update notifications.
353 * @param subId user preferred subId.
355 void disableLocationUpdatesForSubscriber(int subId);
358 * Allow mobile data connections.
360 boolean enableDataConnectivity();
363 * Disallow mobile data connections.
365 boolean disableDataConnectivity();
368 * Report whether data connectivity is possible.
370 boolean isDataConnectivityPossible();
372 Bundle getCellLocation(String callingPkg);
375 * Returns the neighboring cell information of the device.
377 List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
382 * Returns the call state for a slot.
384 int getCallStateForSlot(int slotIndex);
386 int getDataActivity();
390 * Returns the current active phone type as integer.
391 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
392 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
394 int getActivePhoneType();
397 * Returns the current active phone type as integer for particular slot.
398 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
399 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
400 * @param slotIndex - slot to query.
402 int getActivePhoneTypeForSlot(int slotIndex);
405 * Returns the CDMA ERI icon index to display
406 * @param callingPackage package making the call.
408 int getCdmaEriIconIndex(String callingPackage);
411 * Returns the CDMA ERI icon index to display on particular subId.
412 * @param subId user preferred subId.
413 * @param callingPackage package making the call.
415 int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage);
418 * Returns the CDMA ERI icon mode,
421 * @param callingPackage package making the call.
423 int getCdmaEriIconMode(String callingPackage);
426 * Returns the CDMA ERI icon mode on particular subId,
429 * @param subId user preferred subId.
430 * @param callingPackage package making the call.
432 int getCdmaEriIconModeForSubscriber(int subId, String callingPackage);
435 * Returns the CDMA ERI text,
436 * @param callingPackage package making the call.
438 String getCdmaEriText(String callingPackage);
441 * Returns the CDMA ERI text for particular subId,
442 * @param subId user preferred subId.
443 * @param callingPackage package making the call.
445 String getCdmaEriTextForSubscriber(int subId, String callingPackage);
448 * Returns true if OTA service provisioning needs to run.
449 * Only relevant on some technologies, others will always
452 boolean needsOtaServiceProvisioning();
455 * Sets the voicemail number for a particular subscriber.
457 boolean setVoiceMailNumber(int subId, String alphaTag, String number);
460 * Sets the voice activation state for a particular subscriber.
462 void setVoiceActivationState(int subId, int activationState);
465 * Sets the data activation state for a particular subscriber.
467 void setDataActivationState(int subId, int activationState);
470 * Returns the voice activation state for a particular subscriber.
471 * @param subId user preferred sub
472 * @param callingPackage package queries voice activation state
474 int getVoiceActivationState(int subId, String callingPackage);
477 * Returns the data activation state for a particular subscriber.
478 * @param subId user preferred sub
479 * @param callingPackage package queris data activation state
481 int getDataActivationState(int subId, String callingPackage);
484 * Returns the unread count of voicemails
486 int getVoiceMessageCount();
489 * Returns the unread count of voicemails for a subId.
490 * @param subId user preferred subId.
491 * Returns the unread count of voicemails
493 int getVoiceMessageCountForSubscriber(int subId);
496 * Returns true if current state supports both voice and data
497 * simultaneously. This can change based on location or network condition.
499 boolean isConcurrentVoiceAndDataAllowed(int subId);
501 Bundle getVisualVoicemailSettings(String callingPackage, int subId);
503 String getVisualVoicemailPackageName(String callingPackage, int subId);
505 // Not oneway, caller needs to make sure the vaule is set before receiving a SMS
506 void enableVisualVoicemailSmsFilter(String callingPackage, int subId,
507 in VisualVoicemailSmsFilterSettings settings);
509 oneway void disableVisualVoicemailSmsFilter(String callingPackage, int subId);
511 // Get settings set by the calling package
512 VisualVoicemailSmsFilterSettings getVisualVoicemailSmsFilterSettings(String callingPackage,
516 * Get settings set by the current default dialer, Internal use only.
517 * Requires READ_PRIVILEGED_PHONE_STATE permission.
519 VisualVoicemailSmsFilterSettings getActiveVisualVoicemailSmsFilterSettings(int subId);
522 * Send a visual voicemail SMS. Internal use only.
523 * Requires caller to be the default dialer and have SEND_SMS permission
525 void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId,
526 in String number, in int port, in String text, in PendingIntent sentIntent);
528 // Send the special dialer code. The IPC caller must be the current default dialer.
529 void sendDialerSpecialCode(String callingPackageName, String inputCode);
532 * Returns the network type for data transmission
533 * Legacy call, permission-free
535 int getNetworkType();
538 * Returns the network type of a subId.
539 * @param subId user preferred subId.
540 * @param callingPackage package making the call.
542 int getNetworkTypeForSubscriber(int subId, String callingPackage);
545 * Returns the network type for data transmission
546 * @param callingPackage package making the call.
548 int getDataNetworkType(String callingPackage);
551 * Returns the data network type of a subId
552 * @param subId user preferred subId.
553 * @param callingPackage package making the call.
555 int getDataNetworkTypeForSubscriber(int subId, String callingPackage);
558 * Returns the voice network type of a subId
559 * @param subId user preferred subId.
560 * @param callingPackage package making the call.
561 * Returns the network type
563 int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage);
566 * Return true if an ICC card is present
568 boolean hasIccCard();
571 * Return true if an ICC card is present for a subId.
572 * @param slotIndex user preferred slotIndex.
573 * Return true if an ICC card is present
575 boolean hasIccCardUsingSlotIndex(int slotIndex);
578 * Return if the current radio is LTE on CDMA. This
579 * is a tri-state return value as for a period of time
580 * the mode may be unknown.
582 * @param callingPackage the name of the calling package
583 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
584 * or {@link PHone#LTE_ON_CDMA_TRUE}
586 int getLteOnCdmaMode(String callingPackage);
589 * Return if the current radio is LTE on CDMA. This
590 * is a tri-state return value as for a period of time
591 * the mode may be unknown.
593 * @param callingPackage the name of the calling package
594 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
595 * or {@link PHone#LTE_ON_CDMA_TRUE}
597 int getLteOnCdmaModeForSubscriber(int subId, String callingPackage);
600 * Returns the all observed cell information of the device.
602 List<CellInfo> getAllCellInfo(String callingPkg);
605 * Sets minimum time in milli-seconds between onCellInfoChanged
607 void setCellInfoListRate(int rateInMillis);
616 * Opens a logical channel to the ICC card.
618 * Input parameters equivalent to TS 27.007 AT+CCHO command.
620 * @param subId The subscription to use.
621 * @param AID Application id. See ETSI 102.221 and 101.220.
622 * @param p2 P2 parameter (described in ISO 7816-4).
623 * @return an IccOpenLogicalChannelResponse object.
625 IccOpenLogicalChannelResponse iccOpenLogicalChannel(int subId, String AID, int p2);
628 * Closes a previously opened logical channel to the ICC card.
630 * Input parameters equivalent to TS 27.007 AT+CCHC command.
632 * @param subId The subscription to use.
633 * @param channel is the channel id to be closed as retruned by a
634 * successful iccOpenLogicalChannel.
635 * @return true if the channel was closed successfully.
637 boolean iccCloseLogicalChannel(int subId, int channel);
640 * Transmit an APDU to the ICC card over a logical channel.
642 * Input parameters equivalent to TS 27.007 AT+CGLA command.
644 * @param subId The subscription to use.
645 * @param channel is the channel id to be closed as retruned by a
646 * successful iccOpenLogicalChannel.
647 * @param cla Class of the APDU command.
648 * @param instruction Instruction of the APDU command.
649 * @param p1 P1 value of the APDU command.
650 * @param p2 P2 value of the APDU command.
651 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
652 * is sent to the SIM.
653 * @param data Data to be sent with the APDU.
654 * @return The APDU response from the ICC card with the status appended at
657 String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction,
658 int p1, int p2, int p3, String data);
661 * Transmit an APDU to the ICC card over the basic channel.
663 * Input parameters equivalent to TS 27.007 AT+CSIM command.
665 * @param subId The subscription to use.
666 * @param cla Class of the APDU command.
667 * @param instruction Instruction of the APDU command.
668 * @param p1 P1 value of the APDU command.
669 * @param p2 P2 value of the APDU command.
670 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
671 * is sent to the SIM.
672 * @param data Data to be sent with the APDU.
673 * @return The APDU response from the ICC card with the status appended at
676 String iccTransmitApduBasicChannel(int subId, int cla, int instruction,
677 int p1, int p2, int p3, String data);
680 * Returns the response APDU for a command APDU sent through SIM_IO.
682 * @param subId The subscription to use.
685 * @param p1 P1 value of the APDU command.
686 * @param p2 P2 value of the APDU command.
687 * @param p3 P3 value of the APDU command.
689 * @return The APDU response.
691 byte[] iccExchangeSimIO(int subId, int fileID, int command, int p1, int p2, int p3,
695 * Send ENVELOPE to the SIM and returns the response.
697 * @param subId The subscription to use.
698 * @param contents String containing SAT/USAT response in hexadecimal
699 * format starting with command tag. See TS 102 223 for
701 * @return The APDU response from the ICC card, with the last 4 bytes
702 * being the status word. If the command fails, returns an empty
705 String sendEnvelopeWithStatus(int subId, String content);
708 * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
709 * Used for device configuration by some CDMA operators.
711 * @param itemID the ID of the item to read.
712 * @return the NV item as a String, or null on any failure.
714 String nvReadItem(int itemID);
717 * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
718 * Used for device configuration by some CDMA operators.
720 * @param itemID the ID of the item to read.
721 * @param itemValue the value to write, as a String.
722 * @return true on success; false on any failure.
724 boolean nvWriteItem(int itemID, String itemValue);
727 * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
728 * Used for device configuration by some CDMA operators.
730 * @param preferredRoamingList byte array containing the new PRL.
731 * @return true on success; false on any failure.
733 boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
736 * Perform the specified type of NV config reset. The radio will be taken offline
737 * and the device must be rebooted after the operation. Used for device
738 * configuration by some CDMA operators.
740 * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
741 * @return true on success; false on any failure.
743 boolean nvResetConfig(int resetType);
746 * Get the calculated preferred network type.
747 * Used for device configuration by some CDMA operators.
748 * @param callingPackage The package making the call.
750 * @return the calculated preferred network type, defined in RILConstants.java.
752 int getCalculatedPreferredNetworkType(String callingPackage);
755 * Get the preferred network type.
756 * Used for device configuration by some CDMA operators.
758 * @param subId the id of the subscription to query.
759 * @return the preferred network type, defined in RILConstants.java.
761 int getPreferredNetworkType(int subId);
764 * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
765 * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
768 * @return 0: Not required. 1: required. 2: Not set.
770 int getTetherApnRequired();
773 * Get ImsServiceController binder from ImsResolver that corresponds to the subId and feature
774 * requested as well as registering the ImsServiceController for callbacks using the
775 * IImsServiceFeatureListener interface.
777 IImsServiceController getImsServiceControllerAndListen(int slotIndex, int feature,
778 IImsServiceFeatureListener callback);
781 * Set the network selection mode to automatic.
783 * @param subId the id of the subscription to update.
785 void setNetworkSelectionModeAutomatic(int subId);
788 * Perform a radio scan and return the list of avialble networks.
790 * @param subId the id of the subscription.
791 * @return CellNetworkScanResult containing status of scan and networks.
793 CellNetworkScanResult getCellNetworkScanResults(int subId);
796 * Ask the radio to connect to the input network and change selection mode to manual.
798 * @param subId the id of the subscription.
799 * @param operatorInfo the operator to attach to.
800 * @param persistSelection should the selection persist till reboot or its
801 * turned off? Will also result in notification being not shown to
802 * the user if the signal is lost.
803 * @return true if the request suceeded.
805 boolean setNetworkSelectionModeManual(int subId, in OperatorInfo operator,
806 boolean persistSelection);
809 * Set the preferred network type.
810 * Used for device configuration by some CDMA operators.
812 * @param subId the id of the subscription to update.
813 * @param networkType the preferred network type, defined in RILConstants.java.
814 * @return true on success; false on any failure.
816 boolean setPreferredNetworkType(int subId, int networkType);
819 * User enable/disable Mobile Data.
821 * @param enable true to turn on, else false
823 void setDataEnabled(int subId, boolean enable);
826 * Get the user enabled state of Mobile Data.
828 * @return true on enabled
830 boolean getDataEnabled(int subId);
833 * Get P-CSCF address from PCO after data connection is established or modified.
834 * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN
835 * @param callingPackage The package making the call.
837 String[] getPcscfAddress(String apnType, String callingPackage);
840 * Set IMS registration state
842 void setImsRegistrationState(boolean registered);
845 * Return MDN string for CDMA phone.
846 * @param subId user preferred subId.
848 String getCdmaMdn(int subId);
851 * Return MIN string for CDMA phone.
852 * @param subId user preferred subId.
854 String getCdmaMin(int subId);
857 * Has the calling application been granted special privileges by the carrier.
859 * If any of the packages in the calling UID has carrier privileges, the
860 * call will return true. This access is granted by the owner of the UICC
861 * card and does not depend on the registered carrier.
863 * TODO: Add a link to documentation.
865 * @param subId The subscription to use.
866 * @return carrier privilege status defined in TelephonyManager.
868 int getCarrierPrivilegeStatus(int subId);
871 * Similar to above, but check for the package whose name is pkgName.
873 int checkCarrierPrivilegesForPackage(String pkgName);
876 * Similar to above, but check across all phones.
878 int checkCarrierPrivilegesForPackageAnyPhone(String pkgName);
881 * Returns list of the package names of the carrier apps that should handle the input intent
882 * and have carrier privileges for the given phoneId.
884 * @param intent Intent that will be sent.
885 * @param phoneId The phoneId on which the carrier app has carrier privileges.
886 * @return list of carrier app package names that can handle the intent on phoneId.
887 * Returns null if there is an error and an empty list if there
888 * are no matching packages.
890 List<String> getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId);
893 * Set the line 1 phone number string and its alphatag for the current ICCID
894 * for display purpose only, for example, displayed in Phone Status. It won't
895 * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
898 * @param subId the subscriber that the alphatag and dialing number belongs to.
899 * @param alphaTag alpha-tagging of the dailing nubmer
900 * @param number The dialing number
901 * @return true if the operation was executed correctly.
903 boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number);
906 * Returns the displayed dialing number string if it was set previously via
907 * {@link #setLine1NumberForDisplay}. Otherwise returns null.
909 * @param subId whose dialing number for line 1 is returned.
910 * @param callingPackage The package making the call.
911 * @return the displayed dialing number if set, or null if not set.
913 String getLine1NumberForDisplay(int subId, String callingPackage);
916 * Returns the displayed alphatag of the dialing number if it was set
917 * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null.
919 * @param subId whose alphatag associated with line 1 is returned.
920 * @param callingPackage The package making the call.
921 * @return the displayed alphatag of the dialing number if set, or null if
924 String getLine1AlphaTagForDisplay(int subId, String callingPackage);
926 String[] getMergedSubscriberIds(String callingPackage);
929 * Override the operator branding for the current ICCID.
931 * Once set, whenever the SIM is present in the device, the service
932 * provider name (SPN) and the operator name will both be replaced by the
933 * brand value input. To unset the value, the same function should be
934 * called with a null brand value.
936 * <p>Requires Permission:
937 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
938 * or has to be carrier app - see #hasCarrierPrivileges.
940 * @param subId The subscription to use.
941 * @param brand The brand name to display/set.
942 * @return true if the operation was executed correctly.
944 boolean setOperatorBrandOverride(int subId, String brand);
947 * Override the roaming indicator for the current ICCID.
949 * Using this call, the carrier app (see #hasCarrierPrivileges) can override
950 * the platform's notion of a network operator being considered roaming or not.
951 * The change only affects the ICCID that was active when this call was made.
953 * If null is passed as any of the input, the corresponding value is deleted.
955 * <p>Requires that the caller have carrier privilege. See #hasCarrierPrivileges.
957 * @param subId for which the roaming overrides apply.
958 * @param gsmRoamingList - List of MCCMNCs to be considered roaming for 3GPP RATs.
959 * @param gsmNonRoamingList - List of MCCMNCs to be considered not roaming for 3GPP RATs.
960 * @param cdmaRoamingList - List of SIDs to be considered roaming for 3GPP2 RATs.
961 * @param cdmaNonRoamingList - List of SIDs to be considered not roaming for 3GPP2 RATs.
962 * @return true if the operation was executed correctly.
964 boolean setRoamingOverride(int subId, in List<String> gsmRoamingList,
965 in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList,
966 in List<String> cdmaNonRoamingList);
969 * Returns the result and response from RIL for oem request
971 * @param oemReq the data is sent to ril.
972 * @param oemResp the respose data from RIL.
973 * @return negative value request was not handled or get error
974 * 0 request was handled succesfully, but no response data
975 * positive value success, data length of response
977 int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
980 * Check if any mobile Radios need to be shutdown.
982 * @return true is any mobile radio needs to be shutdown
984 boolean needMobileRadioShutdown();
987 * Shutdown Mobile Radios
989 void shutdownMobileRadios();
992 * Set phone radio type and access technology.
994 * @param rafs an RadioAccessFamily array to indicate all phone's
995 * new radio access family. The length of RadioAccessFamily
996 * must equ]]al to phone count.
998 void setRadioCapability(in RadioAccessFamily[] rafs);
1001 * Get phone radio type and access technology.
1003 * @param phoneId which phone you want to get
1004 * @param callingPackage the name of the package making the call
1005 * @return phone radio type and access technology
1007 int getRadioAccessFamily(in int phoneId, String callingPackage);
1010 * Enables or disables video calling.
1012 * @param enable Whether to enable video calling.
1014 void enableVideoCalling(boolean enable);
1017 * Whether video calling has been enabled by the user.
1019 * @param callingPackage The package making the call.
1020 * @return {@code true} if the user has enabled video calling, {@code false} otherwise.
1022 boolean isVideoCallingEnabled(String callingPackage);
1025 * Whether the DTMF tone length can be changed.
1027 * @return {@code true} if the DTMF tone length can be changed.
1029 boolean canChangeDtmfToneLength();
1032 * Whether the device is a world phone.
1034 * @return {@code true} if the devices is a world phone.
1036 boolean isWorldPhone();
1039 * Whether the phone supports TTY mode.
1041 * @return {@code true} if the device supports TTY mode.
1043 boolean isTtyModeSupported();
1046 * Whether the phone supports hearing aid compatibility.
1048 * @return {@code true} if the device supports hearing aid compatibility.
1050 boolean isHearingAidCompatibilitySupported();
1053 * Get IMS Registration Status
1055 boolean isImsRegistered();
1058 * Returns the Status of Wi-Fi Calling
1060 boolean isWifiCallingAvailable();
1063 * Returns the Status of Volte
1065 boolean isVolteAvailable();
1068 * Returns the Status of VT (video telephony)
1070 boolean isVideoTelephonyAvailable();
1073 * Returns the unique device ID of phone, for example, the IMEI for
1074 * GSM and the MEID for CDMA phones. Return null if device ID is not available.
1076 * @param callingPackage The package making the call.
1077 * <p>Requires Permission:
1078 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1080 String getDeviceId(String callingPackage);
1083 * Returns the IMEI for the given slot.
1085 * @param slotIndex - device slot.
1086 * @param callingPackage The package making the call.
1087 * <p>Requires Permission:
1088 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1090 String getImeiForSlot(int slotIndex, String callingPackage);
1093 * Returns the MEID for the given slot.
1095 * @param slotIndex - device slot.
1096 * @param callingPackage The package making the call.
1097 * <p>Requires Permission:
1098 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1100 String getMeidForSlot(int slotIndex, String callingPackage);
1103 * Returns the device software version.
1105 * @param slotIndex - device slot.
1106 * @param callingPackage The package making the call.
1107 * <p>Requires Permission:
1108 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1110 String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage);
1113 * Returns the subscription ID associated with the specified PhoneAccount.
1115 int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
1117 void factoryReset(int subId);
1120 * An estimate of the users's current locale based on the default SIM.
1122 * The returned string will be a well formed BCP-47 language tag, or {@code null}
1123 * if no locale could be derived.
1125 String getLocaleFromDefaultSim();
1128 * Requests the modem activity info asynchronously.
1129 * The implementor is expected to reply with the
1130 * {@link android.telephony.ModemActivityInfo} object placed into the Bundle with the key
1131 * {@link android.telephony.TelephonyManager#MODEM_ACTIVITY_RESULT_KEY}.
1132 * The result code is ignored.
1134 oneway void requestModemActivityInfo(in ResultReceiver result);
1137 * Get the service state on specified subscription
1138 * @param subId Subscription id
1139 * @param callingPackage The package making the call
1140 * @return Service state on specified subscription.
1142 ServiceState getServiceStateForSubscriber(int subId, String callingPackage);
1145 * Returns the URI for the per-account voicemail ringtone set in Phone settings.
1147 * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
1148 * voicemail ringtone.
1149 * @return The URI for the ringtone to play when receiving a voicemail from a specific
1152 Uri getVoicemailRingtoneUri(in PhoneAccountHandle accountHandle);
1155 * Sets the per-account voicemail ringtone.
1157 * <p>Requires that the calling app is the default dialer, or has carrier privileges, or
1158 * has permission {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
1160 * @param phoneAccountHandle The handle for the {@link PhoneAccount} for which to set the
1161 * voicemail ringtone.
1162 * @param uri The URI for the ringtone to play when receiving a voicemail from a specific
1165 void setVoicemailRingtoneUri(String callingPackage,
1166 in PhoneAccountHandle phoneAccountHandle, in Uri uri);
1169 * Returns whether vibration is set for voicemail notification in Phone settings.
1171 * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
1172 * voicemail vibration setting.
1173 * @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise.
1175 boolean isVoicemailVibrationEnabled(in PhoneAccountHandle accountHandle);
1178 * Sets the per-account preference whether vibration is enabled for voicemail notifications.
1180 * <p>Requires that the calling app is the default dialer, or has carrier privileges, or
1181 * has permission {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
1183 * @param phoneAccountHandle The handle for the {@link PhoneAccount} for which to set the
1184 * voicemail vibration setting.
1185 * @param enabled Whether to enable or disable vibration for voicemail notifications from a
1186 * specific PhoneAccount.
1188 void setVoicemailVibrationEnabled(String callingPackage,
1189 in PhoneAccountHandle phoneAccountHandle, boolean enabled);
1192 * Returns a list of packages that have carrier privileges.
1194 List<String> getPackagesWithCarrierPrivileges();
1197 * Return the application ID for the app type.
1199 * @param subId the subscription ID that this request applies to.
1200 * @param appType the uicc app type,
1201 * @return Application ID for specificied app type or null if no uicc or error.
1203 String getAidForAppType(int subId, int appType);
1206 * Return the Electronic Serial Number.
1208 * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
1210 * @param subId the subscription ID that this request applies to.
1211 * @return ESN or null if error.
1214 String getEsn(int subId);
1217 * Return the Preferred Roaming List Version
1219 * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
1220 * @param subId the subscription ID that this request applies to.
1221 * @return PRLVersion or null if error.
1224 String getCdmaPrlVersion(int subId);
1227 * Get snapshot of Telephony histograms
1228 * @return List of Telephony histograms
1229 * Requires Permission:
1230 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
1231 * Or the calling app has carrier privileges.
1233 List<TelephonyHistogram> getTelephonyHistograms();
1236 * Set the allowed carrier list for slotIndex
1237 * Require system privileges. In the future we may add this to carrier APIs.
1239 * @return The number of carriers set successfully. Should match length of
1240 * carriers on success.
1242 int setAllowedCarriers(int slotIndex, in List<CarrierIdentifier> carriers);
1245 * Get the allowed carrier list for slotIndex.
1246 * Require system privileges. In the future we may add this to carrier APIs.
1248 * @return List of {@link android.service.carrier.CarrierIdentifier}; empty list
1249 * means all carriers are allowed.
1251 List<CarrierIdentifier> getAllowedCarriers(int slotIndex);
1254 * Action set from carrier signalling broadcast receivers to enable/disable metered apns
1255 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1256 * @param subId the subscription ID that this action applies to.
1257 * @param enabled control enable or disable metered apns.
1260 void carrierActionSetMeteredApnsEnabled(int subId, boolean visible);
1263 * Action set from carrier signalling broadcast receivers to enable/disable radio
1264 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1265 * @param subId the subscription ID that this action applies to.
1266 * @param enabled control enable or disable radio.
1269 void carrierActionSetRadioEnabled(int subId, boolean enabled);
1272 * Get aggregated video call data usage since boot.
1273 * Permissions android.Manifest.permission.READ_NETWORK_USAGE_HISTORY is required.
1274 * @return total data usage in bytes
1277 long getVtDataUsage();
1280 * Policy control of data connection. Usually used when data limit is passed.
1281 * @param enabled True if enabling the data, otherwise disabling.
1282 * @param subId Subscription index
1285 void setPolicyDataEnabled(boolean enabled, int subId);
1288 * Get Client request stats which will contain statistical information
1289 * on each request made by client.
1290 * @param callingPackage package making the call.
1291 * @param subId Subscription index
1294 List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid);
1297 * Set SIM card power state. Request is equivalent to inserting or removing the card.
1298 * @param slotIndex SIM slot id
1299 * @param powerUp True if powering up the SIM, otherwise powering down
1302 void setSimPowerStateForSlot(int slotIndex, boolean powerUp);
1305 * Returns a list of Forbidden PLMNs from the specified SIM App
1306 * Returns null if the query fails.
1309 * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE or READ_PHONE_STATE
1311 * @param subId subscription ID used for authentication
1312 * @param appType the icc application type, like {@link #APPTYPE_USIM}
1314 String[] getForbiddenPlmns(int subId, int appType, String callingPackage);
1317 * Check if phone is in emergency callback mode
1318 * @return true if phone is in emergency callback mode
1319 * @param subId the subscription ID that this action applies to.
1322 boolean getEmergencyCallbackMode(int subId);