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