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