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