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