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