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