ITelephony.aidl revision 20f2ebbf4d16e0654efe73ac92afc89c29cfaede
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    oneway void setVisualVoicemailEnabled(String callingPackage,
458            in PhoneAccountHandle accountHandle, boolean enabled);
459
460    boolean isVisualVoicemailEnabled(String callingPackage,
461            in PhoneAccountHandle accountHandle);
462
463    // Not oneway, caller needs to make sure the vaule is set before receiving a SMS
464    void enableVisualVoicemailSmsFilter(String callingPackage, int subId,
465            in VisualVoicemailSmsFilterSettings settings);
466
467    oneway void disableVisualVoicemailSmsFilter(String callingPackage, int subId);
468
469    // Get settings set by the calling package
470    VisualVoicemailSmsFilterSettings getVisualVoicemailSmsFilterSettings(String callingPackage,
471            int subId);
472
473    // Get settings set by the package, requires READ_PRIVILEGED_PHONE_STATE permission
474    VisualVoicemailSmsFilterSettings getSystemVisualVoicemailSmsFilterSettings(String packageName,
475            int subId);
476
477    /**
478     * Returns the network type for data transmission
479     * Legacy call, permission-free
480     */
481    int getNetworkType();
482
483    /**
484     * Returns the network type of a subId.
485     * @param subId user preferred subId.
486     * @param callingPackage package making the call.
487     */
488    int getNetworkTypeForSubscriber(int subId, String callingPackage);
489
490    /**
491     * Returns the network type for data transmission
492     * @param callingPackage package making the call.
493     */
494    int getDataNetworkType(String callingPackage);
495
496    /**
497     * Returns the data network type of a subId
498     * @param subId user preferred subId.
499     * @param callingPackage package making the call.
500     */
501    int getDataNetworkTypeForSubscriber(int subId, String callingPackage);
502
503    /**
504      * Returns the voice network type of a subId
505      * @param subId user preferred subId.
506      * @param callingPackage package making the call.
507      * Returns the network type
508      */
509    int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage);
510
511    /**
512     * Return true if an ICC card is present
513     */
514    boolean hasIccCard();
515
516    /**
517     * Return true if an ICC card is present for a subId.
518     * @param slotId user preferred slotId.
519     * Return true if an ICC card is present
520     */
521    boolean hasIccCardUsingSlotId(int slotId);
522
523    /**
524     * Return if the current radio is LTE on CDMA. This
525     * is a tri-state return value as for a period of time
526     * the mode may be unknown.
527     *
528     * @param callingPackage the name of the calling package
529     * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
530     * or {@link PHone#LTE_ON_CDMA_TRUE}
531     */
532    int getLteOnCdmaMode(String callingPackage);
533
534    /**
535     * Return if the current radio is LTE on CDMA. This
536     * is a tri-state return value as for a period of time
537     * the mode may be unknown.
538     *
539     * @param callingPackage the name of the calling package
540     * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
541     * or {@link PHone#LTE_ON_CDMA_TRUE}
542     */
543    int getLteOnCdmaModeForSubscriber(int subId, String callingPackage);
544
545    /**
546     * Returns the all observed cell information of the device.
547     */
548    List<CellInfo> getAllCellInfo(String callingPkg);
549
550    /**
551     * Sets minimum time in milli-seconds between onCellInfoChanged
552     */
553    void setCellInfoListRate(int rateInMillis);
554
555    /**
556     * get default sim
557     * @return sim id
558     */
559    int getDefaultSim();
560
561    /**
562     * Opens a logical channel to the ICC card.
563     *
564     * Input parameters equivalent to TS 27.007 AT+CCHO command.
565     *
566     * @param subId The subscription to use.
567     * @param AID Application id. See ETSI 102.221 and 101.220.
568     * @return an IccOpenLogicalChannelResponse object.
569     */
570    IccOpenLogicalChannelResponse iccOpenLogicalChannel(int subId, String AID);
571
572    /**
573     * Closes a previously opened logical channel to the ICC card.
574     *
575     * Input parameters equivalent to TS 27.007 AT+CCHC command.
576     *
577     * @param subId The subscription to use.
578     * @param channel is the channel id to be closed as retruned by a
579     *            successful iccOpenLogicalChannel.
580     * @return true if the channel was closed successfully.
581     */
582    boolean iccCloseLogicalChannel(int subId, int channel);
583
584    /**
585     * Transmit an APDU to the ICC card over a logical channel.
586     *
587     * Input parameters equivalent to TS 27.007 AT+CGLA command.
588     *
589     * @param subId The subscription to use.
590     * @param channel is the channel id to be closed as retruned by a
591     *            successful iccOpenLogicalChannel.
592     * @param cla Class of the APDU command.
593     * @param instruction Instruction of the APDU command.
594     * @param p1 P1 value of the APDU command.
595     * @param p2 P2 value of the APDU command.
596     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
597     *            is sent to the SIM.
598     * @param data Data to be sent with the APDU.
599     * @return The APDU response from the ICC card with the status appended at
600     *            the end.
601     */
602    String iccTransmitApduLogicalChannel(int subId, int channel, int cla, int instruction,
603            int p1, int p2, int p3, String data);
604
605    /**
606     * Transmit an APDU to the ICC card over the basic channel.
607     *
608     * Input parameters equivalent to TS 27.007 AT+CSIM command.
609     *
610     * @param subId The subscription to use.
611     * @param cla Class of the APDU command.
612     * @param instruction Instruction of the APDU command.
613     * @param p1 P1 value of the APDU command.
614     * @param p2 P2 value of the APDU command.
615     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
616     *            is sent to the SIM.
617     * @param data Data to be sent with the APDU.
618     * @return The APDU response from the ICC card with the status appended at
619     *            the end.
620     */
621    String iccTransmitApduBasicChannel(int subId, int cla, int instruction,
622            int p1, int p2, int p3, String data);
623
624    /**
625     * Returns the response APDU for a command APDU sent through SIM_IO.
626     *
627     * @param subId The subscription to use.
628     * @param fileID
629     * @param command
630     * @param p1 P1 value of the APDU command.
631     * @param p2 P2 value of the APDU command.
632     * @param p3 P3 value of the APDU command.
633     * @param filePath
634     * @return The APDU response.
635     */
636    byte[] iccExchangeSimIO(int subId, int fileID, int command, int p1, int p2, int p3,
637            String filePath);
638
639    /**
640     * Send ENVELOPE to the SIM and returns the response.
641     *
642     * @param subId The subscription to use.
643     * @param contents  String containing SAT/USAT response in hexadecimal
644     *                  format starting with command tag. See TS 102 223 for
645     *                  details.
646     * @return The APDU response from the ICC card, with the last 4 bytes
647     *         being the status word. If the command fails, returns an empty
648     *         string.
649     */
650    String sendEnvelopeWithStatus(int subId, String content);
651
652    /**
653     * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
654     * Used for device configuration by some CDMA operators.
655     *
656     * @param itemID the ID of the item to read.
657     * @return the NV item as a String, or null on any failure.
658     */
659    String nvReadItem(int itemID);
660
661    /**
662     * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
663     * Used for device configuration by some CDMA operators.
664     *
665     * @param itemID the ID of the item to read.
666     * @param itemValue the value to write, as a String.
667     * @return true on success; false on any failure.
668     */
669    boolean nvWriteItem(int itemID, String itemValue);
670
671    /**
672     * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
673     * Used for device configuration by some CDMA operators.
674     *
675     * @param preferredRoamingList byte array containing the new PRL.
676     * @return true on success; false on any failure.
677     */
678    boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
679
680    /**
681     * Perform the specified type of NV config reset. The radio will be taken offline
682     * and the device must be rebooted after the operation. Used for device
683     * configuration by some CDMA operators.
684     *
685     * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
686     * @return true on success; false on any failure.
687     */
688    boolean nvResetConfig(int resetType);
689
690    /*
691     * Get the calculated preferred network type.
692     * Used for device configuration by some CDMA operators.
693     * @param callingPackage The package making the call.
694     *
695     * @return the calculated preferred network type, defined in RILConstants.java.
696     */
697    int getCalculatedPreferredNetworkType(String callingPackage);
698
699    /*
700     * Get the preferred network type.
701     * Used for device configuration by some CDMA operators.
702     *
703     * @param subId the id of the subscription to query.
704     * @return the preferred network type, defined in RILConstants.java.
705     */
706    int getPreferredNetworkType(int subId);
707
708    /**
709     * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
710     * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
711     * tethering.
712     *
713     * @return 0: Not required. 1: required. 2: Not set.
714     */
715    int getTetherApnRequired();
716
717    /**
718     * Set the network selection mode to automatic.
719     *
720     * @param subId the id of the subscription to update.
721     */
722    void setNetworkSelectionModeAutomatic(int subId);
723
724    /**
725     * Perform a radio scan and return the list of avialble networks.
726     *
727     * @param subId the id of the subscription.
728     * @return CellNetworkScanResult containing status of scan and networks.
729     */
730    CellNetworkScanResult getCellNetworkScanResults(int subId);
731
732    /**
733     * Ask the radio to connect to the input network and change selection mode to manual.
734     *
735     * @param subId the id of the subscription.
736     * @param operatorInfo the operator to attach to.
737     * @param persistSelection should the selection persist till reboot or its
738     *        turned off? Will also result in notification being not shown to
739     *        the user if the signal is lost.
740     * @return true if the request suceeded.
741     */
742    boolean setNetworkSelectionModeManual(int subId, in OperatorInfo operator,
743            boolean persistSelection);
744
745    /**
746     * Set the preferred network type.
747     * Used for device configuration by some CDMA operators.
748     *
749     * @param subId the id of the subscription to update.
750     * @param networkType the preferred network type, defined in RILConstants.java.
751     * @return true on success; false on any failure.
752     */
753    boolean setPreferredNetworkType(int subId, int networkType);
754
755    /**
756     * User enable/disable Mobile Data.
757     *
758     * @param enable true to turn on, else false
759     */
760    void setDataEnabled(int subId, boolean enable);
761
762    /**
763     * Get the user enabled state of Mobile Data.
764     *
765     * @return true on enabled
766     */
767    boolean getDataEnabled(int subId);
768
769    /**
770     * Get P-CSCF address from PCO after data connection is established or modified.
771     * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN
772     * @param callingPackage The package making the call.
773     */
774    String[] getPcscfAddress(String apnType, String callingPackage);
775
776    /**
777     * Set IMS registration state
778     */
779    void setImsRegistrationState(boolean registered);
780
781    /**
782     * Return MDN string for CDMA phone.
783     * @param subId user preferred subId.
784     */
785    String getCdmaMdn(int subId);
786
787    /**
788     * Return MIN string for CDMA phone.
789     * @param subId user preferred subId.
790     */
791    String getCdmaMin(int subId);
792
793    /**
794     * Has the calling application been granted special privileges by the carrier.
795     *
796     * If any of the packages in the calling UID has carrier privileges, the
797     * call will return true. This access is granted by the owner of the UICC
798     * card and does not depend on the registered carrier.
799     *
800     * TODO: Add a link to documentation.
801     *
802     * @param subId The subscription to use.
803     * @return carrier privilege status defined in TelephonyManager.
804     */
805    int getCarrierPrivilegeStatus(int subId);
806
807    /**
808     * Similar to above, but check for the package whose name is pkgName.
809     */
810    int checkCarrierPrivilegesForPackage(String pkgName);
811
812    /**
813     * Similar to above, but check across all phones.
814     */
815    int checkCarrierPrivilegesForPackageAnyPhone(String pkgName);
816
817    /**
818     * Returns list of the package names of the carrier apps that should handle the input intent
819     * and have carrier privileges for the given phoneId.
820     *
821     * @param intent Intent that will be sent.
822     * @param phoneId The phoneId on which the carrier app has carrier privileges.
823     * @return list of carrier app package names that can handle the intent on phoneId.
824     *         Returns null if there is an error and an empty list if there
825     *         are no matching packages.
826     */
827    List<String> getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId);
828
829    /**
830     * Set the line 1 phone number string and its alphatag for the current ICCID
831     * for display purpose only, for example, displayed in Phone Status. It won't
832     * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
833     * value.
834     *
835     * @param subId the subscriber that the alphatag and dialing number belongs to.
836     * @param alphaTag alpha-tagging of the dailing nubmer
837     * @param number The dialing number
838     * @return true if the operation was executed correctly.
839     */
840    boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number);
841
842    /**
843     * Returns the displayed dialing number string if it was set previously via
844     * {@link #setLine1NumberForDisplay}. Otherwise returns null.
845     *
846     * @param subId whose dialing number for line 1 is returned.
847     * @param callingPackage The package making the call.
848     * @return the displayed dialing number if set, or null if not set.
849     */
850    String getLine1NumberForDisplay(int subId, String callingPackage);
851
852    /**
853     * Returns the displayed alphatag of the dialing number if it was set
854     * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null.
855     *
856     * @param subId whose alphatag associated with line 1 is returned.
857     * @param callingPackage The package making the call.
858     * @return the displayed alphatag of the dialing number if set, or null if
859     *         not set.
860     */
861    String getLine1AlphaTagForDisplay(int subId, String callingPackage);
862
863    String[] getMergedSubscriberIds(String callingPackage);
864
865    /**
866     * Override the operator branding for the current ICCID.
867     *
868     * Once set, whenever the SIM is present in the device, the service
869     * provider name (SPN) and the operator name will both be replaced by the
870     * brand value input. To unset the value, the same function should be
871     * called with a null brand value.
872     *
873     * <p>Requires Permission:
874     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
875     *  or has to be carrier app - see #hasCarrierPrivileges.
876     *
877     * @param subId The subscription to use.
878     * @param brand The brand name to display/set.
879     * @return true if the operation was executed correctly.
880     */
881    boolean setOperatorBrandOverride(int subId, String brand);
882
883    /**
884     * Override the roaming indicator for the current ICCID.
885     *
886     * Using this call, the carrier app (see #hasCarrierPrivileges) can override
887     * the platform's notion of a network operator being considered roaming or not.
888     * The change only affects the ICCID that was active when this call was made.
889     *
890     * If null is passed as any of the input, the corresponding value is deleted.
891     *
892     * <p>Requires that the caller have carrier privilege. See #hasCarrierPrivileges.
893     *
894     * @param subId for which the roaming overrides apply.
895     * @param gsmRoamingList - List of MCCMNCs to be considered roaming for 3GPP RATs.
896     * @param gsmNonRoamingList - List of MCCMNCs to be considered not roaming for 3GPP RATs.
897     * @param cdmaRoamingList - List of SIDs to be considered roaming for 3GPP2 RATs.
898     * @param cdmaNonRoamingList - List of SIDs to be considered not roaming for 3GPP2 RATs.
899     * @return true if the operation was executed correctly.
900     */
901    boolean setRoamingOverride(int subId, in List<String> gsmRoamingList,
902            in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList,
903            in List<String> cdmaNonRoamingList);
904
905    /**
906     * Returns the result and response from RIL for oem request
907     *
908     * @param oemReq the data is sent to ril.
909     * @param oemResp the respose data from RIL.
910     * @return negative value request was not handled or get error
911     *         0 request was handled succesfully, but no response data
912     *         positive value success, data length of response
913     */
914    int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
915
916    /**
917     * Check if any mobile Radios need to be shutdown.
918     *
919     * @return true is any mobile radio needs to be shutdown
920     */
921    boolean needMobileRadioShutdown();
922
923    /**
924     * Shutdown Mobile Radios
925     */
926    void shutdownMobileRadios();
927
928    /**
929     * Set phone radio type and access technology.
930     *
931     * @param rafs an RadioAccessFamily array to indicate all phone's
932     *        new radio access family. The length of RadioAccessFamily
933     *        must equ]]al to phone count.
934     */
935    void setRadioCapability(in RadioAccessFamily[] rafs);
936
937    /**
938     * Get phone radio type and access technology.
939     *
940     * @param phoneId which phone you want to get
941     * @param callingPackage the name of the package making the call
942     * @return phone radio type and access technology
943     */
944    int getRadioAccessFamily(in int phoneId, String callingPackage);
945
946    /**
947     * Enables or disables video calling.
948     *
949     * @param enable Whether to enable video calling.
950     */
951    void enableVideoCalling(boolean enable);
952
953    /**
954     * Whether video calling has been enabled by the user.
955     *
956     * @param callingPackage The package making the call.
957     * @return {@code true} if the user has enabled video calling, {@code false} otherwise.
958     */
959    boolean isVideoCallingEnabled(String callingPackage);
960
961    /**
962     * Whether the DTMF tone length can be changed.
963     *
964     * @return {@code true} if the DTMF tone length can be changed.
965     */
966    boolean canChangeDtmfToneLength();
967
968    /**
969     * Whether the device is a world phone.
970     *
971     * @return {@code true} if the devices is a world phone.
972     */
973    boolean isWorldPhone();
974
975    /**
976     * Whether the phone supports TTY mode.
977     *
978     * @return {@code true} if the device supports TTY mode.
979     */
980    boolean isTtyModeSupported();
981
982    /**
983     * Whether the phone supports hearing aid compatibility.
984     *
985     * @return {@code true} if the device supports hearing aid compatibility.
986     */
987    boolean isHearingAidCompatibilitySupported();
988
989    /**
990     * Get IMS Registration Status
991     */
992    boolean isImsRegistered();
993
994    /**
995     * Returns the Status of Wi-Fi Calling
996     */
997    boolean isWifiCallingAvailable();
998
999    /**
1000     * Returns the Status of Volte
1001     */
1002    boolean isVolteAvailable();
1003
1004     /**
1005     * Returns the Status of VT (video telephony)
1006     */
1007    boolean isVideoTelephonyAvailable();
1008
1009    /**
1010      * Returns the unique device ID of phone, for example, the IMEI for
1011      * GSM and the MEID for CDMA phones. Return null if device ID is not available.
1012      *
1013      * @param callingPackage The package making the call.
1014      * <p>Requires Permission:
1015      *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1016      */
1017    String getDeviceId(String callingPackage);
1018
1019    /**
1020     * Returns the IMEI for the given slot.
1021     *
1022     * @param slotId - device slot.
1023     * @param callingPackage The package making the call.
1024     * <p>Requires Permission:
1025     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1026     */
1027    String getImeiForSlot(int slotId, String callingPackage);
1028
1029    /**
1030     * Returns the device software version.
1031     *
1032     * @param slotId - device slot.
1033     * @param callingPackage The package making the call.
1034     * <p>Requires Permission:
1035     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
1036     */
1037    String getDeviceSoftwareVersionForSlot(int slotId, String callingPackage);
1038
1039    /**
1040     * Returns the subscription ID associated with the specified PhoneAccount.
1041     */
1042    int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
1043
1044    void factoryReset(int subId);
1045
1046    /**
1047     * An estimate of the users's current locale based on the default SIM.
1048     *
1049     * The returned string will be a well formed BCP-47 language tag, or {@code null}
1050     * if no locale could be derived.
1051     */
1052    String getLocaleFromDefaultSim();
1053
1054    /**
1055     * Requests the modem activity info asynchronously.
1056     * The implementor is expected to reply with the
1057     * {@link android.telephony.ModemActivityInfo} object placed into the Bundle with the key
1058     * {@link android.telephony.TelephonyManager#MODEM_ACTIVITY_RESULT_KEY}.
1059     * The result code is ignored.
1060     */
1061    oneway void requestModemActivityInfo(in ResultReceiver result);
1062
1063    /**
1064     * Get the service state on specified subscription
1065     * @param subId Subscription id
1066     * @param callingPackage The package making the call
1067     * @return Service state on specified subscription.
1068     */
1069    ServiceState getServiceStateForSubscriber(int subId, String callingPackage);
1070
1071    /**
1072     * Returns the URI for the per-account voicemail ringtone set in Phone settings.
1073     *
1074     * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
1075     * voicemail ringtone.
1076     * @return The URI for the ringtone to play when receiving a voicemail from a specific
1077     * PhoneAccount.
1078     */
1079    Uri getVoicemailRingtoneUri(in PhoneAccountHandle accountHandle);
1080
1081    /**
1082     * Returns whether vibration is set for voicemail notification in Phone settings.
1083     *
1084     * @param accountHandle The handle for the {@link PhoneAccount} for which to retrieve the
1085     * voicemail vibration setting.
1086     * @return {@code true} if the vibration is set for this PhoneAccount, {@code false} otherwise.
1087     */
1088    boolean isVoicemailVibrationEnabled(in PhoneAccountHandle accountHandle);
1089
1090    /**
1091     * Returns a list of packages that have carrier privileges.
1092     */
1093    List<String> getPackagesWithCarrierPrivileges();
1094
1095    /**
1096     * Return the application ID for the app type.
1097     *
1098     * @param subId the subscription ID that this request applies to.
1099     * @param appType the uicc app type,
1100     * @return Application ID for specificied app type or null if no uicc or error.
1101     */
1102    String getAidForAppType(int subId, int appType);
1103
1104    /**
1105    * Return the Electronic Serial Number.
1106    *
1107    * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
1108    *
1109    * @param subId the subscription ID that this request applies to.
1110    * @return ESN or null if error.
1111    * @hide
1112    */
1113    String getEsn(int subId);
1114
1115    /**
1116    * Return the Preferred Roaming List Version
1117    *
1118    * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission
1119    * @param subId the subscription ID that this request applies to.
1120    * @return PRLVersion or null if error.
1121    * @hide
1122    */
1123    String getCdmaPrlVersion(int subId);
1124
1125    /**
1126     * Get snapshot of Telephony histograms
1127     * @return List of Telephony histograms
1128     * Requires Permission:
1129     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
1130     * Or the calling app has carrier privileges.
1131     */
1132    List<TelephonyHistogram> getTelephonyHistograms();
1133
1134    /**
1135     * Set the allowed carrier list for slotId
1136     * Require system privileges. In the future we may add this to carrier APIs.
1137     *
1138     * @return The number of carriers set successfully. Should match length of
1139     * carriers on success.
1140     */
1141    int setAllowedCarriers(int slotId, in List<CarrierIdentifier> carriers);
1142
1143    /**
1144     * Get the allowed carrier list for slotId.
1145     * Require system privileges. In the future we may add this to carrier APIs.
1146     *
1147     * @return List of {@link android.service.carrier.CarrierIdentifier}; empty list
1148     * means all carriers are allowed.
1149     */
1150    List<CarrierIdentifier> getAllowedCarriers(int slotId);
1151
1152    /**
1153     * Action set from carrier signalling broadcast receivers to enable/disable metered apns
1154     * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1155     * @param subId the subscription ID that this action applies to.
1156     * @param enabled control enable or disable metered apns.
1157     * @hide
1158     */
1159    void carrierActionSetMeteredApnsEnabled(int subId, boolean visible);
1160
1161    /**
1162     * Action set from carrier signalling broadcast receivers to enable/disable radio
1163     * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
1164     * @param subId the subscription ID that this action applies to.
1165     * @param enabled control enable or disable radio.
1166     * @hide
1167     */
1168    void carrierActionSetRadioEnabled(int subId, boolean enabled);
1169
1170    /**
1171     * Get aggregated video call data usage since boot.
1172     * Permissions android.Manifest.permission.READ_NETWORK_USAGE_HISTORY is required.
1173     * @return total data usage in bytes
1174     * @hide
1175     */
1176    long getVtDataUsage();
1177
1178    /**
1179     * Policy control of data connection. Usually used when data limit is passed.
1180     * @param enabled True if enabling the data, otherwise disabling.
1181     * @param subId Subscription index
1182     * @hide
1183     */
1184    void setPolicyDataEnabled(boolean enabled, int subId);
1185}
1186