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