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