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