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