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