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