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