ITelephony.aidl revision 47eecf03307acfb1bc7d4ad51311beb4eeb99366
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.ComponentName;
20import android.os.Bundle;
21import android.telephony.CellInfo;
22import android.telephony.NeighboringCellInfo;
23
24import java.util.List;
25
26import java.util.List;
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 insteadl.
32 *
33 * {@hide}
34 */
35interface 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     */
43    void dial(String number);
44
45    /**
46     * Place a call to the specified number.
47     * @param number the number to be called.
48     */
49    void call(String callingPackage, String number);
50
51    /**
52     * If there is currently a call in progress, show the call screen.
53     * The DTMF dialpad may or may not be visible initially, depending on
54     * whether it was up when the user last exited the InCallScreen.
55     *
56     * @return true if the call screen was shown.
57     */
58    boolean showCallScreen();
59
60    /**
61     * Variation of showCallScreen() that also specifies whether the
62     * DTMF dialpad should be initially visible when the InCallScreen
63     * comes up.
64     *
65     * @param showDialpad if true, make the dialpad visible initially,
66     *                    otherwise hide the dialpad initially.
67     * @return true if the call screen was shown.
68     *
69     * @see showCallScreen
70     */
71    boolean showCallScreenWithDialpad(boolean showDialpad);
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     * Answer the currently-ringing call.
82     *
83     * If there's already a current active call, that call will be
84     * automatically put on hold.  If both lines are currently in use, the
85     * current active call will be ended.
86     *
87     * TODO: provide a flag to let the caller specify what policy to use
88     * if both lines are in use.  (The current behavior is hardwired to
89     * "answer incoming, end ongoing", which is how the CALL button
90     * is specced to behave.)
91     *
92     * TODO: this should be a oneway call (especially since it's called
93     * directly from the key queue thread).
94     */
95    void answerRingingCall();
96
97    /**
98     * Silence the ringer if an incoming call is currently ringing.
99     * (If vibrating, stop the vibrator also.)
100     *
101     * It's safe to call this if the ringer has already been silenced, or
102     * even if there's no incoming call.  (If so, this method will do nothing.)
103     *
104     * TODO: this should be a oneway call too (see above).
105     *       (Actually *all* the methods here that return void can
106     *       probably be oneway.)
107     */
108    void silenceRinger();
109
110    /**
111     * Check if we are in either an active or holding call
112     * @return true if the phone state is OFFHOOK.
113     */
114    boolean isOffhook();
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 to see if the radio is on or not.
130     * @return returns true if the radio is on.
131     */
132    boolean isRadioOn();
133
134    /**
135     * Check if the SIM pin lock is enabled.
136     * @return true if the SIM pin lock is enabled.
137     */
138    boolean isSimPinEnabled();
139
140    /**
141     * Cancels the missed calls notification.
142     */
143    void cancelMissedCallsNotification();
144
145    /**
146     * Supply a pin to unlock the SIM.  Blocks until a result is determined.
147     * @param pin The pin to check.
148     * @return whether the operation was a success.
149     */
150    boolean supplyPin(String pin);
151
152    /**
153     * Supply puk to unlock the SIM and set SIM pin to new pin.
154     *  Blocks until a result is determined.
155     * @param puk The puk to check.
156     *        pin The new pin to be set in SIM
157     * @return whether the operation was a success.
158     */
159    boolean supplyPuk(String puk, String pin);
160
161    /**
162     * Supply a pin to unlock the SIM.  Blocks until a result is determined.
163     * Returns a specific success/error code.
164     * @param pin The pin to check.
165     * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
166     *         retValue[1] = number of attempts remaining if known otherwise -1
167     */
168    int[] supplyPinReportResult(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     * Returns a specific success/error code
174     * @param puk The puk to check
175     *        pin The pin to check.
176     * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
177     *         retValue[1] = number of attempts remaining if known otherwise -1
178     */
179    int[] supplyPukReportResult(String puk, String pin);
180
181    /**
182     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
183     * without SEND (so <code>dial</code> is not appropriate).
184     *
185     * @param dialString the MMI command to be executed.
186     * @return true if MMI command is executed.
187     */
188    boolean handlePinMmi(String dialString);
189
190    /**
191     * Toggles the radio on or off.
192     */
193    void toggleRadioOnOff();
194
195    /**
196     * Set the radio to on or off
197     */
198    boolean setRadio(boolean turnOn);
199
200    /**
201     * Set the radio to on or off unconditionally
202     */
203    boolean setRadioPower(boolean turnOn);
204
205    /**
206     * Request to update location information in service state
207     */
208    void updateServiceLocation();
209
210    /**
211     * Enable location update notifications.
212     */
213    void enableLocationUpdates();
214
215    /**
216     * Disable location update notifications.
217     */
218    void disableLocationUpdates();
219
220    /**
221     * Enable a specific APN type.
222     */
223    int enableApnType(String type);
224
225    /**
226     * Disable a specific APN type.
227     */
228    int disableApnType(String type);
229
230    /**
231     * Allow mobile data connections.
232     */
233    boolean enableDataConnectivity();
234
235    /**
236     * Disallow mobile data connections.
237     */
238    boolean disableDataConnectivity();
239
240    /**
241     * Report whether data connectivity is possible.
242     */
243    boolean isDataConnectivityPossible();
244
245    Bundle getCellLocation();
246
247    /**
248     * Returns the neighboring cell information of the device.
249     */
250    List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
251
252     int getCallState();
253     int getDataActivity();
254     int getDataState();
255
256    /**
257     * Returns the current active phone type as integer.
258     * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
259     * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
260     */
261    int getActivePhoneType();
262
263    /**
264     * Returns the CDMA ERI icon index to display
265     */
266    int getCdmaEriIconIndex();
267
268    /**
269     * Returns the CDMA ERI icon mode,
270     * 0 - ON
271     * 1 - FLASHING
272     */
273    int getCdmaEriIconMode();
274
275    /**
276     * Returns the CDMA ERI text,
277     */
278    String getCdmaEriText();
279
280    /**
281     * Returns true if OTA service provisioning needs to run.
282     * Only relevant on some technologies, others will always
283     * return false.
284     */
285    boolean needsOtaServiceProvisioning();
286
287    /**
288      * Returns the unread count of voicemails
289      */
290    int getVoiceMessageCount();
291
292    /**
293      * Returns the network type for data transmission
294      */
295    int getNetworkType();
296
297    /**
298      * Returns the network type for data transmission
299      */
300    int getDataNetworkType();
301
302    /**
303      * Returns the network type for voice
304      */
305    int getVoiceNetworkType();
306
307    /**
308     * Return true if an ICC card is present
309     */
310    boolean hasIccCard();
311
312    /**
313     * Return if the current radio is LTE on CDMA. This
314     * is a tri-state return value as for a period of time
315     * the mode may be unknown.
316     *
317     * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
318     * or {@link PHone#LTE_ON_CDMA_TRUE}
319     */
320    int getLteOnCdmaMode();
321
322    /**
323     * Returns the all observed cell information of the device.
324     */
325    List<CellInfo> getAllCellInfo();
326
327    /**
328     * Sets minimum time in milli-seconds between onCellInfoChanged
329     */
330    void setCellInfoListRate(int rateInMillis);
331
332    /**
333     * Opens a logical channel to the ICC card.
334     *
335     * Input parameters equivalent to TS 27.007 AT+CCHO command.
336     *
337     * @param AID Application id. See ETSI 102.221 and 101.220.
338     * @return The logical channel id which is set to -1 on error.
339     */
340    int iccOpenLogicalChannel(String AID);
341
342    /**
343     * Closes a previously opened logical channel to the ICC card.
344     *
345     * Input parameters equivalent to TS 27.007 AT+CCHC command.
346     *
347     * @param channel is the channel id to be closed as retruned by a
348     *            successful iccOpenLogicalChannel.
349     * @return true if the channel was closed successfully.
350     */
351    boolean iccCloseLogicalChannel(int channel);
352
353    /**
354     * Transmit an APDU to the ICC card over a logical channel.
355     *
356     * Input parameters equivalent to TS 27.007 AT+CGLA command.
357     *
358     * @param channel is the channel id to be closed as retruned by a
359     *            successful iccOpenLogicalChannel.
360     * @param cla Class of the APDU command.
361     * @param instruction Instruction of the APDU command.
362     * @param p1 P1 value of the APDU command.
363     * @param p2 P2 value of the APDU command.
364     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
365     *            is sent to the SIM.
366     * @param data Data to be sent with the APDU.
367     * @return The APDU response from the ICC card with the status appended at
368     *            the end. If an error occurs, an empty string is returned.
369     */
370    String iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
371            int p1, int p2, int p3, String data);
372
373    /**
374     * Send ENVELOPE to the SIM and returns the response.
375     *
376     * @param contents  String containing SAT/USAT response in hexadecimal
377     *                  format starting with command tag. See TS 102 223 for
378     *                  details.
379     * @return The APDU response from the ICC card, with the last 4 bytes
380     *         being the status word. If the command fails, returns an empty
381     *         string.
382     */
383    String sendEnvelopeWithStatus(String content);
384
385    /**
386     * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
387     * Used for device configuration by some CDMA operators.
388     *
389     * @param itemID the ID of the item to read.
390     * @return the NV item as a String, or null on any failure.
391     */
392    String nvReadItem(int itemID);
393
394    /**
395     * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
396     * Used for device configuration by some CDMA operators.
397     *
398     * @param itemID the ID of the item to read.
399     * @param itemValue the value to write, as a String.
400     * @return true on success; false on any failure.
401     */
402    boolean nvWriteItem(int itemID, String itemValue);
403
404    /**
405     * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
406     * Used for device configuration by some CDMA operators.
407     *
408     * @param preferredRoamingList byte array containing the new PRL.
409     * @return true on success; false on any failure.
410     */
411    boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
412
413    /**
414     * Perform the specified type of NV config reset. The radio will be taken offline
415     * and the device must be rebooted after the operation. Used for device
416     * configuration by some CDMA operators.
417     *
418     * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
419     * @return true on success; false on any failure.
420     */
421    boolean nvResetConfig(int resetType);
422
423    /*
424     * Get the preferred network type.
425     * Used for device configuration by some CDMA operators.
426     *
427     * @return the preferred network type, defined in RILConstants.java.
428     */
429    int getPreferredNetworkType();
430
431    /**
432     * Set the preferred network type.
433     * Used for device configuration by some CDMA operators.
434     *
435     * @param networkType the preferred network type, defined in RILConstants.java.
436     * @return true on success; false on any failure.
437     */
438    boolean setPreferredNetworkType(int networkType);
439
440    /**
441     * User enable/disable Mobile Data.
442     *
443     * @param enable true to turn on, else false
444     */
445    void setDataEnabled(boolean enable);
446
447    /**
448     * Get the user enabled state of Mobile Data.
449     *
450     * @return true on enabled
451     */
452    boolean getDataEnabled();
453}
454