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