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