ITelephony.aidl revision 210889e91cb2da74e0323292ca156d17df03fe08
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 com.android.internal.telephony.ITelephonyListener;
25
26import java.util.List;
27
28import java.util.List;
29
30/**
31 * Interface used to interact with the phone.  Mostly this is used by the
32 * TelephonyManager class.  A few places are still using this directly.
33 * Please clean them up if possible and use TelephonyManager insteadl.
34 *
35 * {@hide}
36 */
37interface ITelephony {
38
39    /**
40     * Dial a number. This doesn't place the call. It displays
41     * the Dialer screen.
42     * @param number the number to be dialed. If null, this
43     * would display the Dialer screen with no number pre-filled.
44     */
45    void dial(String number);
46
47    /**
48     * Place a call to the specified number.
49     * @param number the number to be called.
50     */
51    void call(String callingPackage, String number);
52
53    /**
54     * If there is currently a call in progress, show the call screen.
55     * The DTMF dialpad may or may not be visible initially, depending on
56     * whether it was up when the user last exited the InCallScreen.
57     *
58     * @return true if the call screen was shown.
59     */
60    boolean showCallScreen();
61
62    /**
63     * Variation of showCallScreen() that also specifies whether the
64     * DTMF dialpad should be initially visible when the InCallScreen
65     * comes up.
66     *
67     * @param showDialpad if true, make the dialpad visible initially,
68     *                    otherwise hide the dialpad initially.
69     * @return true if the call screen was shown.
70     *
71     * @see showCallScreen
72     */
73    boolean showCallScreenWithDialpad(boolean showDialpad);
74
75    /**
76     * End call if there is a call in progress, otherwise does nothing.
77     *
78     * @return whether it hung up
79     */
80    boolean endCall();
81
82    /**
83     * Answer the currently-ringing call.
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     */
97    void answerRingingCall();
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     */
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     */
116    boolean isOffhook();
117
118    /**
119     * Check if an incoming phone call is ringing or call waiting.
120     * @return true if the phone state is RINGING.
121     */
122    boolean isRinging();
123
124    /**
125     * Check if the phone is idle.
126     * @return true if the phone state is IDLE.
127     */
128    boolean isIdle();
129
130    /**
131     * Check to see if the radio is on or not.
132     * @return returns true if the radio is on.
133     */
134    boolean isRadioOn();
135
136    /**
137     * Check if the SIM pin lock is enabled.
138     * @return true if the SIM pin lock is enabled.
139     */
140    boolean isSimPinEnabled();
141
142    /**
143     * Cancels the missed calls notification.
144     */
145    void cancelMissedCallsNotification();
146
147    /**
148     * Supply a pin to unlock the SIM.  Blocks until a result is determined.
149     * @param pin The pin to check.
150     * @return whether the operation was a success.
151     */
152    boolean supplyPin(String pin);
153
154    /**
155     * Supply puk to unlock the SIM and set SIM pin to new pin.
156     *  Blocks until a result is determined.
157     * @param puk The puk to check.
158     *        pin The new pin to be set in SIM
159     * @return whether the operation was a success.
160     */
161    boolean supplyPuk(String puk, String pin);
162
163    /**
164     * Supply a pin to unlock the SIM.  Blocks until a result is determined.
165     * Returns a specific success/error code.
166     * @param pin The pin to check.
167     * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
168     *         retValue[1] = number of attempts remaining if known otherwise -1
169     */
170    int[] supplyPinReportResult(String pin);
171
172    /**
173     * Supply puk to unlock the SIM and set SIM pin to new pin.
174     * Blocks until a result is determined.
175     * Returns a specific success/error code
176     * @param puk The puk to check
177     *        pin The pin to check.
178     * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code
179     *         retValue[1] = number of attempts remaining if known otherwise -1
180     */
181    int[] supplyPukReportResult(String puk, String pin);
182
183    /**
184     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
185     * without SEND (so <code>dial</code> is not appropriate).
186     *
187     * @param dialString the MMI command to be executed.
188     * @return true if MMI command is executed.
189     */
190    boolean handlePinMmi(String dialString);
191
192    /**
193     * Toggles the radio on or off.
194     */
195    void toggleRadioOnOff();
196
197    /**
198     * Set the radio to on or off
199     */
200    boolean setRadio(boolean turnOn);
201
202    /**
203     * Set the radio to on or off unconditionally
204     */
205    boolean setRadioPower(boolean turnOn);
206
207    /**
208     * Request to update location information in service state
209     */
210    void updateServiceLocation();
211
212    /**
213     * Enable location update notifications.
214     */
215    void enableLocationUpdates();
216
217    /**
218     * Disable location update notifications.
219     */
220    void disableLocationUpdates();
221
222    /**
223     * Enable a specific APN type.
224     */
225    int enableApnType(String type);
226
227    /**
228     * Disable a specific APN type.
229     */
230    int disableApnType(String type);
231
232    /**
233     * Allow mobile data connections.
234     */
235    boolean enableDataConnectivity();
236
237    /**
238     * Disallow mobile data connections.
239     */
240    boolean disableDataConnectivity();
241
242    /**
243     * Report whether data connectivity is possible.
244     */
245    boolean isDataConnectivityPossible();
246
247    Bundle getCellLocation();
248
249    /**
250     * Returns the neighboring cell information of the device.
251     */
252    List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg);
253
254     int getCallState();
255     int getDataActivity();
256     int getDataState();
257
258    /**
259     * Returns the current active phone type as integer.
260     * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE
261     * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE
262     */
263    int getActivePhoneType();
264
265    /**
266     * Returns the CDMA ERI icon index to display
267     */
268    int getCdmaEriIconIndex();
269
270    /**
271     * Returns the CDMA ERI icon mode,
272     * 0 - ON
273     * 1 - FLASHING
274     */
275    int getCdmaEriIconMode();
276
277    /**
278     * Returns the CDMA ERI text,
279     */
280    String getCdmaEriText();
281
282    /**
283     * Returns true if OTA service provisioning needs to run.
284     * Only relevant on some technologies, others will always
285     * return false.
286     */
287    boolean needsOtaServiceProvisioning();
288
289    /**
290      * Returns the unread count of voicemails
291      */
292    int getVoiceMessageCount();
293
294    /**
295      * Returns the network type for data transmission
296      */
297    int getNetworkType();
298
299    /**
300      * Returns the network type for data transmission
301      */
302    int getDataNetworkType();
303
304    /**
305      * Returns the network type for voice
306      */
307    int getVoiceNetworkType();
308
309    /**
310     * Return true if an ICC card is present
311     */
312    boolean hasIccCard();
313
314    /**
315     * Return if the current radio is LTE on CDMA. This
316     * is a tri-state return value as for a period of time
317     * the mode may be unknown.
318     *
319     * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
320     * or {@link PHone#LTE_ON_CDMA_TRUE}
321     */
322    int getLteOnCdmaMode();
323
324    /**
325     * Returns the all observed cell information of the device.
326     */
327    List<CellInfo> getAllCellInfo();
328
329    /**
330     * Sets minimum time in milli-seconds between onCellInfoChanged
331     */
332    void setCellInfoListRate(int rateInMillis);
333
334    /**
335     * Opens a logical channel to the ICC card.
336     *
337     * Input parameters equivalent to TS 27.007 AT+CCHO command.
338     *
339     * @param AID Application id. See ETSI 102.221 and 101.220.
340     * @return The logical channel id which is set to -1 on error.
341     */
342    int iccOpenLogicalChannel(String AID);
343
344    /**
345     * Closes a previously opened logical channel to the ICC card.
346     *
347     * Input parameters equivalent to TS 27.007 AT+CCHC command.
348     *
349     * @param channel is the channel id to be closed as retruned by a
350     *            successful iccOpenLogicalChannel.
351     * @return true if the channel was closed successfully.
352     */
353    boolean iccCloseLogicalChannel(int channel);
354
355    /**
356     * Transmit an APDU to the ICC card over a logical channel.
357     *
358     * Input parameters equivalent to TS 27.007 AT+CGLA command.
359     *
360     * @param channel is the channel id to be closed as retruned by a
361     *            successful iccOpenLogicalChannel.
362     * @param cla Class of the APDU command.
363     * @param instruction Instruction of the APDU command.
364     * @param p1 P1 value of the APDU command.
365     * @param p2 P2 value of the APDU command.
366     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
367     *            is sent to the SIM.
368     * @param data Data to be sent with the APDU.
369     * @return The APDU response from the ICC card with the status appended at
370     *            the end. If an error occurs, an empty string is returned.
371     */
372    String iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
373            int p1, int p2, int p3, String data);
374
375    /**
376     * Send ENVELOPE to the SIM, after processing a proactive command sent by
377     * the SIM.
378     *
379     * @param contents  String containing SAT/USAT response in hexadecimal
380     *                  format starting with command tag. See TS 102 223 for
381     *                  details.
382     * @return The APDU response from the ICC card.
383     */
384    String sendEnvelope(String content);
385
386    /**
387     * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
388     * Used for device configuration by some CDMA operators.
389     *
390     * @param itemID the ID of the item to read.
391     * @return the NV item as a String, or null on any failure.
392     */
393    String nvReadItem(int itemID);
394
395    /**
396     * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
397     * Used for device configuration by some CDMA operators.
398     *
399     * @param itemID the ID of the item to read.
400     * @param itemValue the value to write, as a String.
401     * @return true on success; false on any failure.
402     */
403    boolean nvWriteItem(int itemID, String itemValue);
404
405    /**
406     * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
407     * Used for device configuration by some CDMA operators.
408     *
409     * @param preferredRoamingList byte array containing the new PRL.
410     * @return true on success; false on any failure.
411     */
412    boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
413
414    /**
415     * Perform the specified type of NV config reset. The radio will be taken offline
416     * and the device must be rebooted after the operation. Used for device
417     * configuration by some CDMA operators.
418     *
419     * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
420     * @return true on success; false on any failure.
421     */
422    boolean nvResetConfig(int resetType);
423
424    /*
425     * Get the preferred network type.
426     * Used for device configuration by some CDMA operators.
427     *
428     * @return the preferred network type, defined in RILConstants.java.
429     */
430    int getPreferredNetworkType();
431
432    /**
433     * Set the preferred network type.
434     * Used for device configuration by some CDMA operators.
435     *
436     * @param networkType the preferred network type, defined in RILConstants.java.
437     * @return true on success; false on any failure.
438     */
439    boolean setPreferredNetworkType(int networkType);
440
441    /**
442     * Put a call on hold.
443     */
444     void toggleHold();
445
446     /**
447      * Merge foreground and background calls.
448      */
449     void merge();
450
451     /**
452      * Swap foreground and background calls.
453      */
454     void swap();
455
456     /**
457      * Mute the phone.
458      */
459     void mute(boolean mute);
460
461    /**
462     * Start playing DTMF tone for the specified digit.
463     *
464     * @param digit the digit that corresponds with the desired tone.
465     * @param timedShortcode whether the specified digit should be played as a timed short code.
466     */
467     void playDtmfTone(char digit, boolean timedShortCode);
468
469     /**
470      * Stop playing DTMF tones.
471      */
472     void stopDtmfTone();
473
474     /**
475       * Register a callback.
476       */
477      void addListener(ITelephonyListener listener);
478
479      /**
480       * Unregister a callback.
481       */
482      void removeListener(ITelephonyListener listener);
483}
484