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.content.Intent;
20 import android.os.Bundle;
21 import android.telephony.CellInfo;
22 import android.telephony.IccOpenLogicalChannelResponse;
23 import android.telephony.NeighboringCellInfo;
24 import android.telephony.RadioAccessFamily;
25 import java.util.List;
26 
27 
28 /**
29  * Interface used to interact with the phone.  Mostly this is used by the
30  * TelephonyManager class.  A few places are still using this directly.
31  * Please clean them up if possible and use TelephonyManager instead.
32  *
33  * {@hide}
34  */
35 interface ITelephony {
36 
37     /**
38      * Dial a number. This doesn't place the call. It displays
39      * the Dialer screen.
40      * @param number the number to be dialed. If null, this
41      * would display the Dialer screen with no number pre-filled.
42      */
dial(String number)43     void dial(String number);
44 
45     /**
46      * Place a call to the specified number.
47      * @param number the number to be called.
48      */
call(String callingPackage, String number)49     void call(String callingPackage, String number);
50 
51     /**
52      * End call if there is a call in progress, otherwise does nothing.
53      *
54      * @return whether it hung up
55      */
endCall()56     boolean endCall();
57 
58     /**
59      * End call on particular subId or go to the Home screen
60      * @param subId user preferred subId.
61      * @return whether it hung up
62      */
endCallForSubscriber(int subId)63     boolean endCallForSubscriber(int subId);
64 
65     /**
66      * Answer the currently-ringing call.
67      *
68      * If there's already a current active call, that call will be
69      * automatically put on hold.  If both lines are currently in use, the
70      * current active call will be ended.
71      *
72      * TODO: provide a flag to let the caller specify what policy to use
73      * if both lines are in use.  (The current behavior is hardwired to
74      * "answer incoming, end ongoing", which is how the CALL button
75      * is specced to behave.)
76      *
77      * TODO: this should be a oneway call (especially since it's called
78      * directly from the key queue thread).
79      */
answerRingingCall()80     void answerRingingCall();
81 
82     /**
83      * Answer the currently-ringing call on particular subId .
84      *
85      * If there's already a current active call, that call will be
86      * automatically put on hold.  If both lines are currently in use, the
87      * current active call will be ended.
88      *
89      * TODO: provide a flag to let the caller specify what policy to use
90      * if both lines are in use.  (The current behavior is hardwired to
91      * "answer incoming, end ongoing", which is how the CALL button
92      * is specced to behave.)
93      *
94      * TODO: this should be a oneway call (especially since it's called
95      * directly from the key queue thread).
96      */
answerRingingCallForSubscriber(int subId)97     void answerRingingCallForSubscriber(int subId);
98 
99     /**
100      * Silence the ringer if an incoming call is currently ringing.
101      * (If vibrating, stop the vibrator also.)
102      *
103      * It's safe to call this if the ringer has already been silenced, or
104      * even if there's no incoming call.  (If so, this method will do nothing.)
105      *
106      * TODO: this should be a oneway call too (see above).
107      *       (Actually *all* the methods here that return void can
108      *       probably be oneway.)
109      */
silenceRinger()110     void silenceRinger();
111 
112     /**
113      * Check if we are in either an active or holding call
114      * @return true if the phone state is OFFHOOK.
115      */
isOffhook()116     boolean isOffhook();
117 
118     /**
119      * Check if a particular subId has an active or holding call
120      *
121      * @param subId user preferred subId.
122      * @return true if the phone state is OFFHOOK.
123      */
isOffhookForSubscriber(int subId)124     boolean isOffhookForSubscriber(int subId);
125 
126     /**
127      * Check if an incoming phone call is ringing or call waiting
128      * on a particular subId.
129      *
130      * @param subId user preferred subId.
131      * @return true if the phone state is RINGING.
132      */
isRingingForSubscriber(int subId)133     boolean isRingingForSubscriber(int subId);
134 
135     /**
136      * Check if an incoming phone call is ringing or call waiting.
137      * @return true if the phone state is RINGING.
138      */
isRinging()139     boolean isRinging();
140 
141     /**
142      * Check if the phone is idle.
143      * @return true if the phone state is IDLE.
144      */
isIdle()145     boolean isIdle();
146 
147     /**
148      * Check if the phone is idle on a particular subId.
149      *
150      * @param subId user preferred subId.
151      * @return true if the phone state is IDLE.
152      */
isIdleForSubscriber(int subId)153     boolean isIdleForSubscriber(int subId);
154 
155     /**
156      * Check to see if the radio is on or not.
157      * @return returns true if the radio is on.
158      */
isRadioOn()159     boolean isRadioOn();
160 
161     /**
162      * Check to see if the radio is on or not on particular subId.
163      * @param subId user preferred subId.
164      * @return returns true if the radio is on.
165      */
isRadioOnForSubscriber(int subId)166     boolean isRadioOnForSubscriber(int subId);
167 
168     /**
169      * Check if the SIM pin lock is enabled.
170      * @return true if the SIM pin lock is enabled.
171      */
isSimPinEnabled()172     boolean isSimPinEnabled();
173 
174     /**
175      * Supply a pin to unlock the SIM.  Blocks until a result is determined.
176      * @param pin The pin to check.
177      * @return whether the operation was a success.
178      */
supplyPin(String pin)179     boolean supplyPin(String pin);
180 
181     /**
182      * Supply a pin to unlock the SIM for particular subId.
183      * Blocks until a result is determined.
184      * @param pin The pin to check.
185      * @param subId user preferred subId.
186      * @return whether the operation was a success.
187      */
supplyPinForSubscriber(int subId, String pin)188     boolean supplyPinForSubscriber(int subId, String pin);
189 
190     /**
191      * Supply puk to unlock the SIM and set SIM pin to new pin.
192      *  Blocks until a result is determined.
193      * @param puk The puk to check.
194      *        pin The new pin to be set in SIM
195      * @return whether the operation was a success.
196      */
supplyPuk(String puk, String pin)197     boolean supplyPuk(String puk, String pin);
198 
199     /**
200      * Supply puk to unlock the SIM and set SIM pin to new pin.
201      *  Blocks until a result is determined.
202      * @param puk The puk to check.
203      *        pin The new pin to be set in SIM
204      * @param subId user preferred subId.
205      * @return whether the operation was a success.
206      */
supplyPukForSubscriber(int subId, String puk, String pin)207     boolean supplyPukForSubscriber(int subId, String puk, String pin);
208 
209     /**
210      * Supply a pin to unlock the SIM.  Blocks until a result is determined.
211      * Returns a specific success/error code.
212      * @param pin The pin to check.
213      * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
214      *         retValue[1] = number of attempts remaining if known otherwise -1
215      */
supplyPinReportResult(String pin)216     int[] supplyPinReportResult(String pin);
217 
218     /**
219      * Supply a pin to unlock the SIM.  Blocks until a result is determined.
220      * Returns a specific success/error code.
221      * @param pin The pin to check.
222      * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
223      *         retValue[1] = number of attempts remaining if known otherwise -1
224      */
supplyPinReportResultForSubscriber(int subId, String pin)225     int[] supplyPinReportResultForSubscriber(int subId, String pin);
226 
227     /**
228      * Supply puk to unlock the SIM and set SIM pin to new pin.
229      * Blocks until a result is determined.
230      * Returns a specific success/error code
231      * @param puk The puk to check
232      *        pin The pin to check.
233      * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
234      *         retValue[1] = number of attempts remaining if known otherwise -1
235      */
supplyPukReportResult(String puk, String pin)236     int[] supplyPukReportResult(String puk, String pin);
237 
238     /**
239      * Supply puk to unlock the SIM and set SIM pin to new pin.
240      * Blocks until a result is determined.
241      * Returns a specific success/error code
242      * @param puk The puk to check
243      *        pin The pin to check.
244      * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
245      *         retValue[1] = number of attempts remaining if known otherwise -1
246      */
supplyPukReportResultForSubscriber(int subId, String puk, String pin)247     int[] supplyPukReportResultForSubscriber(int subId, String puk, String pin);
248 
249     /**
250      * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
251      * without SEND (so <code>dial</code> is not appropriate).
252      *
253      * @param dialString the MMI command to be executed.
254      * @return true if MMI command is executed.
255      */
handlePinMmi(String dialString)256     boolean handlePinMmi(String dialString);
257 
258     /**
259      * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
260      * without SEND (so <code>dial</code> is not appropriate) for
261      * a particular subId.
262      * @param dialString the MMI command to be executed.
263      * @param subId user preferred subId.
264      * @return true if MMI command is executed.
265      */
handlePinMmiForSubscriber(int subId, String dialString)266     boolean handlePinMmiForSubscriber(int subId, String dialString);
267 
268     /**
269      * Toggles the radio on or off.
270      */
toggleRadioOnOff()271     void toggleRadioOnOff();
272 
273     /**
274      * Toggles the radio on or off on particular subId.
275      * @param subId user preferred subId.
276      */
toggleRadioOnOffForSubscriber(int subId)277     void toggleRadioOnOffForSubscriber(int subId);
278 
279     /**
280      * Set the radio to on or off
281      */
setRadio(boolean turnOn)282     boolean setRadio(boolean turnOn);
283 
284     /**
285      * Set the radio to on or off on particular subId.
286      * @param subId user preferred subId.
287      */
setRadioForSubscriber(int subId, boolean turnOn)288     boolean setRadioForSubscriber(int subId, boolean turnOn);
289 
290     /**
291      * Set the radio to on or off unconditionally
292      */
setRadioPower(boolean turnOn)293     boolean setRadioPower(boolean turnOn);
294 
295     /**
296      * Request to update location information in service state
297      */
updateServiceLocation()298     void updateServiceLocation();
299 
300     /**
301      * Request to update location information for a subscrition in service state
302      * @param subId user preferred subId.
303      */
updateServiceLocationForSubscriber(int subId)304     void updateServiceLocationForSubscriber(int subId);
305 
306     /**
307      * Enable location update notifications.
308      */
enableLocationUpdates()309     void enableLocationUpdates();
310 
311     /**
312      * Enable location update notifications.
313      * @param subId user preferred subId.
314      */
enableLocationUpdatesForSubscriber(int subId)315     void enableLocationUpdatesForSubscriber(int subId);
316 
317     /**
318      * Disable location update notifications.
319      */
disableLocationUpdates()320     void disableLocationUpdates();
321 
322     /**
323      * Disable location update notifications.
324      * @param subId user preferred subId.
325      */
disableLocationUpdatesForSubscriber(int subId)326     void disableLocationUpdatesForSubscriber(int subId);
327 
328     /**
329      * Allow mobile data connections.
330      */
enableDataConnectivity()331     boolean enableDataConnectivity();
332 
333     /**
334      * Disallow mobile data connections.
335      */
disableDataConnectivity()336     boolean disableDataConnectivity();
337 
338     /**
339      * Report whether data connectivity is possible.
340      */
isDataConnectivityPossible()341     boolean isDataConnectivityPossible();
342 
getCellLocation()343     Bundle getCellLocation();
344 
345     /**
346      * Returns the neighboring cell information of the device.
347      */
getNeighboringCellInfo(String callingPkg)348     List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
349 
getCallState()350      int getCallState();
351 
352     /**
353      * Returns the call state for a subId.
354      */
getCallStateForSubscriber(int subId)355      int getCallStateForSubscriber(int subId);
356 
getDataActivity()357      int getDataActivity();
getDataState()358      int getDataState();
359 
360     /**
361      * Returns the current active phone type as integer.
362      * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
363      * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
364      */
getActivePhoneType()365     int getActivePhoneType();
366 
367     /**
368      * Returns the current active phone type as integer for particular subId.
369      * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
370      * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
371      * @param subId user preferred subId.
372      */
getActivePhoneTypeForSubscriber(int subId)373     int getActivePhoneTypeForSubscriber(int subId);
374 
375     /**
376      * Returns the CDMA ERI icon index to display
377      */
getCdmaEriIconIndex()378     int getCdmaEriIconIndex();
379 
380     /**
381      * Returns the CDMA ERI icon index to display on particular subId.
382      * @param subId user preferred subId.
383      */
getCdmaEriIconIndexForSubscriber(int subId)384     int getCdmaEriIconIndexForSubscriber(int subId);
385 
386     /**
387      * Returns the CDMA ERI icon mode,
388      * 0 - ON
389      * 1 - FLASHING
390      */
getCdmaEriIconMode()391     int getCdmaEriIconMode();
392 
393     /**
394      * Returns the CDMA ERI icon mode on particular subId,
395      * 0 - ON
396      * 1 - FLASHING
397      * @param subId user preferred subId.
398      */
getCdmaEriIconModeForSubscriber(int subId)399     int getCdmaEriIconModeForSubscriber(int subId);
400 
401     /**
402      * Returns the CDMA ERI text,
403      */
getCdmaEriText()404     String getCdmaEriText();
405 
406     /**
407      * Returns the CDMA ERI text for particular subId,
408      * @param subId user preferred subId.
409      */
getCdmaEriTextForSubscriber(int subId)410     String getCdmaEriTextForSubscriber(int subId);
411 
412     /**
413      * Returns true if OTA service provisioning needs to run.
414      * Only relevant on some technologies, others will always
415      * return false.
416      */
needsOtaServiceProvisioning()417     boolean needsOtaServiceProvisioning();
418 
419     /**
420      * Sets the voicemail number for a particular subscriber.
421      */
setVoiceMailNumber(int subId, String alphaTag, String number)422     boolean setVoiceMailNumber(int subId, String alphaTag, String number);
423 
424     /**
425       * Returns the unread count of voicemails
426       */
getVoiceMessageCount()427     int getVoiceMessageCount();
428 
429     /**
430      * Returns the unread count of voicemails for a subId.
431      * @param subId user preferred subId.
432      * Returns the unread count of voicemails
433      */
getVoiceMessageCountForSubscriber(int subId)434     int getVoiceMessageCountForSubscriber(int subId);
435 
436     /**
437       * Returns the network type for data transmission
438       */
getNetworkType()439     int getNetworkType();
440 
441     /**
442      * Returns the network type of a subId.
443      * @param subId user preferred subId.
444      * Returns the network type
445      */
getNetworkTypeForSubscriber(int subId)446     int getNetworkTypeForSubscriber(int subId);
447 
448     /**
449       * Returns the network type for data transmission
450       */
getDataNetworkType()451     int getDataNetworkType();
452 
453     /**
454       * Returns the data network type of a subId
455       * @param subId user preferred subId.
456       * Returns the network type
457       */
getDataNetworkTypeForSubscriber(int subId)458     int getDataNetworkTypeForSubscriber(int subId);
459 
460     /**
461       * Returns the network type for voice
462       */
getVoiceNetworkType()463     int getVoiceNetworkType();
464 
465     /**
466       * Returns the voice network type of a subId
467       * @param subId user preferred subId.
468       * Returns the network type
469       */
getVoiceNetworkTypeForSubscriber(int subId)470     int getVoiceNetworkTypeForSubscriber(int subId);
471 
472     /**
473      * Return true if an ICC card is present
474      */
hasIccCard()475     boolean hasIccCard();
476 
477     /**
478      * Return true if an ICC card is present for a subId.
479      * @param slotId user preferred slotId.
480      * Return true if an ICC card is present
481      */
hasIccCardUsingSlotId(int slotId)482     boolean hasIccCardUsingSlotId(int slotId);
483 
484     /**
485      * Return if the current radio is LTE on CDMA. This
486      * is a tri-state return value as for a period of time
487      * the mode may be unknown.
488      *
489      * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
490      * or {@link PHone#LTE_ON_CDMA_TRUE}
491      */
getLteOnCdmaMode()492     int getLteOnCdmaMode();
493 
494     /**
495      * Return if the current radio is LTE on CDMA. This
496      * is a tri-state return value as for a period of time
497      * the mode may be unknown.
498      *
499      * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
500      * or {@link PHone#LTE_ON_CDMA_TRUE}
501      */
getLteOnCdmaModeForSubscriber(int subId)502     int getLteOnCdmaModeForSubscriber(int subId);
503 
504     /**
505      * Returns the all observed cell information of the device.
506      */
getAllCellInfo()507     List<CellInfo> getAllCellInfo();
508 
509     /**
510      * Sets minimum time in milli-seconds between onCellInfoChanged
511      */
setCellInfoListRate(int rateInMillis)512     void setCellInfoListRate(int rateInMillis);
513 
514     /**
515      * get default sim
516      * @return sim id
517      */
getDefaultSim()518     int getDefaultSim();
519 
520     /**
521      * Opens a logical channel to the ICC card.
522      *
523      * Input parameters equivalent to TS 27.007 AT+CCHO command.
524      *
525      * @param AID Application id. See ETSI 102.221 and 101.220.
526      * @return an IccOpenLogicalChannelResponse object.
527      */
iccOpenLogicalChannel(String AID)528     IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID);
529 
530     /**
531      * Closes a previously opened logical channel to the ICC card.
532      *
533      * Input parameters equivalent to TS 27.007 AT+CCHC command.
534      *
535      * @param channel is the channel id to be closed as retruned by a
536      *            successful iccOpenLogicalChannel.
537      * @return true if the channel was closed successfully.
538      */
iccCloseLogicalChannel(int channel)539     boolean iccCloseLogicalChannel(int channel);
540 
541     /**
542      * Transmit an APDU to the ICC card over a logical channel.
543      *
544      * Input parameters equivalent to TS 27.007 AT+CGLA command.
545      *
546      * @param channel is the channel id to be closed as retruned by a
547      *            successful iccOpenLogicalChannel.
548      * @param cla Class of the APDU command.
549      * @param instruction Instruction of the APDU command.
550      * @param p1 P1 value of the APDU command.
551      * @param p2 P2 value of the APDU command.
552      * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
553      *            is sent to the SIM.
554      * @param data Data to be sent with the APDU.
555      * @return The APDU response from the ICC card with the status appended at
556      *            the end.
557      */
iccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2, int p3, String data)558     String iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
559             int p1, int p2, int p3, String data);
560 
561     /**
562      * Transmit an APDU to the ICC card over the basic channel.
563      *
564      * Input parameters equivalent to TS 27.007 AT+CSIM command.
565      *
566      * @param cla Class of the APDU command.
567      * @param instruction Instruction of the APDU command.
568      * @param p1 P1 value of the APDU command.
569      * @param p2 P2 value of the APDU command.
570      * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
571      *            is sent to the SIM.
572      * @param data Data to be sent with the APDU.
573      * @return The APDU response from the ICC card with the status appended at
574      *            the end.
575      */
iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2, int p3, String data)576     String iccTransmitApduBasicChannel(int cla, int instruction,
577             int p1, int p2, int p3, String data);
578 
579     /**
580      * Returns the response APDU for a command APDU sent through SIM_IO.
581      *
582      * @param fileID
583      * @param command
584      * @param p1 P1 value of the APDU command.
585      * @param p2 P2 value of the APDU command.
586      * @param p3 P3 value of the APDU command.
587      * @param filePath
588      * @return The APDU response.
589      */
iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3, String filePath)590     byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3,
591             String filePath);
592 
593     /**
594      * Send ENVELOPE to the SIM and returns the response.
595      *
596      * @param contents  String containing SAT/USAT response in hexadecimal
597      *                  format starting with command tag. See TS 102 223 for
598      *                  details.
599      * @return The APDU response from the ICC card, with the last 4 bytes
600      *         being the status word. If the command fails, returns an empty
601      *         string.
602      */
sendEnvelopeWithStatus(String content)603     String sendEnvelopeWithStatus(String content);
604 
605     /**
606      * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
607      * Used for device configuration by some CDMA operators.
608      *
609      * @param itemID the ID of the item to read.
610      * @return the NV item as a String, or null on any failure.
611      */
nvReadItem(int itemID)612     String nvReadItem(int itemID);
613 
614     /**
615      * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
616      * Used for device configuration by some CDMA operators.
617      *
618      * @param itemID the ID of the item to read.
619      * @param itemValue the value to write, as a String.
620      * @return true on success; false on any failure.
621      */
nvWriteItem(int itemID, String itemValue)622     boolean nvWriteItem(int itemID, String itemValue);
623 
624     /**
625      * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
626      * Used for device configuration by some CDMA operators.
627      *
628      * @param preferredRoamingList byte array containing the new PRL.
629      * @return true on success; false on any failure.
630      */
nvWriteCdmaPrl(in byte[] preferredRoamingList)631     boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
632 
633     /**
634      * Perform the specified type of NV config reset. The radio will be taken offline
635      * and the device must be rebooted after the operation. Used for device
636      * configuration by some CDMA operators.
637      *
638      * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
639      * @return true on success; false on any failure.
640      */
nvResetConfig(int resetType)641     boolean nvResetConfig(int resetType);
642 
643     /*
644      * Get the calculated preferred network type.
645      * Used for device configuration by some CDMA operators.
646      *
647      * @return the calculated preferred network type, defined in RILConstants.java.
648      */
getCalculatedPreferredNetworkType()649     int getCalculatedPreferredNetworkType();
650 
651     /*
652      * Get the preferred network type.
653      * Used for device configuration by some CDMA operators.
654      *
655      * @return the preferred network type, defined in RILConstants.java.
656      */
getPreferredNetworkType()657     int getPreferredNetworkType();
658 
659     /**
660      * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
661      * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
662      * tethering.
663      *
664      * @return 0: Not required. 1: required. 2: Not set.
665      */
getTetherApnRequired()666     int getTetherApnRequired();
667 
668     /**
669      * Set the preferred network type.
670      * Used for device configuration by some CDMA operators.
671      *
672      * @param networkType the preferred network type, defined in RILConstants.java.
673      * @return true on success; false on any failure.
674      */
setPreferredNetworkType(int networkType)675     boolean setPreferredNetworkType(int networkType);
676 
677     /**
678      * User enable/disable Mobile Data.
679      *
680      * @param enable true to turn on, else false
681      */
setDataEnabled(int subId, boolean enable)682     void setDataEnabled(int subId, boolean enable);
683 
684     /**
685      * Get the user enabled state of Mobile Data.
686      *
687      * @return true on enabled
688      */
getDataEnabled(int subId)689     boolean getDataEnabled(int subId);
690 
691     /**
692      * Get P-CSCF address from PCO after data connection is established or modified.
693      * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN
694      */
getPcscfAddress(String apnType)695     String[] getPcscfAddress(String apnType);
696 
697     /**
698      * Set IMS registration state
699      */
setImsRegistrationState(boolean registered)700     void setImsRegistrationState(boolean registered);
701 
702     /**
703      * Return MDN string for CDMA phone.
704      * @param subId user preferred subId.
705      */
getCdmaMdn(int subId)706     String getCdmaMdn(int subId);
707 
708     /**
709      * Return MIN string for CDMA phone.
710      * @param subId user preferred subId.
711      */
getCdmaMin(int subId)712     String getCdmaMin(int subId);
713 
714     /**
715      * Has the calling application been granted special privileges by the carrier.
716      *
717      * If any of the packages in the calling UID has carrier privileges, the
718      * call will return true. This access is granted by the owner of the UICC
719      * card and does not depend on the registered carrier.
720      *
721      * TODO: Add a link to documentation.
722      *
723      * @return carrier privilege status defined in TelephonyManager.
724      */
getCarrierPrivilegeStatus()725     int getCarrierPrivilegeStatus();
726 
727     /**
728      * Similar to above, but check for pkg whose name is pkgname.
729      */
checkCarrierPrivilegesForPackage(String pkgname)730     int checkCarrierPrivilegesForPackage(String pkgname);
731 
732     /**
733      * Returns the package name of the carrier apps that should handle the input intent.
734      *
735      * @param packageManager PackageManager for getting receivers.
736      * @param intent Intent that will be sent.
737      * @return list of carrier app package names that can handle the intent.
738      *         Returns null if there is an error and an empty list if there
739      *         are no matching packages.
740      */
getCarrierPackageNamesForIntent(in Intent intent)741     List<String> getCarrierPackageNamesForIntent(in Intent intent);
742 
743     /**
744      * Set the line 1 phone number string and its alphatag for the current ICCID
745      * for display purpose only, for example, displayed in Phone Status. It won't
746      * change the actual MSISDN/MDN. To unset alphatag or number, pass in a null
747      * value.
748      *
749      * @param subId the subscriber that the alphatag and dialing number belongs to.
750      * @param alphaTag alpha-tagging of the dailing nubmer
751      * @param number The dialing number
752      * @return true if the operation was executed correctly.
753      */
setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number)754     boolean setLine1NumberForDisplayForSubscriber(int subId, String alphaTag, String number);
755 
756     /**
757      * Returns the displayed dialing number string if it was set previously via
758      * {@link #setLine1NumberForDisplay}. Otherwise returns null.
759      *
760      * @param subId whose dialing number for line 1 is returned.
761      * @return the displayed dialing number if set, or null if not set.
762      */
getLine1NumberForDisplay(int subId)763     String getLine1NumberForDisplay(int subId);
764 
765     /**
766      * Returns the displayed alphatag of the dialing number if it was set
767      * previously via {@link #setLine1NumberForDisplay}. Otherwise returns null.
768      *
769      * @param subId whose alphatag associated with line 1 is returned.
770      * @return the displayed alphatag of the dialing number if set, or null if
771      *         not set.
772      */
getLine1AlphaTagForDisplay(int subId)773     String getLine1AlphaTagForDisplay(int subId);
774 
getMergedSubscriberIds()775     String[] getMergedSubscriberIds();
776 
777     /**
778      * Override the operator branding for the current ICCID.
779      *
780      * Once set, whenever the SIM is present in the device, the service
781      * provider name (SPN) and the operator name will both be replaced by the
782      * brand value input. To unset the value, the same function should be
783      * called with a null brand value.
784      *
785      * <p>Requires Permission:
786      *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
787      *  or has to be carrier app - see #hasCarrierPrivileges.
788      *
789      * @param brand The brand name to display/set.
790      * @return true if the operation was executed correctly.
791      */
setOperatorBrandOverride(String brand)792     boolean setOperatorBrandOverride(String brand);
793 
794     /**
795      * Override the roaming indicator for the current ICCID.
796      *
797      * Using this call, the carrier app (see #hasCarrierPrivileges) can override
798      * the platform's notion of a network operator being considered roaming or not.
799      * The change only affects the ICCID that was active when this call was made.
800      *
801      * If null is passed as any of the input, the corresponding value is deleted.
802      *
803      * <p>Requires that the caller have carrier privilege. See #hasCarrierPrivileges.
804      *
805      * @param gsmRoamingList - List of MCCMNCs to be considered roaming for 3GPP RATs.
806      * @param gsmNonRoamingList - List of MCCMNCs to be considered not roaming for 3GPP RATs.
807      * @param cdmaRoamingList - List of SIDs to be considered roaming for 3GPP2 RATs.
808      * @param cdmaNonRoamingList - List of SIDs to be considered not roaming for 3GPP2 RATs.
809      * @return true if the operation was executed correctly.
810      */
setRoamingOverride(in List<String> gsmRoamingList, in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList, in List<String> cdmaNonRoamingList)811     boolean setRoamingOverride(in List<String> gsmRoamingList,
812             in List<String> gsmNonRoamingList, in List<String> cdmaRoamingList,
813             in List<String> cdmaNonRoamingList);
814 
815     /**
816      * Returns the result and response from RIL for oem request
817      *
818      * @param oemReq the data is sent to ril.
819      * @param oemResp the respose data from RIL.
820      * @return negative value request was not handled or get error
821      *         0 request was handled succesfully, but no response data
822      *         positive value success, data length of response
823      */
invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp)824     int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
825 
826     /**
827      * Check if any mobile Radios need to be shutdown.
828      *
829      * @return true is any mobile radio needs to be shutdown
830      */
needMobileRadioShutdown()831     boolean needMobileRadioShutdown();
832 
833     /**
834      * Shutdown Mobile Radios
835      */
shutdownMobileRadios()836     void shutdownMobileRadios();
837 
838     /**
839      * Set phone radio type and access technology.
840      *
841      * @param rafs an RadioAccessFamily array to indicate all phone's
842      *        new radio access family. The length of RadioAccessFamily
843      *        must equ]]al to phone count.
844      */
setRadioCapability(in RadioAccessFamily[] rafs)845     void setRadioCapability(in RadioAccessFamily[] rafs);
846 
847     /**
848      * Get phone radio type and access technology.
849      *
850      * @param phoneId which phone you want to get
851      * @return phone radio type and access technology
852      */
getRadioAccessFamily(in int phoneId)853     int getRadioAccessFamily(in int phoneId);
854 
855     /**
856      * Enables or disables video calling.
857      *
858      * @param enable Whether to enable video calling.
859      */
enableVideoCalling(boolean enable)860     void enableVideoCalling(boolean enable);
861 
862     /**
863      * Whether video calling has been enabled by the user.
864      *
865      * @return {@code True} if the user has enabled video calling, {@code false} otherwise.
866      */
isVideoCallingEnabled()867     boolean isVideoCallingEnabled();
868 
869     /**
870      * Get IMS Registration Status
871      */
isImsRegistered()872     boolean isImsRegistered();
873 
874     /**
875       * Returns the unique device ID of phone, for example, the IMEI for
876       * GSM and the MEID for CDMA phones. Return null if device ID is not available.
877       *
878       * <p>Requires Permission:
879       *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
880       */
getDeviceId()881     String getDeviceId();
882 }
883