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.LinkProperties;
     21 import android.net.NetworkCapabilities;
     22 import android.os.Bundle;
     23 import android.os.Handler;
     24 import android.os.Message;
     25 import android.telephony.CellInfo;
     26 import android.telephony.CellLocation;
     27 import android.telephony.CarrierConfigManager;
     28 import android.telephony.PhoneStateListener;
     29 import android.telephony.ServiceState;
     30 import android.telephony.SignalStrength;
     31 
     32 import com.android.internal.telephony.imsphone.ImsPhone;
     33 import com.android.internal.telephony.RadioCapability;
     34 import com.android.internal.telephony.test.SimulatedRadioControl;
     35 import com.android.internal.telephony.uicc.IsimRecords;
     36 import com.android.internal.telephony.uicc.UiccCard;
     37 import com.android.internal.telephony.uicc.UsimServiceTable;
     38 
     39 import com.android.internal.telephony.PhoneConstants.*; // ????
     40 
     41 import java.util.List;
     42 import java.util.Locale;
     43 
     44 /**
     45  * Internal interface used to control the phone; SDK developers cannot
     46  * obtain this interface.
     47  *
     48  * {@hide}
     49  *
     50  */
     51 public interface PhoneInternalInterface {
     52 
     53     /** used to enable additional debug messages */
     54     static final boolean DEBUG_PHONE = true;
     55 
     56     public enum DataActivityState {
     57         /**
     58          * The state of a data activity.
     59          * <ul>
     60          * <li>NONE = No traffic</li>
     61          * <li>DATAIN = Receiving IP ppp traffic</li>
     62          * <li>DATAOUT = Sending IP ppp traffic</li>
     63          * <li>DATAINANDOUT = Both receiving and sending IP ppp traffic</li>
     64          * <li>DORMANT = The data connection is still active,
     65                                      but physical link is down</li>
     66          * </ul>
     67          */
     68         NONE, DATAIN, DATAOUT, DATAINANDOUT, DORMANT;
     69     }
     70 
     71     enum SuppService {
     72       UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP, RESUME, HOLD;
     73     }
     74 
     75     // "Features" accessible through the connectivity manager
     76     static final String FEATURE_ENABLE_MMS = "enableMMS";
     77     static final String FEATURE_ENABLE_SUPL = "enableSUPL";
     78     static final String FEATURE_ENABLE_DUN = "enableDUN";
     79     static final String FEATURE_ENABLE_HIPRI = "enableHIPRI";
     80     static final String FEATURE_ENABLE_DUN_ALWAYS = "enableDUNAlways";
     81     static final String FEATURE_ENABLE_FOTA = "enableFOTA";
     82     static final String FEATURE_ENABLE_IMS = "enableIMS";
     83     static final String FEATURE_ENABLE_CBS = "enableCBS";
     84     static final String FEATURE_ENABLE_EMERGENCY = "enableEmergency";
     85 
     86     /**
     87      * Optional reasons for disconnect and connect
     88      */
     89     static final String REASON_ROAMING_ON = "roamingOn";
     90     static final String REASON_ROAMING_OFF = "roamingOff";
     91     static final String REASON_DATA_DISABLED = "dataDisabled";
     92     static final String REASON_DATA_ENABLED = "dataEnabled";
     93     static final String REASON_DATA_ATTACHED = "dataAttached";
     94     static final String REASON_DATA_DETACHED = "dataDetached";
     95     static final String REASON_CDMA_DATA_ATTACHED = "cdmaDataAttached";
     96     static final String REASON_CDMA_DATA_DETACHED = "cdmaDataDetached";
     97     static final String REASON_APN_CHANGED = "apnChanged";
     98     static final String REASON_APN_SWITCHED = "apnSwitched";
     99     static final String REASON_APN_FAILED = "apnFailed";
    100     static final String REASON_RESTORE_DEFAULT_APN = "restoreDefaultApn";
    101     static final String REASON_RADIO_TURNED_OFF = "radioTurnedOff";
    102     static final String REASON_PDP_RESET = "pdpReset";
    103     static final String REASON_VOICE_CALL_ENDED = "2GVoiceCallEnded";
    104     static final String REASON_VOICE_CALL_STARTED = "2GVoiceCallStarted";
    105     static final String REASON_PS_RESTRICT_ENABLED = "psRestrictEnabled";
    106     static final String REASON_PS_RESTRICT_DISABLED = "psRestrictDisabled";
    107     static final String REASON_SIM_LOADED = "simLoaded";
    108     static final String REASON_NW_TYPE_CHANGED = "nwTypeChanged";
    109     static final String REASON_DATA_DEPENDENCY_MET = "dependencyMet";
    110     static final String REASON_DATA_DEPENDENCY_UNMET = "dependencyUnmet";
    111     static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection";
    112     static final String REASON_CONNECTED = "connected";
    113     static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
    114     static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled";
    115     static final String REASON_SIM_NOT_READY = "simNotReady";
    116     static final String REASON_IWLAN_AVAILABLE = "iwlanAvailable";
    117     static final String REASON_CARRIER_CHANGE = "carrierChange";
    118 
    119     // Used for band mode selection methods
    120     static final int BM_UNSPECIFIED = RILConstants.BAND_MODE_UNSPECIFIED; // automatic
    121     static final int BM_EURO_BAND   = RILConstants.BAND_MODE_EURO;
    122     static final int BM_US_BAND     = RILConstants.BAND_MODE_USA;
    123     static final int BM_JPN_BAND    = RILConstants.BAND_MODE_JPN;
    124     static final int BM_AUS_BAND    = RILConstants.BAND_MODE_AUS;
    125     static final int BM_AUS2_BAND   = RILConstants.BAND_MODE_AUS_2;
    126     static final int BM_CELL_800    = RILConstants.BAND_MODE_CELL_800;
    127     static final int BM_PCS         = RILConstants.BAND_MODE_PCS;
    128     static final int BM_JTACS       = RILConstants.BAND_MODE_JTACS;
    129     static final int BM_KOREA_PCS   = RILConstants.BAND_MODE_KOREA_PCS;
    130     static final int BM_4_450M      = RILConstants.BAND_MODE_5_450M;
    131     static final int BM_IMT2000     = RILConstants.BAND_MODE_IMT2000;
    132     static final int BM_7_700M2     = RILConstants.BAND_MODE_7_700M_2;
    133     static final int BM_8_1800M     = RILConstants.BAND_MODE_8_1800M;
    134     static final int BM_9_900M      = RILConstants.BAND_MODE_9_900M;
    135     static final int BM_10_800M_2   = RILConstants.BAND_MODE_10_800M_2;
    136     static final int BM_EURO_PAMR   = RILConstants.BAND_MODE_EURO_PAMR_400M;
    137     static final int BM_AWS         = RILConstants.BAND_MODE_AWS;
    138     static final int BM_US_2500M    = RILConstants.BAND_MODE_USA_2500M;
    139     static final int BM_NUM_BAND_MODES = 19; //Total number of band modes
    140 
    141     // Used for preferred network type
    142     // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
    143     int NT_MODE_WCDMA_PREF   = RILConstants.NETWORK_MODE_WCDMA_PREF;
    144     int NT_MODE_GSM_ONLY     = RILConstants.NETWORK_MODE_GSM_ONLY;
    145     int NT_MODE_WCDMA_ONLY   = RILConstants.NETWORK_MODE_WCDMA_ONLY;
    146     int NT_MODE_GSM_UMTS     = RILConstants.NETWORK_MODE_GSM_UMTS;
    147 
    148     int NT_MODE_CDMA         = RILConstants.NETWORK_MODE_CDMA;
    149 
    150     int NT_MODE_CDMA_NO_EVDO = RILConstants.NETWORK_MODE_CDMA_NO_EVDO;
    151     int NT_MODE_EVDO_NO_CDMA = RILConstants.NETWORK_MODE_EVDO_NO_CDMA;
    152     int NT_MODE_GLOBAL       = RILConstants.NETWORK_MODE_GLOBAL;
    153 
    154     int NT_MODE_LTE_CDMA_AND_EVDO        = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO;
    155     int NT_MODE_LTE_GSM_WCDMA            = RILConstants.NETWORK_MODE_LTE_GSM_WCDMA;
    156     int NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA  = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA;
    157     int NT_MODE_LTE_ONLY                 = RILConstants.NETWORK_MODE_LTE_ONLY;
    158     int NT_MODE_LTE_WCDMA                = RILConstants.NETWORK_MODE_LTE_WCDMA;
    159 
    160     int NT_MODE_TDSCDMA_ONLY            = RILConstants.NETWORK_MODE_TDSCDMA_ONLY;
    161     int NT_MODE_TDSCDMA_WCDMA           = RILConstants.NETWORK_MODE_TDSCDMA_WCDMA;
    162     int NT_MODE_LTE_TDSCDMA             = RILConstants.NETWORK_MODE_LTE_TDSCDMA;
    163     int NT_MODE_TDSCDMA_GSM             = RILConstants.NETWORK_MODE_TDSCDMA_GSM;
    164     int NT_MODE_LTE_TDSCDMA_GSM         = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM;
    165     int NT_MODE_TDSCDMA_GSM_WCDMA       = RILConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA;
    166     int NT_MODE_LTE_TDSCDMA_WCDMA       = RILConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA;
    167     int NT_MODE_LTE_TDSCDMA_GSM_WCDMA   = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA;
    168     int NT_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = RILConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
    169     int NT_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = RILConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
    170 
    171     int PREFERRED_NT_MODE                = RILConstants.PREFERRED_NETWORK_MODE;
    172 
    173     // Used for CDMA roaming mode
    174     // Home Networks only, as defined in PRL
    175     static final int CDMA_RM_HOME        = CarrierConfigManager.CDMA_ROAMING_MODE_HOME;
    176     // Roaming an Affiliated networks, as defined in PRL
    177     static final int CDMA_RM_AFFILIATED  = CarrierConfigManager.CDMA_ROAMING_MODE_AFFILIATED;
    178     // Roaming on Any Network, as defined in PRL
    179     static final int CDMA_RM_ANY         = CarrierConfigManager.CDMA_ROAMING_MODE_ANY;
    180 
    181     // Used for CDMA subscription mode
    182     static final int CDMA_SUBSCRIPTION_UNKNOWN  =-1; // Unknown
    183     static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0; // RUIM/SIM (default)
    184     static final int CDMA_SUBSCRIPTION_NV       = 1; // NV -> non-volatile memory
    185 
    186     static final int PREFERRED_CDMA_SUBSCRIPTION = CDMA_SUBSCRIPTION_NV;
    187 
    188     static final int TTY_MODE_OFF = 0;
    189     static final int TTY_MODE_FULL = 1;
    190     static final int TTY_MODE_HCO = 2;
    191     static final int TTY_MODE_VCO = 3;
    192 
    193      /**
    194      * CDMA OTA PROVISION STATUS, the same as RIL_CDMA_OTA_Status in ril.h
    195      */
    196 
    197     public static final int CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED = 0;
    198     public static final int CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED = 1;
    199     public static final int CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED = 2;
    200     public static final int CDMA_OTA_PROVISION_STATUS_SSD_UPDATED = 3;
    201     public static final int CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED = 4;
    202     public static final int CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED = 5;
    203     public static final int CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED = 6;
    204     public static final int CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED = 7;
    205     public static final int CDMA_OTA_PROVISION_STATUS_COMMITTED = 8;
    206     public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED = 9;
    207     public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10;
    208     public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11;
    209 
    210 
    211     /**
    212      * Get the current ServiceState. Use
    213      * <code>registerForServiceStateChanged</code> to be informed of
    214      * updates.
    215      */
    216     ServiceState getServiceState();
    217 
    218     /**
    219      * Get the current CellLocation.
    220      */
    221     CellLocation getCellLocation();
    222 
    223     /**
    224      * Get the current DataState. No change notification exists at this
    225      * interface -- use
    226      * {@link android.telephony.PhoneStateListener} instead.
    227      * @param apnType specify for which apn to get connection state info.
    228      */
    229     DataState getDataConnectionState(String apnType);
    230 
    231     /**
    232      * Get the current DataActivityState. No change notification exists at this
    233      * interface -- use
    234      * {@link android.telephony.TelephonyManager} instead.
    235      */
    236     DataActivityState getDataActivityState();
    237 
    238     /**
    239      * Returns a list of MMI codes that are pending. (They have initiated
    240      * but have not yet completed).
    241      * Presently there is only ever one.
    242      * Use <code>registerForMmiInitiate</code>
    243      * and <code>registerForMmiComplete</code> for change notification.
    244      */
    245     public List<? extends MmiCode> getPendingMmiCodes();
    246 
    247     /**
    248      * Sends user response to a USSD REQUEST message.  An MmiCode instance
    249      * representing this response is sent to handlers registered with
    250      * registerForMmiInitiate.
    251      *
    252      * @param ussdMessge    Message to send in the response.
    253      */
    254     public void sendUssdResponse(String ussdMessge);
    255 
    256     /**
    257      * Register for Supplementary Service notifications from the network.
    258      * Message.obj will contain an AsyncResult.
    259      * AsyncResult.result will be a SuppServiceNotification instance.
    260      *
    261      * @param h Handler that receives the notification message.
    262      * @param what User-defined message code.
    263      * @param obj User object.
    264      */
    265     void registerForSuppServiceNotification(Handler h, int what, Object obj);
    266 
    267     /**
    268      * Unregisters for Supplementary Service notifications.
    269      * Extraneous calls are tolerated silently
    270      *
    271      * @param h Handler to be removed from the registrant list.
    272      */
    273     void unregisterForSuppServiceNotification(Handler h);
    274 
    275     /**
    276      * Answers a ringing or waiting call. Active calls, if any, go on hold.
    277      * Answering occurs asynchronously, and final notification occurs via
    278      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    279      * java.lang.Object) registerForPreciseCallStateChanged()}.
    280      *
    281      * @param videoState The video state in which to answer the call.
    282      * @exception CallStateException when no call is ringing or waiting
    283      */
    284     void acceptCall(int videoState) throws CallStateException;
    285 
    286     /**
    287      * Reject (ignore) a ringing call. In GSM, this means UDUB
    288      * (User Determined User Busy). Reject occurs asynchronously,
    289      * and final notification occurs via
    290      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    291      * java.lang.Object) registerForPreciseCallStateChanged()}.
    292      *
    293      * @exception CallStateException when no call is ringing or waiting
    294      */
    295     void rejectCall() throws CallStateException;
    296 
    297     /**
    298      * Places any active calls on hold, and makes any held calls
    299      *  active. Switch occurs asynchronously and may fail.
    300      * Final notification occurs via
    301      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    302      * java.lang.Object) registerForPreciseCallStateChanged()}.
    303      *
    304      * @exception CallStateException if a call is ringing, waiting, or
    305      * dialing/alerting. In these cases, this operation may not be performed.
    306      */
    307     void switchHoldingAndActive() throws CallStateException;
    308 
    309     /**
    310      * Whether or not the phone can conference in the current phone
    311      * state--that is, one call holding and one call active.
    312      * @return true if the phone can conference; false otherwise.
    313      */
    314     boolean canConference();
    315 
    316     /**
    317      * Conferences holding and active. Conference occurs asynchronously
    318      * and may fail. Final notification occurs via
    319      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    320      * java.lang.Object) registerForPreciseCallStateChanged()}.
    321      *
    322      * @exception CallStateException if canConference() would return false.
    323      * In these cases, this operation may not be performed.
    324      */
    325     void conference() throws CallStateException;
    326 
    327     /**
    328      * Whether or not the phone can do explicit call transfer in the current
    329      * phone state--that is, one call holding and one call active.
    330      * @return true if the phone can do explicit call transfer; false otherwise.
    331      */
    332     boolean canTransfer();
    333 
    334     /**
    335      * Connects the two calls and disconnects the subscriber from both calls
    336      * Explicit Call Transfer occurs asynchronously
    337      * and may fail. Final notification occurs via
    338      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    339      * java.lang.Object) registerForPreciseCallStateChanged()}.
    340      *
    341      * @exception CallStateException if canTransfer() would return false.
    342      * In these cases, this operation may not be performed.
    343      */
    344     void explicitCallTransfer() throws CallStateException;
    345 
    346     /**
    347      * Clears all DISCONNECTED connections from Call connection lists.
    348      * Calls that were in the DISCONNECTED state become idle. This occurs
    349      * synchronously.
    350      */
    351     void clearDisconnected();
    352 
    353     /**
    354      * Gets the foreground call object, which represents all connections that
    355      * are dialing or active (all connections
    356      * that have their audio path connected).<p>
    357      *
    358      * The foreground call is a singleton object. It is constant for the life
    359      * of this phone. It is never null.<p>
    360      *
    361      * The foreground call will only ever be in one of these states:
    362      * IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED.
    363      *
    364      * State change notification is available via
    365      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    366      * java.lang.Object) registerForPreciseCallStateChanged()}.
    367      */
    368     Call getForegroundCall();
    369 
    370     /**
    371      * Gets the background call object, which represents all connections that
    372      * are holding (all connections that have been accepted or connected, but
    373      * do not have their audio path connected). <p>
    374      *
    375      * The background call is a singleton object. It is constant for the life
    376      * of this phone object . It is never null.<p>
    377      *
    378      * The background call will only ever be in one of these states:
    379      * IDLE, HOLDING or DISCONNECTED.
    380      *
    381      * State change notification is available via
    382      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    383      * java.lang.Object) registerForPreciseCallStateChanged()}.
    384      */
    385     Call getBackgroundCall();
    386 
    387     /**
    388      * Gets the ringing call object, which represents an incoming
    389      * connection (if present) that is pending answer/accept. (This connection
    390      * may be RINGING or WAITING, and there may be only one.)<p>
    391 
    392      * The ringing call is a singleton object. It is constant for the life
    393      * of this phone. It is never null.<p>
    394      *
    395      * The ringing call will only ever be in one of these states:
    396      * IDLE, INCOMING, WAITING or DISCONNECTED.
    397      *
    398      * State change notification is available via
    399      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    400      * java.lang.Object) registerForPreciseCallStateChanged()}.
    401      */
    402     Call getRingingCall();
    403 
    404     /**
    405      * Initiate a new voice connection. This happens asynchronously, so you
    406      * cannot assume the audio path is connected (or a call index has been
    407      * assigned) until PhoneStateChanged notification has occurred.
    408      *
    409      * @param dialString The dial string.
    410      * @param videoState The desired video state for the connection.
    411      * @exception CallStateException if a new outgoing call is not currently
    412      * possible because no more call slots exist or a call exists that is
    413      * dialing, alerting, ringing, or waiting.  Other errors are
    414      * handled asynchronously.
    415      */
    416     Connection dial(String dialString, int videoState) throws CallStateException;
    417 
    418     /**
    419      * Initiate a new voice connection with supplementary User to User
    420      * Information. This happens asynchronously, so you cannot assume the audio
    421      * path is connected (or a call index has been assigned) until
    422      * PhoneStateChanged notification has occurred.
    423      *
    424      * NOTE: If adding another parameter, consider creating a DialArgs parameter instead to
    425      * encapsulate all dial arguments and decrease scaffolding headache.
    426      *
    427      * @param dialString The dial string.
    428      * @param uusInfo The UUSInfo.
    429      * @param videoState The desired video state for the connection.
    430      * @param intentExtras The extras from the original CALL intent.
    431      * @exception CallStateException if a new outgoing call is not currently
    432      *                possible because no more call slots exist or a call exists
    433      *                that is dialing, alerting, ringing, or waiting. Other
    434      *                errors are handled asynchronously.
    435      */
    436     Connection dial(String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)
    437             throws CallStateException;
    438 
    439     /**
    440      * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
    441      * without SEND (so <code>dial</code> is not appropriate).
    442      *
    443      * @param dialString the MMI command to be executed.
    444      * @return true if MMI command is executed.
    445      */
    446     boolean handlePinMmi(String dialString);
    447 
    448     /**
    449      * Handles in-call MMI commands. While in a call, or while receiving a
    450      * call, use this to execute MMI commands.
    451      * see 3GPP 20.030, section 6.5.5.1 for specs on the allowed MMI commands.
    452      *
    453      * @param command the MMI command to be executed.
    454      * @return true if the MMI command is executed.
    455      * @throws CallStateException
    456      */
    457     boolean handleInCallMmiCommands(String command) throws CallStateException;
    458 
    459     /**
    460      * Play a DTMF tone on the active call. Ignored if there is no active call.
    461      * @param c should be one of 0-9, '*' or '#'. Other values will be
    462      * silently ignored.
    463      */
    464     void sendDtmf(char c);
    465 
    466     /**
    467      * Start to paly a DTMF tone on the active call. Ignored if there is no active call
    468      * or there is a playing DTMF tone.
    469      * @param c should be one of 0-9, '*' or '#'. Other values will be
    470      * silently ignored.
    471      */
    472     void startDtmf(char c);
    473 
    474     /**
    475      * Stop the playing DTMF tone. Ignored if there is no playing DTMF
    476      * tone or no active call.
    477      */
    478     void stopDtmf();
    479 
    480     /**
    481      * Sets the radio power on/off state (off is sometimes
    482      * called "airplane mode"). Current state can be gotten via
    483      * {@link #getServiceState()}.{@link
    484      * android.telephony.ServiceState#getState() getState()}.
    485      * <strong>Note: </strong>This request is asynchronous.
    486      * getServiceState().getState() will not change immediately after this call.
    487      * registerForServiceStateChanged() to find out when the
    488      * request is complete.
    489      *
    490      * @param power true means "on", false means "off".
    491      */
    492     void setRadioPower(boolean power);
    493 
    494     /**
    495      * Get the line 1 phone number (MSISDN). For CDMA phones, the MDN is returned
    496      * and {@link #getMsisdn()} will return the MSISDN on CDMA/LTE phones.<p>
    497      *
    498      * @return phone number. May return null if not
    499      * available or the SIM is not ready
    500      */
    501     String getLine1Number();
    502 
    503     /**
    504      * Returns the alpha tag associated with the msisdn number.
    505      * If there is no alpha tag associated or the record is not yet available,
    506      * returns a default localized string. <p>
    507      */
    508     String getLine1AlphaTag();
    509 
    510     /**
    511      * Sets the MSISDN phone number in the SIM card.
    512      *
    513      * @param alphaTag the alpha tag associated with the MSISDN phone number
    514      *        (see getMsisdnAlphaTag)
    515      * @param number the new MSISDN phone number to be set on the SIM.
    516      * @param onComplete a callback message when the action is completed.
    517      *
    518      * @return true if req is sent, false otherwise. If req is not sent there will be no response,
    519      * that is, onComplete will never be sent.
    520      */
    521     boolean setLine1Number(String alphaTag, String number, Message onComplete);
    522 
    523     /**
    524      * Get the voice mail access phone number. Typically dialed when the
    525      * user holds the "1" key in the phone app. May return null if not
    526      * available or the SIM is not ready.<p>
    527      */
    528     String getVoiceMailNumber();
    529 
    530     /**
    531      * Returns the alpha tag associated with the voice mail number.
    532      * If there is no alpha tag associated or the record is not yet available,
    533      * returns a default localized string. <p>
    534      *
    535      * Please use this value instead of some other localized string when
    536      * showing a name for this number in the UI. For example, call log
    537      * entries should show this alpha tag. <p>
    538      *
    539      * Usage of this alpha tag in the UI is a common carrier requirement.
    540      */
    541     String getVoiceMailAlphaTag();
    542 
    543     /**
    544      * setVoiceMailNumber
    545      * sets the voicemail number in the SIM card.
    546      *
    547      * @param alphaTag the alpha tag associated with the voice mail number
    548      *        (see getVoiceMailAlphaTag)
    549      * @param voiceMailNumber the new voicemail number to be set on the SIM.
    550      * @param onComplete a callback message when the action is completed.
    551      */
    552     void setVoiceMailNumber(String alphaTag,
    553                             String voiceMailNumber,
    554                             Message onComplete);
    555 
    556     /**
    557      * getCallForwardingOptions
    558      * gets a call forwarding option. The return value of
    559      * ((AsyncResult)onComplete.obj) is an array of CallForwardInfo.
    560      *
    561      * @param commandInterfaceCFReason is one of the valid call forwarding
    562      *        CF_REASONS, as defined in
    563      *        <code>com.android.internal.telephony.CommandsInterface.</code>
    564      * @param onComplete a callback message when the action is completed.
    565      *        @see com.android.internal.telephony.CallForwardInfo for details.
    566      */
    567     void getCallForwardingOption(int commandInterfaceCFReason,
    568                                   Message onComplete);
    569 
    570     /**
    571      * setCallForwardingOptions
    572      * sets a call forwarding option.
    573      *
    574      * @param commandInterfaceCFReason is one of the valid call forwarding
    575      *        CF_REASONS, as defined in
    576      *        <code>com.android.internal.telephony.CommandsInterface.</code>
    577      * @param commandInterfaceCFAction is one of the valid call forwarding
    578      *        CF_ACTIONS, as defined in
    579      *        <code>com.android.internal.telephony.CommandsInterface.</code>
    580      * @param dialingNumber is the target phone number to forward calls to
    581      * @param timerSeconds is used by CFNRy to indicate the timeout before
    582      *        forwarding is attempted.
    583      * @param onComplete a callback message when the action is completed.
    584      */
    585     void setCallForwardingOption(int commandInterfaceCFReason,
    586                                  int commandInterfaceCFAction,
    587                                  String dialingNumber,
    588                                  int timerSeconds,
    589                                  Message onComplete);
    590 
    591     /**
    592      * getOutgoingCallerIdDisplay
    593      * gets outgoing caller id display. The return value of
    594      * ((AsyncResult)onComplete.obj) is an array of int, with a length of 2.
    595      *
    596      * @param onComplete a callback message when the action is completed.
    597      *        @see com.android.internal.telephony.CommandsInterface#getCLIR for details.
    598      */
    599     void getOutgoingCallerIdDisplay(Message onComplete);
    600 
    601     /**
    602      * setOutgoingCallerIdDisplay
    603      * sets a call forwarding option.
    604      *
    605      * @param commandInterfaceCLIRMode is one of the valid call CLIR
    606      *        modes, as defined in
    607      *        <code>com.android.internal.telephony.CommandsInterface./code>
    608      * @param onComplete a callback message when the action is completed.
    609      */
    610     void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
    611                                     Message onComplete);
    612 
    613     /**
    614      * getCallWaiting
    615      * gets call waiting activation state. The return value of
    616      * ((AsyncResult)onComplete.obj) is an array of int, with a length of 1.
    617      *
    618      * @param onComplete a callback message when the action is completed.
    619      *        @see com.android.internal.telephony.CommandsInterface#queryCallWaiting for details.
    620      */
    621     void getCallWaiting(Message onComplete);
    622 
    623     /**
    624      * setCallWaiting
    625      * sets a call forwarding option.
    626      *
    627      * @param enable is a boolean representing the state that you are
    628      *        requesting, true for enabled, false for disabled.
    629      * @param onComplete a callback message when the action is completed.
    630      */
    631     void setCallWaiting(boolean enable, Message onComplete);
    632 
    633     /**
    634      * Scan available networks. This method is asynchronous; .
    635      * On completion, <code>response.obj</code> is set to an AsyncResult with
    636      * one of the following members:.<p>
    637      *<ul>
    638      * <li><code>response.obj.result</code> will be a <code>List</code> of
    639      * <code>OperatorInfo</code> objects, or</li>
    640      * <li><code>response.obj.exception</code> will be set with an exception
    641      * on failure.</li>
    642      * </ul>
    643      */
    644     void getAvailableNetworks(Message response);
    645 
    646     /**
    647      * Query neighboring cell IDs.  <code>response</code> is dispatched when
    648      * this is complete.  <code>response.obj</code> will be an AsyncResult,
    649      * and <code>response.obj.exception</code> will be non-null on failure.
    650      * On success, <code>AsyncResult.result</code> will be a <code>String[]</code>
    651      * containing the neighboring cell IDs.  Index 0 will contain the count
    652      * of available cell IDs.  Cell IDs are in hexadecimal format.
    653      *
    654      * @param response callback message that is dispatched when the query
    655      * completes.
    656      */
    657     void getNeighboringCids(Message response);
    658 
    659     /**
    660      * Mutes or unmutes the microphone for the active call. The microphone
    661      * is automatically unmuted if a call is answered, dialed, or resumed
    662      * from a holding state.
    663      *
    664      * @param muted true to mute the microphone,
    665      * false to activate the microphone.
    666      */
    667 
    668     void setMute(boolean muted);
    669 
    670     /**
    671      * Gets current mute status. Use
    672      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
    673      * java.lang.Object) registerForPreciseCallStateChanged()}
    674      * as a change notifcation, although presently phone state changed is not
    675      * fired when setMute() is called.
    676      *
    677      * @return true is muting, false is unmuting
    678      */
    679     boolean getMute();
    680 
    681     /**
    682      * Get the current active Data Call list
    683      *
    684      * @param response <strong>On success</strong>, "response" bytes is
    685      * made available as:
    686      * (String[])(((AsyncResult)response.obj).result).
    687      * <strong>On failure</strong>,
    688      * (((AsyncResult)response.obj).result) == null and
    689      * (((AsyncResult)response.obj).exception) being an instance of
    690      * com.android.internal.telephony.gsm.CommandException
    691      */
    692     void getDataCallList(Message response);
    693 
    694     /**
    695      * Update the ServiceState CellLocation for current network registration.
    696      */
    697     void updateServiceLocation();
    698 
    699     /**
    700      * Enable location update notifications.
    701      */
    702     void enableLocationUpdates();
    703 
    704     /**
    705      * Disable location update notifications.
    706      */
    707     void disableLocationUpdates();
    708 
    709     /**
    710      * @return true if enable data connection on roaming
    711      */
    712     boolean getDataRoamingEnabled();
    713 
    714     /**
    715      * @param enable set true if enable data connection on roaming
    716      */
    717     void setDataRoamingEnabled(boolean enable);
    718 
    719     /**
    720      * @return true if user has enabled data
    721      */
    722     boolean getDataEnabled();
    723 
    724     /**
    725      * @param @enable set {@code true} if enable data connection
    726      */
    727     void setDataEnabled(boolean enable);
    728 
    729     /**
    730      * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones.
    731      */
    732     String getDeviceId();
    733 
    734     /**
    735      * Retrieves the software version number for the device, e.g., IMEI/SV
    736      * for GSM phones.
    737      */
    738     String getDeviceSvn();
    739 
    740     /**
    741      * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones.
    742      */
    743     String getSubscriberId();
    744 
    745     /**
    746      * Retrieves the Group Identifier Level1 for GSM phones.
    747      */
    748     String getGroupIdLevel1();
    749 
    750     /**
    751      * Retrieves the Group Identifier Level2 for phones.
    752      */
    753     String getGroupIdLevel2();
    754 
    755     /* CDMA support methods */
    756 
    757     /**
    758      * Retrieves the ESN for CDMA phones.
    759      */
    760     String getEsn();
    761 
    762     /**
    763      * Retrieves MEID for CDMA phones.
    764      */
    765     String getMeid();
    766 
    767     /**
    768      * Retrieves IMEI for phones. Returns null if IMEI is not set.
    769      */
    770     String getImei();
    771 
    772     /**
    773      * Retrieves the IccPhoneBookInterfaceManager of the Phone
    774      */
    775     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager();
    776 
    777     /**
    778      * Activate or deactivate cell broadcast SMS.
    779      *
    780      * @param activate
    781      *            0 = activate, 1 = deactivate
    782      * @param response
    783      *            Callback message is empty on completion
    784      */
    785     void activateCellBroadcastSms(int activate, Message response);
    786 
    787     /**
    788      * Query the current configuration of cdma cell broadcast SMS.
    789      *
    790      * @param response
    791      *            Callback message is empty on completion
    792      */
    793     void getCellBroadcastSmsConfig(Message response);
    794 
    795     /**
    796      * Configure cell broadcast SMS.
    797      *
    798      * TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig
    799      *
    800      * @param response
    801      *            Callback message is empty on completion
    802      */
    803     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response);
    804 }
    805