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