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