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