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