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