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