OSDN Git Service

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