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