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