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