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