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