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.Context;
20import android.net.LinkProperties;
21import android.net.NetworkCapabilities;
22import android.os.Bundle;
23import android.os.Handler;
24import android.os.Message;
25import android.telephony.CellInfo;
26import android.telephony.CellLocation;
27import android.telephony.CarrierConfigManager;
28import android.telephony.PhoneStateListener;
29import android.telephony.ServiceState;
30import android.telephony.SignalStrength;
31
32import com.android.internal.telephony.imsphone.ImsPhone;
33import com.android.internal.telephony.RadioCapability;
34import com.android.internal.telephony.test.SimulatedRadioControl;
35import com.android.internal.telephony.uicc.IsimRecords;
36import com.android.internal.telephony.uicc.UiccCard;
37import com.android.internal.telephony.uicc.UsimServiceTable;
38
39import com.android.internal.telephony.PhoneConstants.*; // ????
40
41import java.util.List;
42import java.util.Locale;
43
44/**
45 * Internal interface used to control the phone; SDK developers cannot
46 * obtain this interface.
47 *
48 * {@hide}
49 *
50 */
51public interface PhoneInternalInterface {
52
53    /** used to enable additional debug messages */
54    static final boolean DEBUG_PHONE = true;
55
56    public enum DataActivityState {
57        /**
58         * The state of a data activity.
59         * <ul>
60         * <li>NONE = No traffic</li>
61         * <li>DATAIN = Receiving IP ppp traffic</li>
62         * <li>DATAOUT = Sending IP ppp traffic</li>
63         * <li>DATAINANDOUT = Both receiving and sending IP ppp traffic</li>
64         * <li>DORMANT = The data connection is still active,
65                                     but physical link is down</li>
66         * </ul>
67         */
68        NONE, DATAIN, DATAOUT, DATAINANDOUT, DORMANT;
69    }
70
71    enum SuppService {
72      UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP, RESUME, HOLD;
73    }
74
75    // "Features" accessible through the connectivity manager
76    static final String FEATURE_ENABLE_MMS = "enableMMS";
77    static final String FEATURE_ENABLE_SUPL = "enableSUPL";
78    static final String FEATURE_ENABLE_DUN = "enableDUN";
79    static final String FEATURE_ENABLE_HIPRI = "enableHIPRI";
80    static final String FEATURE_ENABLE_DUN_ALWAYS = "enableDUNAlways";
81    static final String FEATURE_ENABLE_FOTA = "enableFOTA";
82    static final String FEATURE_ENABLE_IMS = "enableIMS";
83    static final String FEATURE_ENABLE_CBS = "enableCBS";
84    static final String FEATURE_ENABLE_EMERGENCY = "enableEmergency";
85
86    /**
87     * Optional reasons for disconnect and connect
88     */
89    static final String REASON_ROAMING_ON = "roamingOn";
90    static final String REASON_ROAMING_OFF = "roamingOff";
91    static final String REASON_DATA_DISABLED = "dataDisabled";
92    static final String REASON_DATA_ENABLED = "dataEnabled";
93    static final String REASON_DATA_ATTACHED = "dataAttached";
94    static final String REASON_DATA_DETACHED = "dataDetached";
95    static final String REASON_CDMA_DATA_ATTACHED = "cdmaDataAttached";
96    static final String REASON_CDMA_DATA_DETACHED = "cdmaDataDetached";
97    static final String REASON_APN_CHANGED = "apnChanged";
98    static final String REASON_APN_SWITCHED = "apnSwitched";
99    static final String REASON_APN_FAILED = "apnFailed";
100    static final String REASON_RESTORE_DEFAULT_APN = "restoreDefaultApn";
101    static final String REASON_RADIO_TURNED_OFF = "radioTurnedOff";
102    static final String REASON_PDP_RESET = "pdpReset";
103    static final String REASON_VOICE_CALL_ENDED = "2GVoiceCallEnded";
104    static final String REASON_VOICE_CALL_STARTED = "2GVoiceCallStarted";
105    static final String REASON_PS_RESTRICT_ENABLED = "psRestrictEnabled";
106    static final String REASON_PS_RESTRICT_DISABLED = "psRestrictDisabled";
107    static final String REASON_SIM_LOADED = "simLoaded";
108    static final String REASON_NW_TYPE_CHANGED = "nwTypeChanged";
109    static final String REASON_DATA_DEPENDENCY_MET = "dependencyMet";
110    static final String REASON_DATA_DEPENDENCY_UNMET = "dependencyUnmet";
111    static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection";
112    static final String REASON_CONNECTED = "connected";
113    static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
114    static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled";
115    static final String REASON_SIM_NOT_READY = "simNotReady";
116    static final String REASON_IWLAN_AVAILABLE = "iwlanAvailable";
117    static final String REASON_CARRIER_CHANGE = "carrierChange";
118    static final String REASON_CARRIER_ACTION_DISABLE_METERED_APN =
119            "carrierActionDisableMeteredApn";
120
121    // Used for band mode selection methods
122    static final int BM_UNSPECIFIED = RILConstants.BAND_MODE_UNSPECIFIED; // automatic
123    static final int BM_EURO_BAND   = RILConstants.BAND_MODE_EURO;
124    static final int BM_US_BAND     = RILConstants.BAND_MODE_USA;
125    static final int BM_JPN_BAND    = RILConstants.BAND_MODE_JPN;
126    static final int BM_AUS_BAND    = RILConstants.BAND_MODE_AUS;
127    static final int BM_AUS2_BAND   = RILConstants.BAND_MODE_AUS_2;
128    static final int BM_CELL_800    = RILConstants.BAND_MODE_CELL_800;
129    static final int BM_PCS         = RILConstants.BAND_MODE_PCS;
130    static final int BM_JTACS       = RILConstants.BAND_MODE_JTACS;
131    static final int BM_KOREA_PCS   = RILConstants.BAND_MODE_KOREA_PCS;
132    static final int BM_4_450M      = RILConstants.BAND_MODE_5_450M;
133    static final int BM_IMT2000     = RILConstants.BAND_MODE_IMT2000;
134    static final int BM_7_700M2     = RILConstants.BAND_MODE_7_700M_2;
135    static final int BM_8_1800M     = RILConstants.BAND_MODE_8_1800M;
136    static final int BM_9_900M      = RILConstants.BAND_MODE_9_900M;
137    static final int BM_10_800M_2   = RILConstants.BAND_MODE_10_800M_2;
138    static final int BM_EURO_PAMR   = RILConstants.BAND_MODE_EURO_PAMR_400M;
139    static final int BM_AWS         = RILConstants.BAND_MODE_AWS;
140    static final int BM_US_2500M    = RILConstants.BAND_MODE_USA_2500M;
141    static final int BM_NUM_BAND_MODES = 19; //Total number of band modes
142
143    // Used for preferred network type
144    // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
145    int NT_MODE_WCDMA_PREF   = RILConstants.NETWORK_MODE_WCDMA_PREF;
146    int NT_MODE_GSM_ONLY     = RILConstants.NETWORK_MODE_GSM_ONLY;
147    int NT_MODE_WCDMA_ONLY   = RILConstants.NETWORK_MODE_WCDMA_ONLY;
148    int NT_MODE_GSM_UMTS     = RILConstants.NETWORK_MODE_GSM_UMTS;
149
150    int NT_MODE_CDMA         = RILConstants.NETWORK_MODE_CDMA;
151
152    int NT_MODE_CDMA_NO_EVDO = RILConstants.NETWORK_MODE_CDMA_NO_EVDO;
153    int NT_MODE_EVDO_NO_CDMA = RILConstants.NETWORK_MODE_EVDO_NO_CDMA;
154    int NT_MODE_GLOBAL       = RILConstants.NETWORK_MODE_GLOBAL;
155
156    int NT_MODE_LTE_CDMA_AND_EVDO        = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO;
157    int NT_MODE_LTE_GSM_WCDMA            = RILConstants.NETWORK_MODE_LTE_GSM_WCDMA;
158    int NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA  = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA;
159    int NT_MODE_LTE_ONLY                 = RILConstants.NETWORK_MODE_LTE_ONLY;
160    int NT_MODE_LTE_WCDMA                = RILConstants.NETWORK_MODE_LTE_WCDMA;
161
162    int NT_MODE_TDSCDMA_ONLY            = RILConstants.NETWORK_MODE_TDSCDMA_ONLY;
163    int NT_MODE_TDSCDMA_WCDMA           = RILConstants.NETWORK_MODE_TDSCDMA_WCDMA;
164    int NT_MODE_LTE_TDSCDMA             = RILConstants.NETWORK_MODE_LTE_TDSCDMA;
165    int NT_MODE_TDSCDMA_GSM             = RILConstants.NETWORK_MODE_TDSCDMA_GSM;
166    int NT_MODE_LTE_TDSCDMA_GSM         = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM;
167    int NT_MODE_TDSCDMA_GSM_WCDMA       = RILConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA;
168    int NT_MODE_LTE_TDSCDMA_WCDMA       = RILConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA;
169    int NT_MODE_LTE_TDSCDMA_GSM_WCDMA   = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA;
170    int NT_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = RILConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
171    int NT_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = RILConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
172
173    int PREFERRED_NT_MODE                = RILConstants.PREFERRED_NETWORK_MODE;
174
175    // Used for CDMA roaming mode
176    // Home Networks only, as defined in PRL
177    static final int CDMA_RM_HOME        = CarrierConfigManager.CDMA_ROAMING_MODE_HOME;
178    // Roaming an Affiliated networks, as defined in PRL
179    static final int CDMA_RM_AFFILIATED  = CarrierConfigManager.CDMA_ROAMING_MODE_AFFILIATED;
180    // Roaming on Any Network, as defined in PRL
181    static final int CDMA_RM_ANY         = CarrierConfigManager.CDMA_ROAMING_MODE_ANY;
182
183    // Used for CDMA subscription mode
184    static final int CDMA_SUBSCRIPTION_UNKNOWN  =-1; // Unknown
185    static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0; // RUIM/SIM (default)
186    static final int CDMA_SUBSCRIPTION_NV       = 1; // NV -> non-volatile memory
187
188    static final int PREFERRED_CDMA_SUBSCRIPTION = CDMA_SUBSCRIPTION_NV;
189
190    static final int TTY_MODE_OFF = 0;
191    static final int TTY_MODE_FULL = 1;
192    static final int TTY_MODE_HCO = 2;
193    static final int TTY_MODE_VCO = 3;
194
195     /**
196     * CDMA OTA PROVISION STATUS, the same as RIL_CDMA_OTA_Status in ril.h
197     */
198
199    public static final int CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED = 0;
200    public static final int CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED = 1;
201    public static final int CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED = 2;
202    public static final int CDMA_OTA_PROVISION_STATUS_SSD_UPDATED = 3;
203    public static final int CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED = 4;
204    public static final int CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED = 5;
205    public static final int CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED = 6;
206    public static final int CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED = 7;
207    public static final int CDMA_OTA_PROVISION_STATUS_COMMITTED = 8;
208    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED = 9;
209    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10;
210    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11;
211
212
213    /**
214     * Get the current ServiceState. Use
215     * <code>registerForServiceStateChanged</code> to be informed of
216     * updates.
217     */
218    ServiceState getServiceState();
219
220    /**
221     * Get the current CellLocation.
222     */
223    CellLocation getCellLocation();
224
225    /**
226     * Get the current DataState. No change notification exists at this
227     * interface -- use
228     * {@link android.telephony.PhoneStateListener} instead.
229     * @param apnType specify for which apn to get connection state info.
230     */
231    DataState getDataConnectionState(String apnType);
232
233    /**
234     * Get the current DataActivityState. No change notification exists at this
235     * interface -- use
236     * {@link android.telephony.TelephonyManager} instead.
237     */
238    DataActivityState getDataActivityState();
239
240    /**
241     * Returns a list of MMI codes that are pending. (They have initiated
242     * but have not yet completed).
243     * Presently there is only ever one.
244     * Use <code>registerForMmiInitiate</code>
245     * and <code>registerForMmiComplete</code> for change notification.
246     */
247    public List<? extends MmiCode> getPendingMmiCodes();
248
249    /**
250     * Sends user response to a USSD REQUEST message.  An MmiCode instance
251     * representing this response is sent to handlers registered with
252     * registerForMmiInitiate.
253     *
254     * @param ussdMessge    Message to send in the response.
255     */
256    public void sendUssdResponse(String ussdMessge);
257
258    /**
259     * Register for Supplementary Service notifications from the network.
260     * Message.obj will contain an AsyncResult.
261     * AsyncResult.result will be a SuppServiceNotification instance.
262     *
263     * @param h Handler that receives the notification message.
264     * @param what User-defined message code.
265     * @param obj User object.
266     */
267    void registerForSuppServiceNotification(Handler h, int what, Object obj);
268
269    /**
270     * Unregisters for Supplementary Service notifications.
271     * Extraneous calls are tolerated silently
272     *
273     * @param h Handler to be removed from the registrant list.
274     */
275    void unregisterForSuppServiceNotification(Handler h);
276
277    /**
278     * Answers a ringing or waiting call. Active calls, if any, go on hold.
279     * Answering occurs asynchronously, and final notification occurs via
280     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
281     * java.lang.Object) registerForPreciseCallStateChanged()}.
282     *
283     * @param videoState The video state in which to answer the call.
284     * @exception CallStateException when no call is ringing or waiting
285     */
286    void acceptCall(int videoState) throws CallStateException;
287
288    /**
289     * Reject (ignore) a ringing call. In GSM, this means UDUB
290     * (User Determined User Busy). Reject occurs asynchronously,
291     * and final notification occurs via
292     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
293     * java.lang.Object) registerForPreciseCallStateChanged()}.
294     *
295     * @exception CallStateException when no call is ringing or waiting
296     */
297    void rejectCall() throws CallStateException;
298
299    /**
300     * Places any active calls on hold, and makes any held calls
301     *  active. Switch occurs asynchronously and may fail.
302     * Final notification occurs via
303     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
304     * java.lang.Object) registerForPreciseCallStateChanged()}.
305     *
306     * @exception CallStateException if a call is ringing, waiting, or
307     * dialing/alerting. In these cases, this operation may not be performed.
308     */
309    void switchHoldingAndActive() throws CallStateException;
310
311    /**
312     * Whether or not the phone can conference in the current phone
313     * state--that is, one call holding and one call active.
314     * @return true if the phone can conference; false otherwise.
315     */
316    boolean canConference();
317
318    /**
319     * Conferences holding and active. Conference occurs asynchronously
320     * and may fail. Final notification occurs via
321     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
322     * java.lang.Object) registerForPreciseCallStateChanged()}.
323     *
324     * @exception CallStateException if canConference() would return false.
325     * In these cases, this operation may not be performed.
326     */
327    void conference() throws CallStateException;
328
329    /**
330     * Whether or not the phone can do explicit call transfer in the current
331     * phone state--that is, one call holding and one call active.
332     * @return true if the phone can do explicit call transfer; false otherwise.
333     */
334    boolean canTransfer();
335
336    /**
337     * Connects the two calls and disconnects the subscriber from both calls
338     * Explicit Call Transfer occurs asynchronously
339     * and may fail. Final notification occurs via
340     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
341     * java.lang.Object) registerForPreciseCallStateChanged()}.
342     *
343     * @exception CallStateException if canTransfer() would return false.
344     * In these cases, this operation may not be performed.
345     */
346    void explicitCallTransfer() throws CallStateException;
347
348    /**
349     * Clears all DISCONNECTED connections from Call connection lists.
350     * Calls that were in the DISCONNECTED state become idle. This occurs
351     * synchronously.
352     */
353    void clearDisconnected();
354
355    /**
356     * Gets the foreground call object, which represents all connections that
357     * are dialing or active (all connections
358     * that have their audio path connected).<p>
359     *
360     * The foreground call is a singleton object. It is constant for the life
361     * of this phone. It is never null.<p>
362     *
363     * The foreground call will only ever be in one of these states:
364     * IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED.
365     *
366     * State change notification is available via
367     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
368     * java.lang.Object) registerForPreciseCallStateChanged()}.
369     */
370    Call getForegroundCall();
371
372    /**
373     * Gets the background call object, which represents all connections that
374     * are holding (all connections that have been accepted or connected, but
375     * do not have their audio path connected). <p>
376     *
377     * The background call is a singleton object. It is constant for the life
378     * of this phone object . It is never null.<p>
379     *
380     * The background call will only ever be in one of these states:
381     * IDLE, HOLDING or DISCONNECTED.
382     *
383     * State change notification is available via
384     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
385     * java.lang.Object) registerForPreciseCallStateChanged()}.
386     */
387    Call getBackgroundCall();
388
389    /**
390     * Gets the ringing call object, which represents an incoming
391     * connection (if present) that is pending answer/accept. (This connection
392     * may be RINGING or WAITING, and there may be only one.)<p>
393
394     * The ringing call is a singleton object. It is constant for the life
395     * of this phone. It is never null.<p>
396     *
397     * The ringing call will only ever be in one of these states:
398     * IDLE, INCOMING, WAITING or DISCONNECTED.
399     *
400     * State change notification is available via
401     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
402     * java.lang.Object) registerForPreciseCallStateChanged()}.
403     */
404    Call getRingingCall();
405
406    /**
407     * Initiate a new voice connection. This happens asynchronously, so you
408     * cannot assume the audio path is connected (or a call index has been
409     * assigned) until PhoneStateChanged notification has occurred.
410     *
411     * @param dialString The dial string.
412     * @param videoState The desired video state for the connection.
413     * @exception CallStateException if a new outgoing call is not currently
414     * possible because no more call slots exist or a call exists that is
415     * dialing, alerting, ringing, or waiting.  Other errors are
416     * handled asynchronously.
417     */
418    Connection dial(String dialString, int videoState) throws CallStateException;
419
420    /**
421     * Initiate a new voice connection with supplementary User to User
422     * Information. This happens asynchronously, so you cannot assume the audio
423     * path is connected (or a call index has been assigned) until
424     * PhoneStateChanged notification has occurred.
425     *
426     * NOTE: If adding another parameter, consider creating a DialArgs parameter instead to
427     * encapsulate all dial arguments and decrease scaffolding headache.
428     *
429     * @param dialString The dial string.
430     * @param uusInfo The UUSInfo.
431     * @param videoState The desired video state for the connection.
432     * @param intentExtras The extras from the original CALL intent.
433     * @exception CallStateException if a new outgoing call is not currently
434     *                possible because no more call slots exist or a call exists
435     *                that is dialing, alerting, ringing, or waiting. Other
436     *                errors are handled asynchronously.
437     */
438    Connection dial(String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)
439            throws CallStateException;
440
441    /**
442     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
443     * without SEND (so <code>dial</code> is not appropriate).
444     *
445     * @param dialString the MMI command to be executed.
446     * @return true if MMI command is executed.
447     */
448    boolean handlePinMmi(String dialString);
449
450    /**
451     * Handles in-call MMI commands. While in a call, or while receiving a
452     * call, use this to execute MMI commands.
453     * see 3GPP 20.030, section 6.5.5.1 for specs on the allowed MMI commands.
454     *
455     * @param command the MMI command to be executed.
456     * @return true if the MMI command is executed.
457     * @throws CallStateException
458     */
459    boolean handleInCallMmiCommands(String command) throws CallStateException;
460
461    /**
462     * Play a DTMF tone on the active call. Ignored if there is no active call.
463     * @param c should be one of 0-9, '*' or '#'. Other values will be
464     * silently ignored.
465     */
466    void sendDtmf(char c);
467
468    /**
469     * Start to paly a DTMF tone on the active call. Ignored if there is no active call
470     * or there is a playing DTMF tone.
471     * @param c should be one of 0-9, '*' or '#'. Other values will be
472     * silently ignored.
473     */
474    void startDtmf(char c);
475
476    /**
477     * Stop the playing DTMF tone. Ignored if there is no playing DTMF
478     * tone or no active call.
479     */
480    void stopDtmf();
481
482    /**
483     * Sets the radio power on/off state (off is sometimes
484     * called "airplane mode"). Current state can be gotten via
485     * {@link #getServiceState()}.{@link
486     * android.telephony.ServiceState#getState() getState()}.
487     * <strong>Note: </strong>This request is asynchronous.
488     * getServiceState().getState() will not change immediately after this call.
489     * registerForServiceStateChanged() to find out when the
490     * request is complete.
491     *
492     * @param power true means "on", false means "off".
493     */
494    void setRadioPower(boolean power);
495
496    /**
497     * Get the line 1 phone number (MSISDN). For CDMA phones, the MDN is returned
498     * and {@link #getMsisdn()} will return the MSISDN on CDMA/LTE phones.<p>
499     *
500     * @return phone number. May return null if not
501     * available or the SIM is not ready
502     */
503    String getLine1Number();
504
505    /**
506     * Returns the alpha tag associated with the msisdn number.
507     * If there is no alpha tag associated or the record is not yet available,
508     * returns a default localized string. <p>
509     */
510    String getLine1AlphaTag();
511
512    /**
513     * Sets the MSISDN phone number in the SIM card.
514     *
515     * @param alphaTag the alpha tag associated with the MSISDN phone number
516     *        (see getMsisdnAlphaTag)
517     * @param number the new MSISDN phone number to be set on the SIM.
518     * @param onComplete a callback message when the action is completed.
519     *
520     * @return true if req is sent, false otherwise. If req is not sent there will be no response,
521     * that is, onComplete will never be sent.
522     */
523    boolean setLine1Number(String alphaTag, String number, Message onComplete);
524
525    /**
526     * Get the voice mail access phone number. Typically dialed when the
527     * user holds the "1" key in the phone app. May return null if not
528     * available or the SIM is not ready.<p>
529     */
530    String getVoiceMailNumber();
531
532    /**
533     * Returns the alpha tag associated with the voice mail number.
534     * If there is no alpha tag associated or the record is not yet available,
535     * returns a default localized string. <p>
536     *
537     * Please use this value instead of some other localized string when
538     * showing a name for this number in the UI. For example, call log
539     * entries should show this alpha tag. <p>
540     *
541     * Usage of this alpha tag in the UI is a common carrier requirement.
542     */
543    String getVoiceMailAlphaTag();
544
545    /**
546     * setVoiceMailNumber
547     * sets the voicemail number in the SIM card.
548     *
549     * @param alphaTag the alpha tag associated with the voice mail number
550     *        (see getVoiceMailAlphaTag)
551     * @param voiceMailNumber the new voicemail number to be set on the SIM.
552     * @param onComplete a callback message when the action is completed.
553     */
554    void setVoiceMailNumber(String alphaTag,
555                            String voiceMailNumber,
556                            Message onComplete);
557
558    /**
559     * getCallForwardingOptions
560     * gets a call forwarding option. The return value of
561     * ((AsyncResult)onComplete.obj) is an array of CallForwardInfo.
562     *
563     * @param commandInterfaceCFReason is one of the valid call forwarding
564     *        CF_REASONS, as defined in
565     *        <code>com.android.internal.telephony.CommandsInterface.</code>
566     * @param onComplete a callback message when the action is completed.
567     *        @see com.android.internal.telephony.CallForwardInfo for details.
568     */
569    void getCallForwardingOption(int commandInterfaceCFReason,
570                                  Message onComplete);
571
572    /**
573     * setCallForwardingOptions
574     * sets a call forwarding option.
575     *
576     * @param commandInterfaceCFReason is one of the valid call forwarding
577     *        CF_REASONS, as defined in
578     *        <code>com.android.internal.telephony.CommandsInterface.</code>
579     * @param commandInterfaceCFAction is one of the valid call forwarding
580     *        CF_ACTIONS, as defined in
581     *        <code>com.android.internal.telephony.CommandsInterface.</code>
582     * @param dialingNumber is the target phone number to forward calls to
583     * @param timerSeconds is used by CFNRy to indicate the timeout before
584     *        forwarding is attempted.
585     * @param onComplete a callback message when the action is completed.
586     */
587    void setCallForwardingOption(int commandInterfaceCFReason,
588                                 int commandInterfaceCFAction,
589                                 String dialingNumber,
590                                 int timerSeconds,
591                                 Message onComplete);
592
593    /**
594     * getOutgoingCallerIdDisplay
595     * gets outgoing caller id display. The return value of
596     * ((AsyncResult)onComplete.obj) is an array of int, with a length of 2.
597     *
598     * @param onComplete a callback message when the action is completed.
599     *        @see com.android.internal.telephony.CommandsInterface#getCLIR for details.
600     */
601    void getOutgoingCallerIdDisplay(Message onComplete);
602
603    /**
604     * setOutgoingCallerIdDisplay
605     * sets a call forwarding option.
606     *
607     * @param commandInterfaceCLIRMode is one of the valid call CLIR
608     *        modes, as defined in
609     *        <code>com.android.internal.telephony.CommandsInterface./code>
610     * @param onComplete a callback message when the action is completed.
611     */
612    void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
613                                    Message onComplete);
614
615    /**
616     * getCallWaiting
617     * gets call waiting activation state. The return value of
618     * ((AsyncResult)onComplete.obj) is an array of int, with a length of 1.
619     *
620     * @param onComplete a callback message when the action is completed.
621     *        @see com.android.internal.telephony.CommandsInterface#queryCallWaiting for details.
622     */
623    void getCallWaiting(Message onComplete);
624
625    /**
626     * setCallWaiting
627     * sets a call forwarding option.
628     *
629     * @param enable is a boolean representing the state that you are
630     *        requesting, true for enabled, false for disabled.
631     * @param onComplete a callback message when the action is completed.
632     */
633    void setCallWaiting(boolean enable, Message onComplete);
634
635    /**
636     * Scan available networks. This method is asynchronous; .
637     * On completion, <code>response.obj</code> is set to an AsyncResult with
638     * one of the following members:.<p>
639     *<ul>
640     * <li><code>response.obj.result</code> will be a <code>List</code> of
641     * <code>OperatorInfo</code> objects, or</li>
642     * <li><code>response.obj.exception</code> will be set with an exception
643     * on failure.</li>
644     * </ul>
645     */
646    void getAvailableNetworks(Message response);
647
648    /**
649     * Query neighboring cell IDs.  <code>response</code> is dispatched when
650     * this is complete.  <code>response.obj</code> will be an AsyncResult,
651     * and <code>response.obj.exception</code> will be non-null on failure.
652     * On success, <code>AsyncResult.result</code> will be a <code>String[]</code>
653     * containing the neighboring cell IDs.  Index 0 will contain the count
654     * of available cell IDs.  Cell IDs are in hexadecimal format.
655     *
656     * @param response callback message that is dispatched when the query
657     * completes.
658     */
659    void getNeighboringCids(Message response);
660
661    /**
662     * Mutes or unmutes the microphone for the active call. The microphone
663     * is automatically unmuted if a call is answered, dialed, or resumed
664     * from a holding state.
665     *
666     * @param muted true to mute the microphone,
667     * false to activate the microphone.
668     */
669
670    void setMute(boolean muted);
671
672    /**
673     * Gets current mute status. Use
674     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
675     * java.lang.Object) registerForPreciseCallStateChanged()}
676     * as a change notifcation, although presently phone state changed is not
677     * fired when setMute() is called.
678     *
679     * @return true is muting, false is unmuting
680     */
681    boolean getMute();
682
683    /**
684     * Get the current active Data Call list
685     *
686     * @param response <strong>On success</strong>, "response" bytes is
687     * made available as:
688     * (String[])(((AsyncResult)response.obj).result).
689     * <strong>On failure</strong>,
690     * (((AsyncResult)response.obj).result) == null and
691     * (((AsyncResult)response.obj).exception) being an instance of
692     * com.android.internal.telephony.gsm.CommandException
693     */
694    void getDataCallList(Message response);
695
696    /**
697     * Update the ServiceState CellLocation for current network registration.
698     */
699    void updateServiceLocation();
700
701    /**
702     * Enable location update notifications.
703     */
704    void enableLocationUpdates();
705
706    /**
707     * Disable location update notifications.
708     */
709    void disableLocationUpdates();
710
711    /**
712     * @return true if enable data connection on roaming
713     */
714    boolean getDataRoamingEnabled();
715
716    /**
717     * @param enable set true if enable data connection on roaming
718     */
719    void setDataRoamingEnabled(boolean enable);
720
721    /**
722     * @return true if user has enabled data
723     */
724    boolean getDataEnabled();
725
726    /**
727     * @param @enable set {@code true} if enable data connection
728     */
729    void setDataEnabled(boolean enable);
730
731    /**
732     * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones.
733     */
734    String getDeviceId();
735
736    /**
737     * Retrieves the software version number for the device, e.g., IMEI/SV
738     * for GSM phones.
739     */
740    String getDeviceSvn();
741
742    /**
743     * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones.
744     */
745    String getSubscriberId();
746
747    /**
748     * Retrieves the Group Identifier Level1 for GSM phones.
749     */
750    String getGroupIdLevel1();
751
752    /**
753     * Retrieves the Group Identifier Level2 for phones.
754     */
755    String getGroupIdLevel2();
756
757    /* CDMA support methods */
758
759    /**
760     * Retrieves the ESN for CDMA phones.
761     */
762    String getEsn();
763
764    /**
765     * Retrieves MEID for CDMA phones.
766     */
767    String getMeid();
768
769    /**
770     * Retrieves IMEI for phones. Returns null if IMEI is not set.
771     */
772    String getImei();
773
774    /**
775     * Retrieves the IccPhoneBookInterfaceManager of the Phone
776     */
777    public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager();
778
779    /**
780     * Activate or deactivate cell broadcast SMS.
781     *
782     * @param activate
783     *            0 = activate, 1 = deactivate
784     * @param response
785     *            Callback message is empty on completion
786     */
787    void activateCellBroadcastSms(int activate, Message response);
788
789    /**
790     * Query the current configuration of cdma cell broadcast SMS.
791     *
792     * @param response
793     *            Callback message is empty on completion
794     */
795    void getCellBroadcastSmsConfig(Message response);
796
797    /**
798     * Configure cell broadcast SMS.
799     *
800     * TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig
801     *
802     * @param response
803     *            Callback message is empty on completion
804     */
805    public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response);
806}
807