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.IBinder;
23 import android.os.Messenger;
24 import android.os.ResultReceiver;
25 import android.net.NetworkStats;
26 import android.net.Uri;
27 import android.service.carrier.CarrierIdentifier;
28 import android.telecom.PhoneAccount;
29 import android.telecom.PhoneAccountHandle;
30 import android.telephony.CellInfo;
31 import android.telephony.ClientRequestStats;
32 import android.telephony.IccOpenLogicalChannelResponse;
33 import android.telephony.ModemActivityInfo;
34 import android.telephony.NeighboringCellInfo;
35 import android.telephony.NetworkScanRequest;
36 import android.telephony.RadioAccessFamily;
37 import android.telephony.ServiceState;
38 import android.telephony.SignalStrength;
39 import android.telephony.TelephonyHistogram;
40 import android.telephony.VisualVoicemailSmsFilterSettings;
41 import com.android.ims.internal.IImsServiceController;
42 import com.android.ims.internal.IImsServiceFeatureListener;
43 import com.android.internal.telephony.CellNetworkScanResult;
44 import com.android.internal.telephony.OperatorInfo;
46 import java.util.List;
50 * Interface used to interact with the phone. Mostly this is used by the
51 * TelephonyManager class. A few places are still using this directly.
52 * Please clean them up if possible and use TelephonyManager instead.
56 interface ITelephony {
59 * Dial a number. This doesn't place the call. It displays
61 * @param number the number to be dialed. If null, this
62 * would display the Dialer screen with no number pre-filled.
64 void dial(String number);
67 * Place a call to the specified number.
68 * @param callingPackage The package making the call.
69 * @param number the number to be called.
71 void call(String callingPackage, String number);
74 * End call if there is a call in progress, otherwise does nothing.
76 * @return whether it hung up
81 * End call on particular subId or go to the Home screen
82 * @param subId user preferred subId.
83 * @return whether it hung up
85 boolean endCallForSubscriber(int subId);
88 * Answer the currently-ringing call.
90 * If there's already a current active call, that call will be
91 * automatically put on hold. If both lines are currently in use, the
92 * current active call will be ended.
94 * TODO: provide a flag to let the caller specify what policy to use
95 * if both lines are in use. (The current behavior is hardwired to
96 * "answer incoming, end ongoing", which is how the CALL button
97 * is specced to behave.)
99 * TODO: this should be a oneway call (especially since it's called
100 * directly from the key queue thread).
102 void answerRingingCall();
105 * Answer the currently-ringing call on particular subId .
107 * If there's already a current active call, that call will be
108 * automatically put on hold. If both lines are currently in use, the
109 * current active call will be ended.
111 * TODO: provide a flag to let the caller specify what policy to use
112 * if both lines are in use. (The current behavior is hardwired to
113 * "answer incoming, end ongoing", which is how the CALL button
114 * is specced to behave.)
116 * TODO: this should be a oneway call (especially since it's called
117 * directly from the key queue thread).
119 void answerRingingCallForSubscriber(int subId);
122 * Silence the ringer if an incoming call is currently ringing.
123 * (If vibrating, stop the vibrator also.)
125 * It's safe to call this if the ringer has already been silenced, or
126 * even if there's no incoming call. (If so, this method will do nothing.)
128 * TODO: this should be a oneway call too (see above).
129 * (Actually *all* the methods here that return void can
130 * probably be oneway.)
132 void silenceRinger();
135 * Check if we are in either an active or holding call
136 * @param callingPackage the name of the package making the call.
137 * @return true if the phone state is OFFHOOK.
139 boolean isOffhook(String callingPackage);
142 * Check if a particular subId has an active or holding call
144 * @param subId user preferred subId.
145 * @param callingPackage the name of the package making the call.
146 * @return true if the phone state is OFFHOOK.
148 boolean isOffhookForSubscriber(int subId, String callingPackage);
151 * Check if an incoming phone call is ringing or call waiting
152 * on a particular subId.
154 * @param subId user preferred subId.
155 * @param callingPackage the name of the package making the call.
156 * @return true if the phone state is RINGING.
158 boolean isRingingForSubscriber(int subId, String callingPackage);
161 * Check if an incoming phone call is ringing or call waiting.
162 * @param callingPackage the name of the package making the call.
163 * @return true if the phone state is RINGING.
165 boolean isRinging(String callingPackage);
168 * Check if the phone is idle.
169 * @param callingPackage the name of the package making the call.
170 * @return true if the phone state is IDLE.
172 boolean isIdle(String callingPackage);
175 * Check if the phone is idle on a particular subId.
177 * @param subId user preferred subId.
178 * @param callingPackage the name of the package making the call.
179 * @return true if the phone state is IDLE.
181 boolean isIdleForSubscriber(int subId, String callingPackage);
184 * Check to see if the radio is on or not.
185 * @param callingPackage the name of the package making the call.
186 * @return returns true if the radio is on.
188 boolean isRadioOn(String callingPackage);
191 * Check to see if the radio is on or not on particular subId.
192 * @param subId user preferred subId.
193 * @param callingPackage the name of the package making the call.
194 * @return returns true if the radio is on.
196 boolean isRadioOnForSubscriber(int subId, String callingPackage);
199 * Supply a pin to unlock the SIM. Blocks until a result is determined.
200 * @param pin The pin to check.
201 * @return whether the operation was a success.
203 boolean supplyPin(String pin);
206 * Supply a pin to unlock the SIM for particular subId.
207 * Blocks until a result is determined.
208 * @param pin The pin to check.
209 * @param subId user preferred subId.
210 * @return whether the operation was a success.
212 boolean supplyPinForSubscriber(int subId, String pin);
215 * Supply puk to unlock the SIM and set SIM pin to new pin.
216 * Blocks until a result is determined.
217 * @param puk The puk to check.
218 * pin The new pin to be set in SIM
219 * @return whether the operation was a success.
221 boolean supplyPuk(String puk, String pin);
224 * Supply puk to unlock the SIM and set SIM pin to new pin.
225 * Blocks until a result is determined.
226 * @param puk The puk to check.
227 * pin The new pin to be set in SIM
228 * @param subId user preferred subId.
229 * @return whether the operation was a success.
231 boolean supplyPukForSubscriber(int subId, String puk, String pin);
234 * Supply a pin to unlock the SIM. Blocks until a result is determined.
235 * Returns a specific success/error code.
236 * @param pin The pin to check.
237 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
238 * retValue[1] = number of attempts remaining if known otherwise -1
240 int[] supplyPinReportResult(String pin);
243 * Supply a pin to unlock the SIM. Blocks until a result is determined.
244 * Returns a specific success/error code.
245 * @param pin The pin to check.
246 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
247 * retValue[1] = number of attempts remaining if known otherwise -1
249 int[] supplyPinReportResultForSubscriber(int subId, String pin);
252 * Supply puk to unlock the SIM and set SIM pin to new pin.
253 * Blocks until a result is determined.
254 * Returns a specific success/error code
255 * @param puk The puk to check
256 * pin The pin to check.
257 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
258 * retValue[1] = number of attempts remaining if known otherwise -1
260 int[] supplyPukReportResult(String puk, String pin);
263 * Supply puk to unlock the SIM and set SIM pin to new pin.
264 * Blocks until a result is determined.
265 * Returns a specific success/error code
266 * @param puk The puk to check
267 * pin The pin to check.
268 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
269 * retValue[1] = number of attempts remaining if known otherwise -1
271 int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin);
274 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
275 * without SEND (so <code>dial</code> is not appropriate).
277 * @param dialString the MMI command to be executed.
278 * @return true if MMI command is executed.
280 boolean handlePinMmi(String dialString);
284 * Handles USSD commands.
286 * @param subId The subscription to use.
287 * @param ussdRequest the USSD command to be executed.
288 * @param wrappedCallback receives a callback result.
290 void handleUssdRequest(int subId, String ussdRequest, in ResultReceiver wrappedCallback);
293 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
294 * without SEND (so <code>dial</code> is not appropriate) for
295 * a particular subId.
296 * @param dialString the MMI command to be executed.
297 * @param subId user preferred subId.
298 * @return true if MMI command is executed.
300 boolean handlePinMmiForSubscriber(int subId, String dialString);
303 * Toggles the radio on or off.
305 void toggleRadioOnOff();
308 * Toggles the radio on or off on particular subId.
309 * @param subId user preferred subId.
311 void toggleRadioOnOffForSubscriber(int subId);
314 * Set the radio to on or off
316 boolean setRadio(boolean turnOn);
319 * Set the radio to on or off on particular subId.
320 * @param subId user preferred subId.
322 boolean setRadioForSubscriber(int subId, boolean turnOn);
325 * Set the radio to on or off unconditionally
327 boolean setRadioPower(boolean turnOn);
330 * Request to update location information in service state
332 void updateServiceLocation();
335 * Request to update location information for a subscrition in service state
336 * @param subId user preferred subId.
338 void updateServiceLocationForSubscriber(int subId);
341 * Enable location update notifications.
343 void enableLocationUpdates();
346 * Enable location update notifications.
347 * @param subId user preferred subId.
349 void enableLocationUpdatesForSubscriber(int subId);
352 * Disable location update notifications.
354 void disableLocationUpdates();
357 * Disable location update notifications.
358 * @param subId user preferred subId.
360 void disableLocationUpdatesForSubscriber(int subId);
363 * Allow mobile data connections.
365 boolean enableDataConnectivity();
368 * Disallow mobile data connections.
370 boolean disableDataConnectivity();
373 * Report whether data connectivity is possible.
375 boolean isDataConnectivityPossible(int subId);
377 Bundle getCellLocation(String callingPkg);
380 * Returns the ISO country code equivalent of the current registered
381 * operator's MCC (Mobile Country Code).
382 * @see android.telephony.TelephonyManager#getNetworkCountryIso
384 String getNetworkCountryIsoForPhone(int phoneId);
387 * Returns the neighboring cell information of the device.
389 List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
394 * Returns the call state for a slot.
396 int getCallStateForSlot(int slotIndex);
398 int getDataActivity();
402 * Returns the current active phone type as integer.
403 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
404 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
406 int getActivePhoneType();
409 * Returns the current active phone type as integer for particular slot.
410 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
411 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
412 * @param slotIndex - slot to query.
414 int getActivePhoneTypeForSlot(int slotIndex);
417 * Returns the CDMA ERI icon index to display
418 * @param callingPackage package making the call.
420 int getCdmaEriIconIndex(String callingPackage);
423 * Returns the CDMA ERI icon index to display on particular subId.
424 * @param subId user preferred subId.
425 * @param callingPackage package making the call.
427 int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage);
430 * Returns the CDMA ERI icon mode,
433 * @param callingPackage package making the call.
435 int getCdmaEriIconMode(String callingPackage);
438 * Returns the CDMA ERI icon mode on particular subId,
441 * @param subId user preferred subId.
442 * @param callingPackage package making the call.
444 int getCdmaEriIconModeForSubscriber(int subId, String callingPackage);
447 * Returns the CDMA ERI text,
448 * @param callingPackage package making the call.
450 String getCdmaEriText(String callingPackage);
453 * Returns the CDMA ERI text for particular subId,
454 * @param subId user preferred subId.
455 * @param callingPackage package making the call.
457 String getCdmaEriTextForSubscriber(int subId, String callingPackage);
460 * Returns true if OTA service provisioning needs to run.
461 * Only relevant on some technologies, others will always
464 boolean needsOtaServiceProvisioning();
467 * Sets the voicemail number for a particular subscriber.
469 boolean setVoiceMailNumber(int subId, String alphaTag, String number);
472 * Sets the voice activation state for a particular subscriber.
474 void setVoiceActivationState(int subId, int activationState);
477 * Sets the data activation state for a particular subscriber.
479 void setDataActivationState(int subId, int activationState);
482 * Returns the voice activation state for a particular subscriber.
483 * @param subId user preferred sub
484 * @param callingPackage package queries voice activation state
486 int getVoiceActivationState(int subId, String callingPackage);
489 * Returns the data activation state for a particular subscriber.
490 * @param subId user preferred sub
491 * @param callingPackage package queris data activation state
493 int getDataActivationState(int subId, String callingPackage);
496 * Returns the unread count of voicemails
498 int getVoiceMessageCount();
501 * Returns the unread count of voicemails for a subId.
502 * @param subId user preferred subId.
503 * Returns the unread count of voicemails
505 int getVoiceMessageCountForSubscriber(int subId);
508 * Returns true if current state supports both voice and data
509 * simultaneously. This can change based on location or network condition.
511 boolean isConcurrentVoiceAndDataAllowed(int subId);
513 Bundle getVisualVoicemailSettings(String callingPackage, int subId);
515 String getVisualVoicemailPackageName(String callingPackage, int subId);
517 // Not oneway, caller needs to make sure the vaule is set before receiving a SMS
518 void enableVisualVoicemailSmsFilter(String callingPackage, int subId,
519 in VisualVoicemailSmsFilterSettings settings);
521 oneway void disableVisualVoicemailSmsFilter(String callingPackage, int subId);
523 // Get settings set by the calling package
524 VisualVoicemailSmsFilterSettings getVisualVoicemailSmsFilterSettings(String callingPackage,
528 * Get settings set by the current default dialer, Internal use only.
529 * Requires READ_PRIVILEGED_PHONE_STATE permission.
531 VisualVoicemailSmsFilterSettings getActiveVisualVoicemailSmsFilterSettings(int subId);
534 * Send a visual voicemail SMS. Internal use only.
535 * Requires caller to be the default dialer and have SEND_SMS permission
537 void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId,
538 in String number, in int port, in String text, in PendingIntent sentIntent);
540 // Send the special dialer code. The IPC caller must be the current default dialer.
541 void sendDialerSpecialCode(String callingPackageName, String inputCode);
544 * Returns the network type for data transmission
545 * Legacy call, permission-free
547 int getNetworkType();
550 * Returns the network type of a subId.
551 * @param subId user preferred subId.
552 * @param callingPackage package making the call.
554 int getNetworkTypeForSubscriber(int subId, String callingPackage);
557 * Returns the network type for data transmission
558 * @param callingPackage package making the call.
560 int getDataNetworkType(String callingPackage);
563 * Returns the data network type of a subId
564 * @param subId user preferred subId.
565 * @param callingPackage package making the call.
567 int getDataNetworkTypeForSubscriber(int subId, String callingPackage);
570 * Returns the voice network type of a subId
571 * @param subId user preferred subId.
572 * @param callingPackage package making the call.
573 * Returns the network type
575 int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage);
578 * Return true if an ICC card is present
580 boolean hasIccCard();
583 * Return true if an ICC card is present for a subId.
584 * @param slotIndex user preferred slotIndex.
585 * Return true if an ICC card is present
587 boolean hasIccCardUsingSlotIndex(int slotIndex);
590 * Return if the current radio is LTE on CDMA. This
591 * is a tri-state return value as for a period of time
592 * the mode may be unknown.
594 * @param callingPackage the name of the calling package
595 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
596 * or {@link PHone#LTE_ON_CDMA_TRUE}
598 int getLteOnCdmaMode(String callingPackage);
601 * Return if the current radio is LTE on CDMA. This
602 * is a tri-state return value as for a period of time
603 * the mode may be unknown.
605 * @param callingPackage the name of the calling package
606 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
607 * or {@link PHone#LTE_ON_CDMA_TRUE}
609 int getLteOnCdmaModeForSubscriber(int subId, String callingPackage);
612 * Returns the all observed cell information of the device.
614 List<CellInfo> getAllCellInfo(String callingPkg);
617 * Sets minimum time in milli-seconds between onCellInfoChanged
619 void setCellInfoListRate(int rateInMillis);
628 * Opens a logical channel to the ICC card.
630 * Input parameters equivalent to TS 27.007 AT+CCHO command.
632 * @param subId The subscription to use.
633 * @param callingPackage the name of the package making the call.
634 * @param AID Application id. See ETSI 102.221 and 101.220.
635 * @param p2 P2 parameter (described in ISO 7816-4).
636 * @return an IccOpenLogicalChannelResponse object.
638 IccOpenLogicalChannelResponse iccOpenLogicalChannel(
639 int subId, String callingPackage, String AID, int p2);
642 * Closes a previously opened logical channel to the ICC card.
644 * Input parameters equivalent to TS 27.007 AT+CCHC command.
646 * @param subId The subscription to use.
647 * @param channel is the channel id to be closed as retruned by a
648 * successful iccOpenLogicalChannel.
649 * @return true if the channel was closed successfully.
651 boolean iccCloseLogicalChannel(int subId, int channel);
654 * Transmit an APDU to the ICC card over a logical channel.
656 * Input parameters equivalent to TS 27.007 AT+CGLA command.
658 * @param subId The subscription to use.
659 * @param channel is the channel id to be closed as retruned by a
660 * successful iccOpenLogicalChannel.
661 * @param cla Class of the APDU command.
662 * @param instruction Instruction of the APDU command.
663 * @param p1 P1 value of the APDU command.
664 * @param p2 P2 value of the APDU command.
665 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
666 * is sent to the SIM.
667 * @param data Data to be sent with the APDU.
668 * @return The APDU response from the ICC card with the status appended at
671 String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction,
672 int p1, int p2, int p3, String data);
675 * Transmit an APDU to the ICC card over the basic channel.
677 * Input parameters equivalent to TS 27.007 AT+CSIM command.
679 * @param subId The subscription to use.
680 * @param cla Class of the APDU command.
681 * @param instruction Instruction of the APDU command.
682 * @param p1 P1 value of the APDU command.
683 * @param p2 P2 value of the APDU command.
684 * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
685 * is sent to the SIM.
686 * @param data Data to be sent with the APDU.
687 * @return The APDU response from the ICC card with the status appended at
690 String iccTransmitApduBasicChannel(int subId, int cla, int instruction,
691 int p1, int p2, int p3, String data);
694 * Returns the response APDU for a command APDU sent through SIM_IO.
696 * @param subId The subscription to use.
699 * @param p1 P1 value of the APDU command.
700 * @param p2 P2 value of the APDU command.
701 * @param p3 P3 value of the APDU command.
703 * @return The APDU response.
705 byte[] iccExchangeSimIO(int subId, int fileID, int command, int p1, int p2, int p3,
709 * Send ENVELOPE to the SIM and returns the response.
711 * @param subId The subscription to use.
712 * @param contents String containing SAT/USAT response in hexadecimal
713 * format starting with command tag. See TS 102 223 for
715 * @return The APDU response from the ICC card, with the last 4 bytes
716 * being the status word. If the command fails, returns an empty
719 String sendEnvelopeWithStatus(int subId, String content);
722 * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
723 * Used for device configuration by some CDMA operators.
725 * @param itemID the ID of the item to read.
726 * @return the NV item as a String, or null on any failure.
728 String nvReadItem(int itemID);
731 * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
732 * Used for device configuration by some CDMA operators.
734 * @param itemID the ID of the item to read.
735 * @param itemValue the value to write, as a String.
736 * @return true on success; false on any failure.
738 boolean nvWriteItem(int itemID, String itemValue);
741 * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
742 * Used for device configuration by some CDMA operators.
744 * @param preferredRoamingList byte array containing the new PRL.
745 * @return true on success; false on any failure.
747 boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
750 * Perform the specified type of NV config reset. The radio will be taken offline
751 * and the device must be rebooted after the operation. Used for device
752 * configuration by some CDMA operators.
754 * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
755 * @return true on success; false on any failure.
757 boolean nvResetConfig(int resetType);
760 * Get the calculated preferred network type.
761 * Used for device configuration by some CDMA operators.
762 * @param callingPackage The package making the call.
764 * @return the calculated preferred network type, defined in RILConstants.java.
766 int getCalculatedPreferredNetworkType(String callingPackage);
769 * Get the preferred network type.
770 * Used for device configuration by some CDMA operators.
772 * @param subId the id of the subscription to query.
773 * @return the preferred network type, defined in RILConstants.java.
775 int getPreferredNetworkType(int subId);
778 * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
779 * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
782 * @return 0: Not required. 1: required. 2: Not set.
784 int getTetherApnRequired();
787 * Get ImsServiceController binder from ImsResolver that corresponds to the subId and feature
788 * requested as well as registering the ImsServiceController for callbacks using the
789 * IImsServiceFeatureListener interface.
791 IImsServiceController getImsServiceControllerAndListen(int slotIndex, int feature,
792 IImsServiceFeatureListener callback);
795 * Set the network selection mode to automatic.
797 * @param subId the id of the subscription to update.
799 void setNetworkSelectionModeAutomatic(int subId);
802 * Perform a radio scan and return the list of avialble networks.
804 * @param subId the id of the subscription.
805 * @return CellNetworkScanResult containing status of scan and networks.
807 CellNetworkScanResult getCellNetworkScanResults(int subId);
810 * Perform a radio network scan and return the id of this scan.
812 * @param subId the id of the subscription.
813 * @param request Defines all the configs for network scan.
814 * @param messenger Callback messages will be sent using this messenger.
815 * @param binder the binder object instantiated in TelephonyManager.
816 * @return An id for this scan.
818 int requestNetworkScan(int subId, in NetworkScanRequest request, in Messenger messenger,
822 * Stop an existing radio network scan.
824 * @param subId the id of the subscription.
825 * @param scanId The id of the scan that is going to be stopped.
827 void stopNetworkScan(int subId, int scanId);
830 * Ask the radio to connect to the input network and change selection mode to manual.
832 * @param subId the id of the subscription.
833 * @param operatorInfo the operator to attach to.
834 * @param persistSelection should the selection persist till reboot or its
835 * turned off? Will also result in notification being not shown to
836 * the user if the signal is lost.
837 * @return true if the request suceeded.
839 boolean setNetworkSelectionModeManual(int subId, in OperatorInfo operator,
840 boolean persistSelection);
843 * Set the preferred network type.
844 * Used for device configuration by some CDMA operators.
846 * @param subId the id of the subscription to update.
847 * @param networkType the preferred network type, defined in RILConstants.java.
848 * @return true on success; false on any failure.
850 boolean setPreferredNetworkType(int subId, int networkType);
853 * User enable/disable Mobile Data.
855 * @param enable true to turn on, else false
857 void setDataEnabled(int subId, boolean enable);
860 * Get the user enabled state of Mobile Data.
862 * @return true on enabled
864 boolean getDataEnabled(int subId);
867 * Get P-CSCF address from PCO after data connection is established or modified.
868 * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN
869 * @param callingPackage The package making the call.
871 String[] getPcscfAddress(String apnType, String callingPackage);
874 * Set IMS registration state
876 void setImsRegistrationState(boolean registered);
879 * Return MDN string for CDMA phone.
880 * @param subId user preferred subId.
882 String getCdmaMdn(int subId);
885 * Return MIN string for CDMA phone.
886 * @param subId user preferred subId.
888 String getCdmaMin(int subId);
891 * Has the calling application been granted special privileges by the carrier.
893 * If any of the packages in the calling UID has carrier privileges, the
894 * call will return true. This access is granted by the owner of the UICC
895 * card and does not depend on the registered carrier.
897 * TODO: Add a link to documentation.
899 * @param subId The subscription to use.
900 * @return carrier privilege status defined in TelephonyManager.
902 int getCarrierPrivilegeStatus(int subId);
905 * Similar to above, but check for the package whose name is pkgName.
907 int checkCarrierPrivilegesForPackage(String pkgName);
910 * Similar to above, but check across all phones.
912 int checkCarrierPrivilegesForPackageAnyPhone(String pkgName);
915 * Returns list of the package names of the carrier apps that should handle the input intent
916 * and have carrier privileges for the given phoneId.
918 * @param intent Intent that will be sent.
919 * @param phoneId The phoneId on which the carrier app has carrier privileges.
920 * @return list of carrier app package names that can handle the intent on phoneId.
921 * Returns null if there is an error and an empty list if there
922 * are no matching packages.
924 List<String> getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId);
927 * Set the line 1 phone number string and its alphatag for the current ICCID
928 * for display purpose only, for example, displayed in Phone Status. It won't
929 * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
932 * @param subId the subscriber that the alphatag and dialing number belongs to.
933 * @param alphaTag alpha-tagging of the dailing nubmer
934 * @param number The dialing number
935 * @return true if the operation was executed correctly.
937 boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number);
940 * Returns the displayed dialing number string if it was set previously via
941 * {@link #setLine1NumberForDisplay}. Otherwise returns null.
943 * @param subId whose dialing number for line 1 is returned.
944 * @param callingPackage The package making the call.
945 * @return the displayed dialing number if set, or null if not set.
947 String getLine1NumberForDisplay(int subId, String callingPackage);
950 * Returns the displayed alphatag of the dialing number if it was set
951 * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null.
953 * @param subId whose alphatag associated with line 1 is returned.
954 * @param callingPackage The package making the call.
955 * @return the displayed alphatag of the dialing number if set, or null if
958 String getLine1AlphaTagForDisplay(int subId, String callingPackage);
960 String[] getMergedSubscriberIds(String callingPackage);
963 * Override the operator branding for the current ICCID.
965 * Once set, whenever the SIM is present in the device, the service
966 * provider name (SPN) and the operator name will both be replaced by the
967 * brand value input. To unset the value, the same function should be
968 * called with a null brand value.
970 * <p>Requires Permission:
971 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
972 * or has to be carrier app - see #hasCarrierPrivileges.
974 * @param subId The subscription to use.
975 * @param brand The brand name to display/set.
976 * @return true if the operation was executed correctly.
978 boolean setOperatorBrandOverride(int subId, String brand);
981 * Override the roaming indicator for the current ICCID.
983 * Using this call, the carrier app (see #hasCarrierPrivileges) can override
984 * the platform's notion of a network operator being considered roaming or not.
985 * The change only affects the ICCID that was active when this call was made.
987 * If null is passed as any of the input, the corresponding value is deleted.
989 * <p>Requires that the caller have carrier privilege. See #hasCarrierPrivileges.
991 * @param subId for which the roaming overrides apply.
992 * @param gsmRoamingList - List of MCCMNCs to be considered roaming for 3GPP RATs.
993 * @param gsmNonRoamingList - List of MCCMNCs to be considered not roaming for 3GPP RATs.
994 * @param cdmaRoamingList - List of SIDs to be considered roaming for 3GPP2 RATs.
995 * @param cdmaNonRoamingList - List of SIDs to be considered not roaming for 3GPP2 RATs.
996 * @return true if the operation was executed correctly.
998 boolean setRoamingOverride(int subId, in List<String> gsmRoamingList,
999 in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList,
1000 in List<String> cdmaNonRoamingList);
1003 * Returns the result and response from RIL for oem request
1005 * @param oemReq the data is sent to ril.
1006 * @param oemResp the respose data from RIL.
1007 * @return negative value request was not handled or get error
1008 * 0 request was handled succesfully, but no response data
1009 * positive value success, data length of response
1011 int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
1014 * Check if any mobile Radios need to be shutdown.
1016 * @return true is any mobile radio needs to be shutdown
1018 boolean needMobileRadioShutdown();
1021 * Shutdown Mobile Radios
1023 void shutdownMobileRadios();
1026 * Set phone radio type and access technology.
1028 * @param rafs an RadioAccessFamily array to indicate all phone's
1029 * new radio access family. The length of RadioAccessFamily
1030 * must equ]]al to phone count.
1032 void setRadioCapability(in RadioAccessFamily[] rafs);
1035 * Get phone radio type and access technology.
1037 * @param phoneId which phone you want to get
1038 * @param callingPackage the name of the package making the call
1039 * @return phone radio type and access technology
1041 int getRadioAccessFamily(in int phoneId, String callingPackage);
1044 * Enables or disables video calling.
1046 * @param enable Whether to enable video calling.
1048 void enableVideoCalling(boolean enable);
1051 * Whether video calling has been enabled by the user.
1053 * @param callingPackage The package making the call.
1054 * @return {@code true} if the user has enabled video calling, {@code false} otherwise.
1056 boolean isVideoCallingEnabled(String callingPackage);
1059 * Whether the DTMF tone length can be changed.
1061 * @return {@code true} if the DTMF tone length can be changed.
1063 boolean canChangeDtmfToneLength();
1066 * Whether the device is a world phone.
1068 * @return {@code true} if the devices is a world phone.
1070 boolean isWorldPhone();
1073 * Whether the phone supports TTY mode.
1075 * @return {@code true} if the device supports TTY mode.
1077 boolean isTtyModeSupported();
1080 * Whether the phone supports hearing aid compatibility.
1082 * @return {@code true} if the device supports hearing aid compatibility.
1084 boolean isHearingAidCompatibilitySupported();
1087 * Get IMS Registration Status
1089 boolean isImsRegistered();
1092 * Returns the Status of Wi-Fi Calling
1094 boolean isWifiCallingAvailable();
1097 * Returns the Status of Volte
1099 boolean isVolteAvailable();
1102 * Returns the Status of VT (video telephony)
1104 boolean isVideoTelephonyAvailable();
1107 * Returns the unique device ID of phone, for example, the IMEI for
1108 * GSM and the MEID for CDMA phones. Return null if device ID is not available.
1110 * @param callingPackage The package making the call.
1111 * <p>Requires Permission:
1112 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1114 String getDeviceId(String callingPackage);
1117 * Returns the IMEI for the given slot.
1119 * @param slotIndex - device slot.
1120 * @param callingPackage The package making the call.
1121 * <p>Requires Permission:
1122 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1124 String getImeiForSlot(int slotIndex, String callingPackage);
1127 * Returns the MEID for the given slot.
1129 * @param slotIndex - device slot.
1130 * @param callingPackage The package making the call.
1131 * <p>Requires Permission:
1132 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1134 String getMeidForSlot(int slotIndex, String callingPackage);
1137 * Returns the device software version.
1139 * @param slotIndex - device slot.
1140 * @param callingPackage The package making the call.
1141 * <p>Requires Permission:
1142 * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1144 String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage);
1147 * Returns the subscription ID associated with the specified PhoneAccount.
1149 int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
1151 void factoryReset(int subId);
1154 * An estimate of the users's current locale based on the default SIM.
1156 * The returned string will be a well formed BCP-47 language tag, or {@code null}
1157 * if no locale could be derived.
1159 String getLocaleFromDefaultSim();
1162 * Requests the modem activity info asynchronously.
1163 * The implementor is expected to reply with the
1164 * {@link android.telephony.ModemActivityInfo} object placed into the Bundle with the key
1165 * {@link android.telephony.TelephonyManager#MODEM_ACTIVITY_RESULT_KEY}.
1166 * The result code is ignored.
1168 oneway void requestModemActivityInfo(in ResultReceiver result);
1171 * Get the service state on specified subscription
1172 * @param subId Subscription id
1173 * @param callingPackage The package making the call
1174 * @return Service state on specified subscription.
1176 ServiceState getServiceStateForSubscriber(int subId, String callingPackage);
1179 * Returns the URI for the per-account voicemail ringtone set in Phone settings.
1181 * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
1182 * voicemail ringtone.
1183 * @return The URI for the ringtone to play when receiving a voicemail from a specific
1186 Uri getVoicemailRingtoneUri(in PhoneAccountHandle accountHandle);
1189 * Sets the per-account voicemail ringtone.
1191 * <p>Requires that the calling app is the default dialer, or has carrier privileges, or
1192 * has permission {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
1194 * @param phoneAccountHandle The handle for the {@link PhoneAccount} for which to set the
1195 * voicemail ringtone.
1196 * @param uri The URI for the ringtone to play when receiving a voicemail from a specific
1199 void setVoicemailRingtoneUri(String callingPackage,
1200 in PhoneAccountHandle phoneAccountHandle, in Uri uri);
1203 * Returns whether vibration is set for voicemail notification in Phone settings.
1205 * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
1206 * voicemail vibration setting.
1207 * @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise.
1209 boolean isVoicemailVibrationEnabled(in PhoneAccountHandle accountHandle);
1212 * Sets the per-account preference whether vibration is enabled for voicemail notifications.
1214 * <p>Requires that the calling app is the default dialer, or has carrier privileges, or
1215 * has permission {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
1217 * @param phoneAccountHandle The handle for the {@link PhoneAccount} for which to set the
1218 * voicemail vibration setting.
1219 * @param enabled Whether to enable or disable vibration for voicemail notifications from a
1220 * specific PhoneAccount.
1222 void setVoicemailVibrationEnabled(String callingPackage,
1223 in PhoneAccountHandle phoneAccountHandle, boolean enabled);
1226 * Returns a list of packages that have carrier privileges.
1228 List<String> getPackagesWithCarrierPrivileges();
1231 * Return the application ID for the app type.
1233 * @param subId the subscription ID that this request applies to.
1234 * @param appType the uicc app type,
1235 * @return Application ID for specificied app type or null if no uicc or error.
1237 String getAidForAppType(int subId, int appType);
1240 * Return the Electronic Serial Number.
1242 * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
1244 * @param subId the subscription ID that this request applies to.
1245 * @return ESN or null if error.
1248 String getEsn(int subId);
1251 * Return the Preferred Roaming List Version
1253 * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
1254 * @param subId the subscription ID that this request applies to.
1255 * @return PRLVersion or null if error.
1258 String getCdmaPrlVersion(int subId);
1261 * Get snapshot of Telephony histograms
1262 * @return List of Telephony histograms
1263 * Requires Permission:
1264 * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
1265 * Or the calling app has carrier privileges.
1267 List<TelephonyHistogram> getTelephonyHistograms();
1270 * Set the allowed carrier list for slotIndex
1271 * Require system privileges. In the future we may add this to carrier APIs.
1273 * @return The number of carriers set successfully. Should match length of
1274 * carriers on success.
1276 int setAllowedCarriers(int slotIndex, in List<CarrierIdentifier> carriers);
1279 * Get the allowed carrier list for slotIndex.
1280 * Require system privileges. In the future we may add this to carrier APIs.
1282 * @return List of {@link android.service.carrier.CarrierIdentifier}; empty list
1283 * means all carriers are allowed.
1285 List<CarrierIdentifier> getAllowedCarriers(int slotIndex);
1288 * Action set from carrier signalling broadcast receivers to enable/disable metered apns
1289 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1290 * @param subId the subscription ID that this action applies to.
1291 * @param enabled control enable or disable metered apns.
1294 void carrierActionSetMeteredApnsEnabled(int subId, boolean visible);
1297 * Action set from carrier signalling broadcast receivers to enable/disable radio
1298 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1299 * @param subId the subscription ID that this action applies to.
1300 * @param enabled control enable or disable radio.
1303 void carrierActionSetRadioEnabled(int subId, boolean enabled);
1306 * Action set from carrier signalling broadcast receivers to start/stop reporting default
1307 * network conditions.
1308 * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1309 * @param subId the subscription ID that this action applies to.
1310 * @param report control start/stop reporting default network events.
1313 void carrierActionReportDefaultNetworkStatus(int subId, boolean report);
1316 * Get aggregated video call data usage since boot.
1317 * Permissions android.Manifest.permission.READ_NETWORK_USAGE_HISTORY is required.
1319 * @param perUidStats True if requesting data usage per uid, otherwise overall usage.
1320 * @return Snapshot of video call data usage
1323 NetworkStats getVtDataUsage(int subId, boolean perUidStats);
1326 * Policy control of data connection. Usually used when data limit is passed.
1327 * @param enabled True if enabling the data, otherwise disabling.
1328 * @param subId Subscription index
1331 void setPolicyDataEnabled(boolean enabled, int subId);
1334 * Get Client request stats which will contain statistical information
1335 * on each request made by client.
1336 * @param callingPackage package making the call.
1337 * @param subId Subscription index
1340 List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid);
1343 * Set SIM card power state.
1344 * @param slotIndex SIM slot id
1345 * @param state State of SIM (power down, power up, pass through)
1348 void setSimPowerStateForSlot(int slotIndex, int state);
1351 * Returns a list of Forbidden PLMNs from the specified SIM App
1352 * Returns null if the query fails.
1355 * <p>Requires that the calling app has READ_PRIVILEGED_PHONE_STATE or READ_PHONE_STATE
1357 * @param subId subscription ID used for authentication
1358 * @param appType the icc application type, like {@link #APPTYPE_USIM}
1360 String[] getForbiddenPlmns(int subId, int appType, String callingPackage);
1363 * Check if phone is in emergency callback mode
1364 * @return true if phone is in emergency callback mode
1365 * @param subId the subscription ID that this action applies to.
1368 boolean getEmergencyCallbackMode(int subId);
1371 * Get the most recently available signal strength information.
1373 * Get the most recent SignalStrength information reported by the modem. Due
1374 * to power saving this information may not always be current.
1375 * @param subId Subscription index
1376 * @return the most recent cached signal strength info from the modem
1379 SignalStrength getSignalStrength(int subId);