Phone.java revision 95a1d1a89e383dab893750638c2393dec54833ff
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.content.SharedPreferences;
21import android.os.Handler;
22import android.os.Message;
23import android.preference.PreferenceManager;
24import android.telephony.CellLocation;
25import android.telephony.PhoneStateListener;
26import android.telephony.ServiceState;
27import android.telephony.SignalStrength;
28
29import com.android.internal.telephony.DataConnection;
30import com.android.internal.telephony.gsm.NetworkInfo;
31import com.android.internal.telephony.gsm.PdpConnection;
32import com.android.internal.telephony.test.SimulatedRadioControl;
33
34import java.util.List;
35
36/**
37 * Internal interface used to control the phone; SDK developers cannot
38 * obtain this interface.
39 *
40 * {@hide}
41 *
42 */
43public interface Phone {
44
45    /** used to enable additional debug messages */
46    static final boolean DEBUG_PHONE = true;
47
48
49    /**
50     * The phone state. One of the following:<p>
51     * <ul>
52     * <li>IDLE = no phone activity</li>
53     * <li>RINGING = a phone call is ringing or call waiting.
54     *  In the latter case, another call is active as well</li>
55     * <li>OFFHOOK = The phone is off hook. At least one call
56     * exists that is dialing, active or holding and no calls are
57     * ringing or waiting.</li>
58     * </ul>
59     */
60    enum State {
61        IDLE, RINGING, OFFHOOK;
62    };
63
64    /**
65     * The state of a data connection.
66     * <ul>
67     * <li>CONNECTED = IP traffic should be available</li>
68     * <li>CONNECTING = Currently setting up data connection</li>
69     * <li>DISCONNECTED = IP not available</li>
70     * <li>SUSPENDED = connection is created but IP traffic is
71     *                 temperately not available. i.e. voice call is in place
72     *                 in 2G network</li>
73     * </ul>
74     */
75    enum DataState {
76        CONNECTED, CONNECTING, DISCONNECTED, SUSPENDED;
77    };
78
79    public enum DataActivityState {
80        /**
81         * The state of a data activity.
82         * <ul>
83         * <li>NONE = No traffic</li>
84         * <li>DATAIN = Receiving IP ppp traffic</li>
85         * <li>DATAOUT = Sending IP ppp traffic</li>
86         * <li>DATAINANDOUT = Both receiving and sending IP ppp traffic</li>
87         * <li>DORMANT = The data connection is still active,
88                                     but physical link is down</li>
89         * </ul>
90         */
91        NONE, DATAIN, DATAOUT, DATAINANDOUT, DORMANT;
92    };
93
94    enum SuppService {
95      UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP;
96    };
97
98    static final String STATE_KEY = "state";
99    static final String PHONE_NAME_KEY = "phoneName";
100    static final String FAILURE_REASON_KEY = "reason";
101    static final String STATE_CHANGE_REASON_KEY = "reason";
102    static final String DATA_APN_TYPES_KEY = "apnType";
103    static final String DATA_APN_KEY = "apn";
104
105    static final String DATA_IFACE_NAME_KEY = "iface";
106    static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable";
107    static final String PHONE_IN_ECM_STATE = "phoneinECMState";
108
109    /**
110     * APN types for data connections.  These are usage categories for an APN
111     * entry.  One APN entry may support multiple APN types, eg, a single APN
112     * may service regular internet traffic ("default") as well as MMS-specific
113     * connections.<br/>
114     * APN_TYPE_ALL is a special type to indicate that this APN entry can
115     * service all data connections.
116     */
117    static final String APN_TYPE_ALL = "*";
118    /** APN type for default data traffic */
119    static final String APN_TYPE_DEFAULT = "default";
120    /** APN type for MMS traffic */
121    static final String APN_TYPE_MMS = "mms";
122    /** APN type for SUPL assisted GPS */
123    static final String APN_TYPE_SUPL = "supl";
124    /** APN type for DUN traffic */
125    static final String APN_TYPE_DUN = "dun";
126    /** APN type for HiPri traffic */
127    static final String APN_TYPE_HIPRI = "hipri";
128
129    // "Features" accessible through the connectivity manager
130    static final String FEATURE_ENABLE_MMS = "enableMMS";
131    static final String FEATURE_ENABLE_SUPL = "enableSUPL";
132    static final String FEATURE_ENABLE_DUN = "enableDUN";
133    static final String FEATURE_ENABLE_HIPRI = "enableHIPRI";
134
135    /**
136     * Return codes for <code>enableApnType()</code>
137     */
138    static final int APN_ALREADY_ACTIVE     = 0;
139    static final int APN_REQUEST_STARTED    = 1;
140    static final int APN_TYPE_NOT_AVAILABLE = 2;
141    static final int APN_REQUEST_FAILED     = 3;
142
143
144    /**
145     * Optional reasons for disconnect and connect
146     */
147    static final String REASON_ROAMING_ON = "roamingOn";
148    static final String REASON_ROAMING_OFF = "roamingOff";
149    static final String REASON_DATA_DISABLED = "dataDisabled";
150    static final String REASON_DATA_ENABLED = "dataEnabled";
151    static final String REASON_GPRS_ATTACHED = "gprsAttached";
152    static final String REASON_GPRS_DETACHED = "gprsDetached";
153    static final String REASON_CDMA_DATA_ATTACHED = "cdmaDataAttached";
154    static final String REASON_CDMA_DATA_DETACHED = "cdmaDataDetached";
155    static final String REASON_APN_CHANGED = "apnChanged";
156    static final String REASON_APN_SWITCHED = "apnSwitched";
157    static final String REASON_RESTORE_DEFAULT_APN = "restoreDefaultApn";
158    static final String REASON_RADIO_TURNED_OFF = "radioTurnedOff";
159    static final String REASON_PDP_RESET = "pdpReset";
160    static final String REASON_VOICE_CALL_ENDED = "2GVoiceCallEnded";
161    static final String REASON_VOICE_CALL_STARTED = "2GVoiceCallStarted";
162    static final String REASON_PS_RESTRICT_ENABLED = "psRestrictEnabled";
163    static final String REASON_PS_RESTRICT_DISABLED = "psRestrictDisabled";
164    static final String REASON_SIM_LOADED = "simLoaded";
165
166    // Used for band mode selection methods
167    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
168    static final int BM_EURO_BAND   = 1; // GSM-900 / DCS-1800 / WCDMA-IMT-2000
169    static final int BM_US_BAND     = 2; // GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900
170    static final int BM_JPN_BAND    = 3; // WCDMA-800 / WCDMA-IMT-2000
171    static final int BM_AUS_BAND    = 4; // GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000
172    static final int BM_AUS2_BAND   = 5; // GSM-900 / DCS-1800 / WCDMA-850
173    static final int BM_BOUNDARY    = 6; // upper band boundary
174
175    // Used for preferred network type
176    // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
177    int NT_MODE_WCDMA_PREF   = RILConstants.NETWORK_MODE_WCDMA_PREF;
178    int NT_MODE_GSM_ONLY     = RILConstants.NETWORK_MODE_GSM_ONLY;
179    int NT_MODE_WCDMA_ONLY   = RILConstants.NETWORK_MODE_WCDMA_ONLY;
180    int NT_MODE_GSM_UMTS     = RILConstants.NETWORK_MODE_GSM_UMTS;
181
182    int NT_MODE_CDMA         = RILConstants.NETWORK_MODE_CDMA;
183
184    int NT_MODE_CDMA_NO_EVDO = RILConstants.NETWORK_MODE_CDMA_NO_EVDO;
185    int NT_MODE_EVDO_NO_CDMA = RILConstants.NETWORK_MODE_EVDO_NO_CDMA;
186    int NT_MODE_GLOBAL       = RILConstants.NETWORK_MODE_GLOBAL;
187
188    int PREFERRED_NT_MODE    = RILConstants.PREFERRED_NETWORK_MODE;
189
190
191    // Used for CDMA roaming mode
192    static final int CDMA_RM_HOME        = 0;  // Home Networks only, as defined in PRL
193    static final int CDMA_RM_AFFILIATED  = 1;  // Roaming an Affiliated networks, as defined in PRL
194    static final int CDMA_RM_ANY         = 2;  // Roaming on Any Network, as defined in PRL
195
196    // Used for CDMA subscription mode
197    static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0; // RUIM/SIM (default)
198    static final int CDMA_SUBSCRIPTION_NV       = 1; // NV -> non-volatile memory
199
200    static final int PREFERRED_CDMA_SUBSCRIPTION = CDMA_SUBSCRIPTION_NV;
201
202    static final int TTY_MODE_OFF = 0;
203    static final int TTY_MODE_FULL = 1;
204    static final int TTY_MODE_HCO = 2;
205    static final int TTY_MODE_VCO = 3;
206
207     /**
208     * CDMA OTA PROVISION STATUS, the same as RIL_CDMA_OTA_Status in ril.h
209     */
210
211    public static final int CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED = 0;
212    public static final int CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED = 1;
213    public static final int CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED = 2;
214    public static final int CDMA_OTA_PROVISION_STATUS_SSD_UPDATED = 3;
215    public static final int CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED = 4;
216    public static final int CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED = 5;
217    public static final int CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED = 6;
218    public static final int CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED = 7;
219    public static final int CDMA_OTA_PROVISION_STATUS_COMMITTED = 8;
220    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED = 9;
221    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10;
222    public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11;
223
224
225    /**
226     * Get the current ServiceState. Use
227     * <code>registerForServiceStateChanged</code> to be informed of
228     * updates.
229     */
230    ServiceState getServiceState();
231
232    /**
233     * Get the current CellLocation.
234     */
235    CellLocation getCellLocation();
236
237    /**
238     * Get the current DataState. No change notification exists at this
239     * interface -- use
240     * {@link com.android.telephony.PhoneStateListener PhoneStateListener}
241     * instead.
242     */
243    DataState getDataConnectionState();
244
245    /**
246     * Get the current DataActivityState. No change notification exists at this
247     * interface -- use
248     * {@link TelephonyManager} instead.
249     */
250    DataActivityState getDataActivityState();
251
252    /**
253     * Gets the context for the phone, as set at initialization time.
254     */
255    Context getContext();
256
257    /**
258     * Disables the DNS check (i.e., allows "0.0.0.0").
259     * Useful for lab testing environment.
260     * @param b true disables the check, false enables.
261     */
262    void disableDnsCheck(boolean b);
263
264    /**
265     * Returns true if the DNS check is currently disabled.
266     */
267    boolean isDnsCheckDisabled();
268
269    /**
270     * Get current coarse-grained voice call state.
271     * Use {@link #registerForPreciseCallStateChanged(Handler, int, Object)
272     * registerForPreciseCallStateChanged()} for change notification. <p>
273     * If the phone has an active call and call waiting occurs,
274     * then the phone state is RINGING not OFFHOOK
275     * <strong>Note:</strong>
276     * This registration point provides notification of finer-grained
277     * changes.<p>
278     *
279     */
280    State getState();
281
282    /**
283     * Returns a string identifier for this phone interface for parties
284     *  outside the phone app process.
285     *  @return The string name.
286     */
287    String getPhoneName();
288
289    /**
290     * Returns an array of string identifiers for the APN types serviced by the
291     * currently active or last connected APN.
292     *  @return The string array.
293     */
294    String[] getActiveApnTypes();
295
296    /**
297     * Returns a string identifier for currently active or last connected APN.
298     *  @return The string name.
299     */
300    String getActiveApn();
301
302    /**
303     * Get current signal strength. No change notification available on this
304     * interface. Use <code>PhoneStateNotifier</code> or an equivalent.
305     * An ASU is 0-31 or -1 if unknown (for GSM, dBm = -113 - 2 * asu).
306     * The following special values are defined:</p>
307     * <ul><li>0 means "-113 dBm or less".</li>
308     * <li>31 means "-51 dBm or greater".</li></ul>
309     *
310     * @return Current signal strength as SignalStrength
311     */
312    SignalStrength getSignalStrength();
313
314    /**
315     * Notifies when a previously untracked non-ringing/waiting connection has appeared.
316     * This is likely due to some other entity (eg, SIM card application) initiating a call.
317     */
318    void registerForUnknownConnection(Handler h, int what, Object obj);
319
320    /**
321     * Unregisters for unknown connection notifications.
322     */
323    void unregisterForUnknownConnection(Handler h);
324
325    /**
326     * Register for getting notifications for change in the Call State {@link Call.State}
327     * This is called PreciseCallState because the call state is more precise than the
328     * {@link Phone.State} which can be obtained using the {@link PhoneStateListener}
329     *
330     * Resulting events will have an AsyncResult in <code>Message.obj</code>.
331     * AsyncResult.userData will be set to the obj argument here.
332     * The <em>h</em> parameter is held only by a weak reference.
333     */
334    void registerForPreciseCallStateChanged(Handler h, int what, Object obj);
335
336    /**
337     * Unregisters for voice call state change notifications.
338     * Extraneous calls are tolerated silently.
339     */
340    void unregisterForPreciseCallStateChanged(Handler h);
341
342
343    /**
344     * Notifies when a new ringing or waiting connection has appeared.<p>
345     *
346     *  Messages received from this:
347     *  Message.obj will be an AsyncResult
348     *  AsyncResult.userObj = obj
349     *  AsyncResult.result = a Connection. <p>
350     *  Please check Connection.isRinging() to make sure the Connection
351     *  has not dropped since this message was posted.
352     *  If Connection.isRinging() is true, then
353     *   Connection.getCall() == Phone.getRingingCall()
354     */
355    void registerForNewRingingConnection(Handler h, int what, Object obj);
356
357    /**
358     * Unregisters for new ringing connection notification.
359     * Extraneous calls are tolerated silently
360     */
361
362    void unregisterForNewRingingConnection(Handler h);
363
364    /**
365     * Notifies when an incoming call rings.<p>
366     *
367     *  Messages received from this:
368     *  Message.obj will be an AsyncResult
369     *  AsyncResult.userObj = obj
370     *  AsyncResult.result = a Connection. <p>
371     */
372    void registerForIncomingRing(Handler h, int what, Object obj);
373
374    /**
375     * Unregisters for ring notification.
376     * Extraneous calls are tolerated silently
377     */
378
379    void unregisterForIncomingRing(Handler h);
380
381
382    /**
383     * Notifies when a voice connection has disconnected, either due to local
384     * or remote hangup or error.
385     *
386     *  Messages received from this will have the following members:<p>
387     *  <ul><li>Message.obj will be an AsyncResult</li>
388     *  <li>AsyncResult.userObj = obj</li>
389     *  <li>AsyncResult.result = a Connection object that is
390     *  no longer connected.</li></ul>
391     */
392    void registerForDisconnect(Handler h, int what, Object obj);
393
394    /**
395     * Unregisters for voice disconnection notification.
396     * Extraneous calls are tolerated silently
397     */
398    void unregisterForDisconnect(Handler h);
399
400
401    /**
402     * Register for notifications of initiation of a new MMI code request.
403     * MMI codes for GSM are discussed in 3GPP TS 22.030.<p>
404     *
405     * Example: If Phone.dial is called with "*#31#", then the app will
406     * be notified here.<p>
407     *
408     * The returned <code>Message.obj</code> will contain an AsyncResult.
409     *
410     * <code>obj.result</code> will be an "MmiCode" object.
411     */
412    void registerForMmiInitiate(Handler h, int what, Object obj);
413
414    /**
415     * Unregisters for new MMI initiate notification.
416     * Extraneous calls are tolerated silently
417     */
418    void unregisterForMmiInitiate(Handler h);
419
420    /**
421     * Register for notifications that an MMI request has completed
422     * its network activity and is in its final state. This may mean a state
423     * of COMPLETE, FAILED, or CANCELLED.
424     *
425     * <code>Message.obj</code> will contain an AsyncResult.
426     * <code>obj.result</code> will be an "MmiCode" object
427     */
428    void registerForMmiComplete(Handler h, int what, Object obj);
429
430    /**
431     * Unregisters for MMI complete notification.
432     * Extraneous calls are tolerated silently
433     */
434    void unregisterForMmiComplete(Handler h);
435
436    /**
437     * Registration point for Ecm timer reset
438     * @param h handler to notify
439     * @param what user-defined message code
440     * @param obj placed in Message.obj
441     */
442    public void registerForEcmTimerReset(Handler h, int what, Object obj);
443
444    /**
445     * Unregister for notification for Ecm timer reset
446     * @param h Handler to be removed from the registrant list.
447     */
448    public void unregisterForEcmTimerReset(Handler h);
449
450    /**
451     * Returns a list of MMI codes that are pending. (They have initiated
452     * but have not yet completed).
453     * Presently there is only ever one.
454     * Use <code>registerForMmiInitiate</code>
455     * and <code>registerForMmiComplete</code> for change notification.
456     */
457    public List<? extends MmiCode> getPendingMmiCodes();
458
459    /**
460     * Sends user response to a USSD REQUEST message.  An MmiCode instance
461     * representing this response is sent to handlers registered with
462     * registerForMmiInitiate.
463     *
464     * @param ussdMessge    Message to send in the response.
465     */
466    public void sendUssdResponse(String ussdMessge);
467
468    /**
469     * Register for ServiceState changed.
470     * Message.obj will contain an AsyncResult.
471     * AsyncResult.result will be a ServiceState instance
472     */
473    void registerForServiceStateChanged(Handler h, int what, Object obj);
474
475    /**
476     * Unregisters for ServiceStateChange notification.
477     * Extraneous calls are tolerated silently
478     */
479    void unregisterForServiceStateChanged(Handler h);
480
481    /**
482     * Register for Supplementary Service notifications from the network.
483     * Message.obj will contain an AsyncResult.
484     * AsyncResult.result will be a SuppServiceNotification instance.
485     *
486     * @param h Handler that receives the notification message.
487     * @param what User-defined message code.
488     * @param obj User object.
489     */
490    void registerForSuppServiceNotification(Handler h, int what, Object obj);
491
492    /**
493     * Unregisters for Supplementary Service notifications.
494     * Extraneous calls are tolerated silently
495     *
496     * @param h Handler to be removed from the registrant list.
497     */
498    void unregisterForSuppServiceNotification(Handler h);
499
500    /**
501     * Register for notifications when a supplementary service attempt fails.
502     * Message.obj will contain an AsyncResult.
503     *
504     * @param h Handler that receives the notification message.
505     * @param what User-defined message code.
506     * @param obj User object.
507     */
508    void registerForSuppServiceFailed(Handler h, int what, Object obj);
509
510    /**
511     * Unregister for notifications when a supplementary service attempt fails.
512     * Extraneous calls are tolerated silently
513     *
514     * @param h Handler to be removed from the registrant list.
515     */
516    void unregisterForSuppServiceFailed(Handler h);
517
518    /**
519     * Register for notifications when a sInCall VoicePrivacy is enabled
520     *
521     * @param h Handler that receives the notification message.
522     * @param what User-defined message code.
523     * @param obj User object.
524     */
525    void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj);
526
527    /**
528     * Unegister for notifications when a sInCall VoicePrivacy is enabled
529     *
530     * @param h Handler to be removed from the registrant list.
531     */
532    void unregisterForInCallVoicePrivacyOn(Handler h);
533
534    /**
535     * Register for notifications when a sInCall VoicePrivacy is disabled
536     *
537     * @param h Handler that receives the notification message.
538     * @param what User-defined message code.
539     * @param obj User object.
540     */
541    void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj);
542
543    /**
544     * Unegister for notifications when a sInCall VoicePrivacy is disabled
545     *
546     * @param h Handler to be removed from the registrant list.
547     */
548    void unregisterForInCallVoicePrivacyOff(Handler h);
549
550    /**
551     * Register for notifications when CDMA OTA Provision status change
552     *
553     * @param h Handler that receives the notification message.
554     * @param what User-defined message code.
555     * @param obj User object.
556     */
557    void registerForCdmaOtaStatusChange(Handler h, int what, Object obj);
558
559    /**
560     * Unegister for notifications when CDMA OTA Provision status change
561     * @param h Handler to be removed from the registrant list.
562     */
563    void unregisterForCdmaOtaStatusChange(Handler h);
564
565    /**
566     * Registration point for subscription info ready
567     * @param h handler to notify
568     * @param what what code of message when delivered
569     * @param obj placed in Message.obj
570     */
571    public void registerForSubscriptionInfoReady(Handler h, int what, Object obj);
572
573    /**
574     * Unregister for notifications for subscription info
575     * @param h Handler to be removed from the registrant list.
576     */
577    public void unregisterForSubscriptionInfoReady(Handler h);
578
579    /**
580     * Returns SIM record load state. Use
581     * <code>getSimCard().registerForReady()</code> for change notification.
582     *
583     * @return true if records from the SIM have been loaded and are
584     * available (if applicable). If not applicable to the underlying
585     * technology, returns true as well.
586     */
587    boolean getIccRecordsLoaded();
588
589    /**
590     * Returns the ICC card interface for this phone, or null
591     * if not applicable to underlying technology.
592     */
593    IccCard getIccCard();
594
595    /**
596     * Answers a ringing or waiting call. Active calls, if any, go on hold.
597     * Answering occurs asynchronously, and final notification occurs via
598     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
599     * java.lang.Object) registerForPreciseCallStateChanged()}.
600     *
601     * @exception CallStateException when no call is ringing or waiting
602     */
603    void acceptCall() throws CallStateException;
604
605    /**
606     * Reject (ignore) a ringing call. In GSM, this means UDUB
607     * (User Determined User Busy). Reject occurs asynchronously,
608     * and final notification occurs via
609     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
610     * java.lang.Object) registerForPreciseCallStateChanged()}.
611     *
612     * @exception CallStateException when no call is ringing or waiting
613     */
614    void rejectCall() throws CallStateException;
615
616    /**
617     * Places any active calls on hold, and makes any held calls
618     *  active. Switch occurs asynchronously and may fail.
619     * Final notification occurs via
620     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
621     * java.lang.Object) registerForPreciseCallStateChanged()}.
622     *
623     * @exception CallStateException if a call is ringing, waiting, or
624     * dialing/alerting. In these cases, this operation may not be performed.
625     */
626    void switchHoldingAndActive() throws CallStateException;
627
628    /**
629     * Whether or not the phone can conference in the current phone
630     * state--that is, one call holding and one call active.
631     * @return true if the phone can conference; false otherwise.
632     */
633    boolean canConference();
634
635    /**
636     * Conferences holding and active. Conference occurs asynchronously
637     * and may fail. Final notification occurs via
638     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
639     * java.lang.Object) registerForPreciseCallStateChanged()}.
640     *
641     * @exception CallStateException if canConference() would return false.
642     * In these cases, this operation may not be performed.
643     */
644    void conference() throws CallStateException;
645
646    /**
647     * Enable or disable enhanced Voice Privacy (VP). If enhanced VP is
648     * disabled, normal VP is enabled.
649     *
650     * @param enable whether true or false to enable or disable.
651     * @param onComplete a callback message when the action is completed.
652     */
653    void enableEnhancedVoicePrivacy(boolean enable, Message onComplete);
654
655    /**
656     * Get the currently set Voice Privacy (VP) mode.
657     *
658     * @param onComplete a callback message when the action is completed.
659     */
660    void getEnhancedVoicePrivacy(Message onComplete);
661
662    /**
663     * Whether or not the phone can do explicit call transfer in the current
664     * phone state--that is, one call holding and one call active.
665     * @return true if the phone can do explicit call transfer; false otherwise.
666     */
667    boolean canTransfer();
668
669    /**
670     * Connects the two calls and disconnects the subscriber from both calls
671     * Explicit Call Transfer occurs asynchronously
672     * and may fail. Final notification occurs via
673     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
674     * java.lang.Object) registerForPreciseCallStateChanged()}.
675     *
676     * @exception CallStateException if canTransfer() would return false.
677     * In these cases, this operation may not be performed.
678     */
679    void explicitCallTransfer() throws CallStateException;
680
681    /**
682     * Clears all DISCONNECTED connections from Call connection lists.
683     * Calls that were in the DISCONNECTED state become idle. This occurs
684     * synchronously.
685     */
686    void clearDisconnected();
687
688
689    /**
690     * Gets the foreground call object, which represents all connections that
691     * are dialing or active (all connections
692     * that have their audio path connected).<p>
693     *
694     * The foreground call is a singleton object. It is constant for the life
695     * of this phone. It is never null.<p>
696     *
697     * The foreground call will only ever be in one of these states:
698     * IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED.
699     *
700     * State change notification is available via
701     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
702     * java.lang.Object) registerForPreciseCallStateChanged()}.
703     */
704    Call getForegroundCall();
705
706    /**
707     * Gets the background call object, which represents all connections that
708     * are holding (all connections that have been accepted or connected, but
709     * do not have their audio path connected). <p>
710     *
711     * The background call is a singleton object. It is constant for the life
712     * of this phone object . It is never null.<p>
713     *
714     * The background call will only ever be in one of these states:
715     * IDLE, HOLDING or DISCONNECTED.
716     *
717     * State change notification is available via
718     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
719     * java.lang.Object) registerForPreciseCallStateChanged()}.
720     */
721    Call getBackgroundCall();
722
723    /**
724     * Gets the ringing call object, which represents an incoming
725     * connection (if present) that is pending answer/accept. (This connection
726     * may be RINGING or WAITING, and there may be only one.)<p>
727
728     * The ringing call is a singleton object. It is constant for the life
729     * of this phone. It is never null.<p>
730     *
731     * The ringing call will only ever be in one of these states:
732     * IDLE, INCOMING, WAITING or DISCONNECTED.
733     *
734     * State change notification is available via
735     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
736     * java.lang.Object) registerForPreciseCallStateChanged()}.
737     */
738    Call getRingingCall();
739
740    /**
741     * Initiate a new voice connection. This happens asynchronously, so you
742     * cannot assume the audio path is connected (or a call index has been
743     * assigned) until PhoneStateChanged notification has occurred.
744     *
745     * @exception CallStateException if a new outgoing call is not currently
746     * possible because no more call slots exist or a call exists that is
747     * dialing, alerting, ringing, or waiting.  Other errors are
748     * handled asynchronously.
749     */
750    Connection dial(String dialString) throws CallStateException;
751
752    /**
753     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
754     * without SEND (so <code>dial</code> is not appropriate).
755     *
756     * @param dialString the MMI command to be executed.
757     * @return true if MMI command is executed.
758     */
759    boolean handlePinMmi(String dialString);
760
761    /**
762     * Handles in-call MMI commands. While in a call, or while receiving a
763     * call, use this to execute MMI commands.
764     * see 3GPP 20.030, section 6.5.5.1 for specs on the allowed MMI commands.
765     *
766     * @param command the MMI command to be executed.
767     * @return true if the MMI command is executed.
768     * @throws CallStateException
769     */
770    boolean handleInCallMmiCommands(String command) throws CallStateException;
771
772    /**
773     * Play a DTMF tone on the active call. Ignored if there is no active call.
774     * @param c should be one of 0-9, '*' or '#'. Other values will be
775     * silently ignored.
776     */
777    void sendDtmf(char c);
778
779    /**
780     * Start to paly a DTMF tone on the active call. Ignored if there is no active call
781     * or there is a playing DTMF tone.
782     * @param c should be one of 0-9, '*' or '#'. Other values will be
783     * silently ignored.
784     */
785    void startDtmf(char c);
786
787    /**
788     * Stop the playing DTMF tone. Ignored if there is no playing DTMF
789     * tone or no active call.
790     */
791    void stopDtmf();
792
793    /**
794     * send burst DTMF tone, it can send the string as single character or multiple character
795     * ignore if there is no active call or not valid digits string.
796     * Valid digit means only includes characters ISO-LATIN characters 0-9, *, #
797     * The difference between sendDtmf and sendBurstDtmf is sendDtmf only sends one character,
798     * this api can send single character and multiple character, also, this api has response
799     * back to caller.
800     *
801     * @param dtmfString is string representing the dialing digit(s) in the active call
802     * @param on the DTMF ON length in milliseconds, or 0 for default
803     * @param off the DTMF OFF length in milliseconds, or 0 for default
804     * @param onCompelte is the callback message when the action is processed by BP
805     *
806     */
807    void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete);
808
809    /**
810     * Sets the radio power on/off state (off is sometimes
811     * called "airplane mode"). Current state can be gotten via
812     * {@link #getServiceState()}.{@link
813     * android.telephony.ServiceState#getState() getState()}.
814     * <strong>Note: </strong>This request is asynchronous.
815     * getServiceState().getState() will not change immediately after this call.
816     * registerForServiceStateChanged() to find out when the
817     * request is complete.
818     *
819     * @param power true means "on", false means "off".
820     */
821    void setRadioPower(boolean power);
822
823    /**
824     * Get voice message waiting indicator status. No change notification
825     * available on this interface. Use PhoneStateNotifier or similar instead.
826     *
827     * @return true if there is a voice message waiting
828     */
829    boolean getMessageWaitingIndicator();
830
831    /**
832     * Get voice call forwarding indicator status. No change notification
833     * available on this interface. Use PhoneStateNotifier or similar instead.
834     *
835     * @return true if there is a voice call forwarding
836     */
837    boolean getCallForwardingIndicator();
838
839    /**
840     * Get the line 1 phone number (MSISDN).<p>
841     *
842     * @return phone number. May return null if not
843     * available or the SIM is not ready
844     */
845    String getLine1Number();
846
847    /**
848     * Returns the alpha tag associated with the msisdn number.
849     * If there is no alpha tag associated or the record is not yet available,
850     * returns a default localized string. <p>
851     */
852    String getLine1AlphaTag();
853
854    /**
855     * Sets the MSISDN phone number in the SIM card.
856     *
857     * @param alphaTag the alpha tag associated with the MSISDN phone number
858     *        (see getMsisdnAlphaTag)
859     * @param number the new MSISDN phone number to be set on the SIM.
860     * @param onComplete a callback message when the action is completed.
861     */
862    void setLine1Number(String alphaTag, String number, Message onComplete);
863
864    /**
865     * Get the voice mail access phone number. Typically dialed when the
866     * user holds the "1" key in the phone app. May return null if not
867     * available or the SIM is not ready.<p>
868     */
869    String getVoiceMailNumber();
870
871    /**
872     * Returns unread voicemail count. This count is shown when the  voicemail
873     * notification is expanded.<p>
874     */
875    int getVoiceMessageCount();
876
877    /**
878     * Returns the alpha tag associated with the voice mail number.
879     * If there is no alpha tag associated or the record is not yet available,
880     * returns a default localized string. <p>
881     *
882     * Please use this value instead of some other localized string when
883     * showing a name for this number in the UI. For example, call log
884     * entries should show this alpha tag. <p>
885     *
886     * Usage of this alpha tag in the UI is a common carrier requirement.
887     */
888    String getVoiceMailAlphaTag();
889
890    /**
891     * setVoiceMailNumber
892     * sets the voicemail number in the SIM card.
893     *
894     * @param alphaTag the alpha tag associated with the voice mail number
895     *        (see getVoiceMailAlphaTag)
896     * @param voiceMailNumber the new voicemail number to be set on the SIM.
897     * @param onComplete a callback message when the action is completed.
898     */
899    void setVoiceMailNumber(String alphaTag,
900                            String voiceMailNumber,
901                            Message onComplete);
902
903    /**
904     * getCallForwardingOptions
905     * gets a call forwarding option. The return value of
906     * ((AsyncResult)onComplete.obj) is an array of CallForwardInfo.
907     *
908     * @param commandInterfaceCFReason is one of the valid call forwarding
909     *        CF_REASONS, as defined in
910     *        <code>com.android.internal.telephony.CommandsInterface.</code>
911     * @param onComplete a callback message when the action is completed.
912     *        @see com.android.internal.telephony.CallForwardInfo for details.
913     */
914    void getCallForwardingOption(int commandInterfaceCFReason,
915                                  Message onComplete);
916
917    /**
918     * setCallForwardingOptions
919     * sets a call forwarding option.
920     *
921     * @param commandInterfaceCFReason is one of the valid call forwarding
922     *        CF_REASONS, as defined in
923     *        <code>com.android.internal.telephony.CommandsInterface.</code>
924     * @param commandInterfaceCFAction is one of the valid call forwarding
925     *        CF_ACTIONS, as defined in
926     *        <code>com.android.internal.telephony.CommandsInterface.</code>
927     * @param dialingNumber is the target phone number to forward calls to
928     * @param timerSeconds is used by CFNRy to indicate the timeout before
929     *        forwarding is attempted.
930     * @param onComplete a callback message when the action is completed.
931     */
932    void setCallForwardingOption(int commandInterfaceCFReason,
933                                 int commandInterfaceCFAction,
934                                 String dialingNumber,
935                                 int timerSeconds,
936                                 Message onComplete);
937
938    /**
939     * getOutgoingCallerIdDisplay
940     * gets outgoing caller id display. The return value of
941     * ((AsyncResult)onComplete.obj) is an array of int, with a length of 2.
942     *
943     * @param onComplete a callback message when the action is completed.
944     *        @see com.android.internal.telephony.CommandsInterface.getCLIR for details.
945     */
946    void getOutgoingCallerIdDisplay(Message onComplete);
947
948    /**
949     * setOutgoingCallerIdDisplay
950     * sets a call forwarding option.
951     *
952     * @param commandInterfaceCLIRMode is one of the valid call CLIR
953     *        modes, as defined in
954     *        <code>com.android.internal.telephony.CommandsInterface./code>
955     * @param onComplete a callback message when the action is completed.
956     */
957    void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
958                                    Message onComplete);
959
960    /**
961     * getCallWaiting
962     * gets call waiting activation state. The return value of
963     * ((AsyncResult)onComplete.obj) is an array of int, with a length of 1.
964     *
965     * @param onComplete a callback message when the action is completed.
966     *        @see com.android.internal.telephony.CommandsInterface.queryCallWaiting for details.
967     */
968    void getCallWaiting(Message onComplete);
969
970    /**
971     * setCallWaiting
972     * sets a call forwarding option.
973     *
974     * @param enable is a boolean representing the state that you are
975     *        requesting, true for enabled, false for disabled.
976     * @param onComplete a callback message when the action is completed.
977     */
978    void setCallWaiting(boolean enable, Message onComplete);
979
980    /**
981     * Scan available networks. This method is asynchronous; .
982     * On completion, <code>response.obj</code> is set to an AsyncResult with
983     * one of the following members:.<p>
984     *<ul>
985     * <li><code>response.obj.result</code> will be a <code>List</code> of
986     * <code>com.android.internal.telephony.gsm.NetworkInfo</code> objects, or</li>
987     * <li><code>response.obj.exception</code> will be set with an exception
988     * on failure.</li>
989     * </ul>
990     */
991    void getAvailableNetworks(Message response);
992
993    /**
994     * Switches network selection mode to "automatic", re-scanning and
995     * re-selecting a network if appropriate.
996     *
997     * @param response The message to dispatch when the network selection
998     * is complete.
999     *
1000     * @see #selectNetworkManually(com.android.internal.telephony.gsm.NetworkInfo,
1001     * android.os.Message )
1002     */
1003    void setNetworkSelectionModeAutomatic(Message response);
1004
1005    /**
1006     * Manually selects a network. <code>response</code> is
1007     * dispatched when this is complete.  <code>response.obj</code> will be
1008     * an AsyncResult, and <code>response.obj.exception</code> will be non-null
1009     * on failure.
1010     *
1011     * @see #setNetworkSelectionModeAutomatic(Message)
1012     */
1013    void selectNetworkManually(NetworkInfo network,
1014                            Message response);
1015
1016    /**
1017     *  Requests to set the preferred network type for searching and registering
1018     * (CS/PS domain, RAT, and operation mode)
1019     * @param networkType one of  NT_*_TYPE
1020     * @param response is callback message
1021     */
1022    void setPreferredNetworkType(int networkType, Message response);
1023
1024    /**
1025     *  Query the preferred network type setting
1026     *
1027     * @param response is callback message to report one of  NT_*_TYPE
1028     */
1029    void getPreferredNetworkType(Message response);
1030
1031    /**
1032     * Gets the default SMSC address.
1033     *
1034     * @param result Callback message contains the SMSC address.
1035     */
1036    void getSmscAddress(Message result);
1037
1038    /**
1039     * Sets the default SMSC address.
1040     *
1041     * @param address new SMSC address
1042     * @param result Callback message is empty on completion
1043     */
1044    void setSmscAddress(String address, Message result);
1045
1046    /**
1047     * Query neighboring cell IDs.  <code>response</code> is dispatched when
1048     * this is complete.  <code>response.obj</code> will be an AsyncResult,
1049     * and <code>response.obj.exception</code> will be non-null on failure.
1050     * On success, <code>AsyncResult.result</code> will be a <code>String[]</code>
1051     * containing the neighboring cell IDs.  Index 0 will contain the count
1052     * of available cell IDs.  Cell IDs are in hexadecimal format.
1053     *
1054     * @param response callback message that is dispatched when the query
1055     * completes.
1056     */
1057    void getNeighboringCids(Message response);
1058
1059    /**
1060     * Sets an event to be fired when the telephony system processes
1061     * a post-dial character on an outgoing call.<p>
1062     *
1063     * Messages of type <code>what</code> will be sent to <code>h</code>.
1064     * The <code>obj</code> field of these Message's will be instances of
1065     * <code>AsyncResult</code>. <code>Message.obj.result</code> will be
1066     * a Connection object.<p>
1067     *
1068     * Message.arg1 will be the post dial character being processed,
1069     * or 0 ('\0') if end of string.<p>
1070     *
1071     * If Connection.getPostDialState() == WAIT,
1072     * the application must call
1073     * {@link com.android.internal.telephony.Connection#proceedAfterWaitChar()
1074     * Connection.proceedAfterWaitChar()} or
1075     * {@link com.android.internal.telephony.Connection#cancelPostDial()
1076     * Connection.cancelPostDial()}
1077     * for the telephony system to continue playing the post-dial
1078     * DTMF sequence.<p>
1079     *
1080     * If Connection.getPostDialState() == WILD,
1081     * the application must call
1082     * {@link com.android.internal.telephony.Connection#proceedAfterWildChar
1083     * Connection.proceedAfterWildChar()}
1084     * or
1085     * {@link com.android.internal.telephony.Connection#cancelPostDial()
1086     * Connection.cancelPostDial()}
1087     * for the telephony system to continue playing the
1088     * post-dial DTMF sequence.<p>
1089     *
1090     * Only one post dial character handler may be set. <p>
1091     * Calling this method with "h" equal to null unsets this handler.<p>
1092     */
1093    void setOnPostDialCharacter(Handler h, int what, Object obj);
1094
1095
1096    /**
1097     * Mutes or unmutes the microphone for the active call. The microphone
1098     * is automatically unmuted if a call is answered, dialed, or resumed
1099     * from a holding state.
1100     *
1101     * @param muted true to mute the microphone,
1102     * false to activate the microphone.
1103     */
1104
1105    void setMute(boolean muted);
1106
1107    /**
1108     * Gets current mute status. Use
1109     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
1110     * java.lang.Object) registerForPreciseCallStateChanged()}
1111     * as a change notifcation, although presently phone state changed is not
1112     * fired when setMute() is called.
1113     *
1114     * @return true is muting, false is unmuting
1115     */
1116    boolean getMute();
1117
1118    /**
1119     * Invokes RIL_REQUEST_OEM_HOOK_RAW on RIL implementation.
1120     *
1121     * @param data The data for the request.
1122     * @param response <strong>On success</strong>,
1123     * (byte[])(((AsyncResult)response.obj).result)
1124     * <strong>On failure</strong>,
1125     * (((AsyncResult)response.obj).result) == null and
1126     * (((AsyncResult)response.obj).exception) being an instance of
1127     * com.android.internal.telephony.gsm.CommandException
1128     *
1129     * @see #invokeOemRilRequestRaw(byte[], android.os.Message)
1130     */
1131    void invokeOemRilRequestRaw(byte[] data, Message response);
1132
1133    /**
1134     * Invokes RIL_REQUEST_OEM_HOOK_Strings on RIL implementation.
1135     *
1136     * @param strings The strings to make available as the request data.
1137     * @param response <strong>On success</strong>, "response" bytes is
1138     * made available as:
1139     * (String[])(((AsyncResult)response.obj).result).
1140     * <strong>On failure</strong>,
1141     * (((AsyncResult)response.obj).result) == null and
1142     * (((AsyncResult)response.obj).exception) being an instance of
1143     * com.android.internal.telephony.gsm.CommandException
1144     *
1145     * @see #invokeOemRilRequestStrings(java.lang.String[], android.os.Message)
1146     */
1147    void invokeOemRilRequestStrings(String[] strings, Message response);
1148
1149    /**
1150     * Get the current active PDP context list
1151     *
1152     * @deprecated
1153     * @param response <strong>On success</strong>, "response" bytes is
1154     * made available as:
1155     * (String[])(((AsyncResult)response.obj).result).
1156     * <strong>On failure</strong>,
1157     * (((AsyncResult)response.obj).result) == null and
1158     * (((AsyncResult)response.obj).exception) being an instance of
1159     * com.android.internal.telephony.gsm.CommandException
1160     */
1161    void getPdpContextList(Message response);
1162
1163    /**
1164     * Get the current active Data Call list, substitutes getPdpContextList
1165     *
1166     * @param response <strong>On success</strong>, "response" bytes is
1167     * made available as:
1168     * (String[])(((AsyncResult)response.obj).result).
1169     * <strong>On failure</strong>,
1170     * (((AsyncResult)response.obj).result) == null and
1171     * (((AsyncResult)response.obj).exception) being an instance of
1172     * com.android.internal.telephony.gsm.CommandException
1173     */
1174    void getDataCallList(Message response);
1175
1176    /**
1177     * Get current mutiple PDP link status
1178     *
1179     * @deprecated
1180     * @return list of pdp link connections
1181     */
1182    List<PdpConnection> getCurrentPdpList ();
1183
1184    /**
1185     * Get current mutiple data connection status
1186     *
1187     * @return list of data connections
1188     */
1189    List<DataConnection> getCurrentDataConnectionList ();
1190
1191    /**
1192     * Udpate LAC and CID in service state for currnet GSM netowrk registration
1193     *
1194     * If get different LAC and/or CID, notifyServiceState will be sent
1195     *
1196     * @param
1197     * <strong>On failure</strong>,
1198     * (((AsyncResult)response.obj).result) == null and
1199     * (((AsyncResult)response.obj).exception) being an instance of
1200     * com.android.internal.telephony.gsm.CommandException
1201     */
1202    void updateServiceLocation(Message response);
1203
1204    /**
1205     * Enable location update notifications.
1206     */
1207    void enableLocationUpdates();
1208
1209    /**
1210     * Disable location update notifications.
1211     */
1212    void disableLocationUpdates();
1213
1214    /**
1215     * For unit tests; don't send notifications to "Phone"
1216     * mailbox registrants if true.
1217     */
1218    void setUnitTestMode(boolean f);
1219
1220    /**
1221     * @return true If unit test mode is enabled
1222     */
1223    boolean getUnitTestMode();
1224
1225    /**
1226     * Assign a specified band for RF configuration.
1227     *
1228     * @param bandMode one of BM_*_BAND
1229     * @param response is callback message
1230     */
1231    void setBandMode(int bandMode, Message response);
1232
1233    /**
1234     * Query the list of band mode supported by RF.
1235     *
1236     * @param response is callback message
1237     *        ((AsyncResult)response.obj).result  is an int[] with every
1238     *        element representing one avialable BM_*_BAND
1239     */
1240    void queryAvailableBandMode(Message response);
1241
1242    /**
1243     * @return true if enable data connection on roaming
1244     */
1245    boolean getDataRoamingEnabled();
1246
1247    /**
1248     * @param enable set true if enable data connection on roaming
1249     */
1250    void setDataRoamingEnabled(boolean enable);
1251
1252    /**
1253     *  Query the CDMA roaming preference setting
1254     *
1255     * @param response is callback message to report one of  CDMA_RM_*
1256     */
1257    void queryCdmaRoamingPreference(Message response);
1258
1259    /**
1260     *  Requests to set the CDMA roaming preference
1261     * @param cdmaRoamingType one of  CDMA_RM_*
1262     * @param response is callback message
1263     */
1264    void setCdmaRoamingPreference(int cdmaRoamingType, Message response);
1265
1266    /**
1267     *  Requests to set the CDMA subscription mode
1268     * @param cdmaSubscriptionType one of  CDMA_SUBSCRIPTION_*
1269     * @param response is callback message
1270     */
1271    void setCdmaSubscription(int cdmaSubscriptionType, Message response);
1272
1273    /**
1274     * If this is a simulated phone interface, returns a SimulatedRadioControl.
1275     * @ return A SimulatedRadioControl if this is a simulated interface;
1276     * otherwise, null.
1277     */
1278    SimulatedRadioControl getSimulatedRadioControl();
1279
1280    /**
1281     * Allow mobile data connections.
1282     * @return {@code true} if the operation started successfully
1283     * <br/>{@code false} if it
1284     * failed immediately.<br/>
1285     * Even in the {@code true} case, it may still fail later
1286     * during setup, in which case an asynchronous indication will
1287     * be supplied.
1288     */
1289    boolean enableDataConnectivity();
1290
1291    /**
1292     * Disallow mobile data connections, and terminate any that
1293     * are in progress.
1294     * @return {@code true} if the operation started successfully
1295     * <br/>{@code false} if it
1296     * failed immediately.<br/>
1297     * Even in the {@code true} case, it may still fail later
1298     * during setup, in which case an asynchronous indication will
1299     * be supplied.
1300     */
1301    boolean disableDataConnectivity();
1302
1303    /**
1304     * Report the current state of data connectivity (enabled or disabled)
1305     * @return {@code false} if data connectivity has been explicitly disabled,
1306     * {@code true} otherwise.
1307     */
1308    boolean isDataConnectivityEnabled();
1309
1310    /**
1311     * Enables the specified APN type. Only works for "special" APN types,
1312     * i.e., not the default APN.
1313     * @param type The desired APN type. Cannot be {@link #APN_TYPE_DEFAULT}.
1314     * @return <code>APN_ALREADY_ACTIVE</code> if the current APN
1315     * services the requested type.<br/>
1316     * <code>APN_TYPE_NOT_AVAILABLE</code> if the carrier does not
1317     * support the requested APN.<br/>
1318     * <code>APN_REQUEST_STARTED</code> if the request has been initiated.<br/>
1319     * <code>APN_REQUEST_FAILED</code> if the request was invalid.<br/>
1320     * A <code>ACTION_ANY_DATA_CONNECTION_STATE_CHANGED</code> broadcast will
1321     * indicate connection state progress.
1322     */
1323    int enableApnType(String type);
1324
1325    /**
1326     * Disables the specified APN type, and switches back to the default APN,
1327     * if necessary. Switching to the default APN will not happen if default
1328     * data traffic has been explicitly disabled via a call to {@link #disableDataConnectivity}.
1329     * <p/>Only works for "special" APN types,
1330     * i.e., not the default APN.
1331     * @param type The desired APN type. Cannot be {@link #APN_TYPE_DEFAULT}.
1332     * @return <code>APN_ALREADY_ACTIVE</code> if the default APN
1333     * is already active.<br/>
1334     * <code>APN_REQUEST_STARTED</code> if the request to switch to the default
1335     * APN has been initiated.<br/>
1336     * <code>APN_REQUEST_FAILED</code> if the request was invalid.<br/>
1337     * A <code>ACTION_ANY_DATA_CONNECTION_STATE_CHANGED</code> broadcast will
1338     * indicate connection state progress.
1339     */
1340    int disableApnType(String type);
1341
1342    /**
1343     * Report on whether data connectivity is allowed.
1344     */
1345    boolean isDataConnectivityPossible();
1346
1347    /**
1348     * Returns the name of the network interface used by the specified APN type.
1349     */
1350    String getInterfaceName(String apnType);
1351
1352    /**
1353     * Returns the IP address of the network interface used by the specified
1354     * APN type.
1355     */
1356    String getIpAddress(String apnType);
1357
1358    /**
1359     * Returns the gateway for the network interface used by the specified APN
1360     * type.
1361     */
1362    String getGateway(String apnType);
1363
1364    /**
1365     * Returns the DNS servers for the network interface used by the specified
1366     * APN type.
1367     */
1368    public String[] getDnsServers(String apnType);
1369
1370    /**
1371     * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones.
1372     */
1373    String getDeviceId();
1374
1375    /**
1376     * Retrieves the software version number for the device, e.g., IMEI/SV
1377     * for GSM phones.
1378     */
1379    String getDeviceSvn();
1380
1381    /**
1382     * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones.
1383     */
1384    String getSubscriberId();
1385
1386    /**
1387     * Retrieves the serial number of the ICC, if applicable.
1388     */
1389    String getIccSerialNumber();
1390
1391    //***** CDMA support methods
1392
1393    /*
1394     * TODO(Moto) TODO(Teleca): can getCdmaMin, getEsn, getMeid use more generic calls
1395     * already defined getXxxx above?
1396     */
1397
1398    /**
1399     * Retrieves the MIN for CDMA phones.
1400     */
1401    String getCdmaMin();
1402
1403    /**
1404     * Check if subscription data has been assigned to mMin
1405     *
1406     * return true if MIN info is ready; false otherwise.
1407     */
1408    boolean isMinInfoReady();
1409
1410    /**
1411     *  Retrieves PRL Version for CDMA phones
1412     */
1413    String getCdmaPrlVersion();
1414
1415    /**
1416     * Retrieves the ESN for CDMA phones.
1417     */
1418    String getEsn();
1419
1420    /**
1421     * Retrieves MEID for CDMA phones.
1422     */
1423    String getMeid();
1424
1425    /**
1426     * Retrieves the PhoneSubInfo of the Phone
1427     */
1428    public PhoneSubInfo getPhoneSubInfo();
1429
1430    /**
1431     * Retrieves the IccSmsInterfaceManager of the Phone
1432     */
1433    public IccSmsInterfaceManager getIccSmsInterfaceManager();
1434
1435    /**
1436     * Retrieves the IccPhoneBookInterfaceManager of the Phone
1437     */
1438    public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager();
1439
1440    /**
1441     * setTTYMode
1442     * sets a TTY mode option.
1443     *
1444     * @param enable is a boolean representing the state that you are
1445     *        requesting, true for enabled, false for disabled.
1446     * @param onComplete a callback message when the action is completed
1447     */
1448    void setTTYMode(int ttyMode, Message onComplete);
1449
1450    /**
1451     * queryTTYMode
1452     * query the status of the TTY mode
1453     *
1454     * @param onComplete a callback message when the action is completed.
1455     */
1456    void queryTTYMode(Message onComplete);
1457
1458    /**
1459     * Activate or deactivate cell broadcast SMS.
1460     *
1461     * @param activate
1462     *            0 = activate, 1 = deactivate
1463     * @param response
1464     *            Callback message is empty on completion
1465     */
1466    void activateCellBroadcastSms(int activate, Message response);
1467
1468    /**
1469     * Query the current configuration of cdma cell broadcast SMS.
1470     *
1471     * @param response
1472     *            Callback message is empty on completion
1473     */
1474    void getCellBroadcastSmsConfig(Message response);
1475
1476    /**
1477     * Configure cell broadcast SMS.
1478     *
1479     * TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig
1480     *
1481     * @param response
1482     *            Callback message is empty on completion
1483     */
1484    public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response);
1485
1486    public void notifyDataActivity();
1487
1488    /**
1489     * Returns the CDMA ERI icon index to display
1490     */
1491    public int getCdmaEriIconIndex();
1492
1493    /**
1494     * Returns the CDMA ERI icon mode,
1495     * 0 - ON
1496     * 1 - FLASHING
1497     */
1498    public int getCdmaEriIconMode();
1499
1500    /**
1501     * Returns the CDMA ERI text,
1502     */
1503    public String getCdmaEriText();
1504
1505    /**
1506     * request to exit emergency call back mode
1507     * the caller should use setOnECMModeExitResponse
1508     * to receive the emergency callback mode exit response
1509     */
1510    void exitEmergencyCallbackMode();
1511
1512    /**
1513     * this decides if the dial number is OTA(Over the air provision) number or not
1514     * @param dialStr is string representing the dialing digit(s)
1515     * @return  true means the dialStr is OTA number, and false means the dialStr is not OTA number
1516     */
1517    boolean isOtaSpNumber(String dialStr);
1518
1519    /**
1520     * Register for notifications when CDMA call waiting comes
1521     *
1522     * @param h Handler that receives the notification message.
1523     * @param what User-defined message code.
1524     * @param obj User object.
1525     */
1526    void registerForCallWaiting(Handler h, int what, Object obj);
1527
1528    /**
1529     * Unegister for notifications when CDMA Call waiting comes
1530     * @param h Handler to be removed from the registrant list.
1531     */
1532    void unregisterForCallWaiting(Handler h);
1533
1534
1535    /**
1536     * Register for signal information notifications from the network.
1537     * Message.obj will contain an AsyncResult.
1538     * AsyncResult.result will be a SuppServiceNotification instance.
1539     *
1540     * @param h Handler that receives the notification message.
1541     * @param what User-defined message code.
1542     * @param obj User object.
1543     */
1544
1545    void registerForSignalInfo(Handler h, int what, Object obj) ;
1546    /**
1547     * Unregisters for signal information notifications.
1548     * Extraneous calls are tolerated silently
1549     *
1550     * @param h Handler to be removed from the registrant list.
1551     */
1552    void unregisterForSignalInfo(Handler h);
1553
1554    /**
1555     * Register for display information notifications from the network.
1556     * Message.obj will contain an AsyncResult.
1557     * AsyncResult.result will be a SuppServiceNotification instance.
1558     *
1559     * @param h Handler that receives the notification message.
1560     * @param what User-defined message code.
1561     * @param obj User object.
1562     */
1563    void registerForDisplayInfo(Handler h, int what, Object obj);
1564
1565    /**
1566     * Unregisters for display information notifications.
1567     * Extraneous calls are tolerated silently
1568     *
1569     * @param h Handler to be removed from the registrant list.
1570     */
1571    void unregisterForDisplayInfo(Handler h) ;
1572
1573    /**
1574     * Register for CDMA number information record notification from the network.
1575     * Message.obj will contain an AsyncResult.
1576     * AsyncResult.result will be a CdmaInformationRecords.CdmaNumberInfoRec
1577     * instance.
1578     *
1579     * @param h Handler that receives the notification message.
1580     * @param what User-defined message code.
1581     * @param obj User object.
1582     */
1583    void registerForNumberInfo(Handler h, int what, Object obj);
1584
1585    /**
1586     * Unregisters for number information record notifications.
1587     * Extraneous calls are tolerated silently
1588     *
1589     * @param h Handler to be removed from the registrant list.
1590     */
1591    void unregisterForNumberInfo(Handler h);
1592
1593    /**
1594     * Register for CDMA redirected number information record notification
1595     * from the network.
1596     * Message.obj will contain an AsyncResult.
1597     * AsyncResult.result will be a CdmaInformationRecords.CdmaRedirectingNumberInfoRec
1598     * instance.
1599     *
1600     * @param h Handler that receives the notification message.
1601     * @param what User-defined message code.
1602     * @param obj User object.
1603     */
1604    void registerForRedirectedNumberInfo(Handler h, int what, Object obj);
1605
1606    /**
1607     * Unregisters for redirected number information record notification.
1608     * Extraneous calls are tolerated silently
1609     *
1610     * @param h Handler to be removed from the registrant list.
1611     */
1612    void unregisterForRedirectedNumberInfo(Handler h);
1613
1614    /**
1615     * Register for CDMA line control information record notification
1616     * from the network.
1617     * Message.obj will contain an AsyncResult.
1618     * AsyncResult.result will be a CdmaInformationRecords.CdmaLineControlInfoRec
1619     * instance.
1620     *
1621     * @param h Handler that receives the notification message.
1622     * @param what User-defined message code.
1623     * @param obj User object.
1624     */
1625    void registerForLineControlInfo(Handler h, int what, Object obj);
1626
1627    /**
1628     * Unregisters for line control information notifications.
1629     * Extraneous calls are tolerated silently
1630     *
1631     * @param h Handler to be removed from the registrant list.
1632     */
1633    void unregisterForLineControlInfo(Handler h);
1634
1635    /**
1636     * Register for CDMA T53 CLIR information record notifications
1637     * from the network.
1638     * Message.obj will contain an AsyncResult.
1639     * AsyncResult.result will be a CdmaInformationRecords.CdmaT53ClirInfoRec
1640     * instance.
1641     *
1642     * @param h Handler that receives the notification message.
1643     * @param what User-defined message code.
1644     * @param obj User object.
1645     */
1646    void registerFoT53ClirlInfo(Handler h, int what, Object obj);
1647
1648    /**
1649     * Unregisters for T53 CLIR information record notification
1650     * Extraneous calls are tolerated silently
1651     *
1652     * @param h Handler to be removed from the registrant list.
1653     */
1654    void unregisterForT53ClirInfo(Handler h);
1655
1656    /**
1657     * Register for CDMA T53 audio control information record notifications
1658     * from the network.
1659     * Message.obj will contain an AsyncResult.
1660     * AsyncResult.result will be a CdmaInformationRecords.CdmaT53AudioControlInfoRec
1661     * instance.
1662     *
1663     * @param h Handler that receives the notification message.
1664     * @param what User-defined message code.
1665     * @param obj User object.
1666     */
1667    void registerForT53AudioControlInfo(Handler h, int what, Object obj);
1668
1669    /**
1670     * Unregisters for T53 audio control information record notifications.
1671     * Extraneous calls are tolerated silently
1672     *
1673     * @param h Handler to be removed from the registrant list.
1674     */
1675    void unregisterForT53AudioControlInfo(Handler h);
1676
1677    /**
1678     * registers for exit emergency call back mode request response
1679     *
1680     * @param h Handler that receives the notification message.
1681     * @param what User-defined message code.
1682     * @param obj User object.
1683     */
1684
1685    void setOnEcbModeExitResponse(Handler h, int what, Object obj);
1686
1687    /**
1688     * Unregisters for exit emergency call back mode request response
1689     *
1690     * @param h Handler to be removed from the registrant list.
1691     */
1692    void unsetOnEcbModeExitResponse(Handler h);
1693
1694
1695}
1696