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