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