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