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