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.os.Bundle;
20 import android.os.Handler;
21 import android.os.Message;
22 import android.os.WorkSource;
23 import android.os.ResultReceiver;
24 import android.telephony.CellLocation;
25 import android.telephony.CarrierConfigManager;
26 import android.telephony.ServiceState;
27 
28 import com.android.internal.telephony.PhoneConstants.*; // ????
29 
30 import java.util.List;
31 
32 /**
33  * Internal interface used to control the phone; SDK developers cannot
34  * obtain this interface.
35  *
36  * {@hide}
37  *
38  */
39 public interface PhoneInternalInterface {
40 
41     /** used to enable additional debug messages */
42     static final boolean DEBUG_PHONE = true;
43 
44     public enum DataActivityState {
45         /**
46          * The state of a data activity.
47          * <ul>
48          * <li>NONE = No traffic</li>
49          * <li>DATAIN = Receiving IP ppp traffic</li>
50          * <li>DATAOUT = Sending IP ppp traffic</li>
51          * <li>DATAINANDOUT = Both receiving and sending IP ppp traffic</li>
52          * <li>DORMANT = The data connection is still active,
53                                      but physical link is down</li>
54          * </ul>
55          */
56         NONE, DATAIN, DATAOUT, DATAINANDOUT, DORMANT;
57     }
58 
59     enum SuppService {
60       UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP, RESUME, HOLD;
61     }
62 
63     // "Features" accessible through the connectivity manager
64     static final String FEATURE_ENABLE_MMS = "enableMMS";
65     static final String FEATURE_ENABLE_SUPL = "enableSUPL";
66     static final String FEATURE_ENABLE_DUN = "enableDUN";
67     static final String FEATURE_ENABLE_HIPRI = "enableHIPRI";
68     static final String FEATURE_ENABLE_DUN_ALWAYS = "enableDUNAlways";
69     static final String FEATURE_ENABLE_FOTA = "enableFOTA";
70     static final String FEATURE_ENABLE_IMS = "enableIMS";
71     static final String FEATURE_ENABLE_CBS = "enableCBS";
72     static final String FEATURE_ENABLE_EMERGENCY = "enableEmergency";
73 
74     /**
75      * Optional reasons for disconnect and connect
76      */
77     static final String REASON_ROAMING_ON = "roamingOn";
78     static final String REASON_ROAMING_OFF = "roamingOff";
79     static final String REASON_DATA_DISABLED = "dataDisabled";
80     static final String REASON_DATA_ENABLED = "dataEnabled";
81     static final String REASON_DATA_ATTACHED = "dataAttached";
82     static final String REASON_DATA_DETACHED = "dataDetached";
83     static final String REASON_CDMA_DATA_ATTACHED = "cdmaDataAttached";
84     static final String REASON_CDMA_DATA_DETACHED = "cdmaDataDetached";
85     static final String REASON_APN_CHANGED = "apnChanged";
86     static final String REASON_APN_SWITCHED = "apnSwitched";
87     static final String REASON_APN_FAILED = "apnFailed";
88     static final String REASON_RESTORE_DEFAULT_APN = "restoreDefaultApn";
89     static final String REASON_RADIO_TURNED_OFF = "radioTurnedOff";
90     static final String REASON_PDP_RESET = "pdpReset";
91     static final String REASON_VOICE_CALL_ENDED = "2GVoiceCallEnded";
92     static final String REASON_VOICE_CALL_STARTED = "2GVoiceCallStarted";
93     static final String REASON_PS_RESTRICT_ENABLED = "psRestrictEnabled";
94     static final String REASON_PS_RESTRICT_DISABLED = "psRestrictDisabled";
95     static final String REASON_SIM_LOADED = "simLoaded";
96     static final String REASON_NW_TYPE_CHANGED = "nwTypeChanged";
97     static final String REASON_DATA_DEPENDENCY_MET = "dependencyMet";
98     static final String REASON_DATA_DEPENDENCY_UNMET = "dependencyUnmet";
99     static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection";
100     static final String REASON_CONNECTED = "connected";
101     static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
102     static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled";
103     static final String REASON_SIM_NOT_READY = "simNotReady";
104     static final String REASON_IWLAN_AVAILABLE = "iwlanAvailable";
105     static final String REASON_CARRIER_CHANGE = "carrierChange";
106     static final String REASON_CARRIER_ACTION_DISABLE_METERED_APN =
107             "carrierActionDisableMeteredApn";
108 
109     // Used for band mode selection methods
110     static final int BM_UNSPECIFIED = RILConstants.BAND_MODE_UNSPECIFIED; // automatic
111     static final int BM_EURO_BAND   = RILConstants.BAND_MODE_EURO;
112     static final int BM_US_BAND     = RILConstants.BAND_MODE_USA;
113     static final int BM_JPN_BAND    = RILConstants.BAND_MODE_JPN;
114     static final int BM_AUS_BAND    = RILConstants.BAND_MODE_AUS;
115     static final int BM_AUS2_BAND   = RILConstants.BAND_MODE_AUS_2;
116     static final int BM_CELL_800    = RILConstants.BAND_MODE_CELL_800;
117     static final int BM_PCS         = RILConstants.BAND_MODE_PCS;
118     static final int BM_JTACS       = RILConstants.BAND_MODE_JTACS;
119     static final int BM_KOREA_PCS   = RILConstants.BAND_MODE_KOREA_PCS;
120     static final int BM_4_450M      = RILConstants.BAND_MODE_5_450M;
121     static final int BM_IMT2000     = RILConstants.BAND_MODE_IMT2000;
122     static final int BM_7_700M2     = RILConstants.BAND_MODE_7_700M_2;
123     static final int BM_8_1800M     = RILConstants.BAND_MODE_8_1800M;
124     static final int BM_9_900M      = RILConstants.BAND_MODE_9_900M;
125     static final int BM_10_800M_2   = RILConstants.BAND_MODE_10_800M_2;
126     static final int BM_EURO_PAMR   = RILConstants.BAND_MODE_EURO_PAMR_400M;
127     static final int BM_AWS         = RILConstants.BAND_MODE_AWS;
128     static final int BM_US_2500M    = RILConstants.BAND_MODE_USA_2500M;
129     static final int BM_NUM_BAND_MODES = 19; //Total number of band modes
130 
131     // Used for preferred network type
132     // Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
133     int NT_MODE_WCDMA_PREF   = RILConstants.NETWORK_MODE_WCDMA_PREF;
134     int NT_MODE_GSM_ONLY     = RILConstants.NETWORK_MODE_GSM_ONLY;
135     int NT_MODE_WCDMA_ONLY   = RILConstants.NETWORK_MODE_WCDMA_ONLY;
136     int NT_MODE_GSM_UMTS     = RILConstants.NETWORK_MODE_GSM_UMTS;
137 
138     int NT_MODE_CDMA         = RILConstants.NETWORK_MODE_CDMA;
139 
140     int NT_MODE_CDMA_NO_EVDO = RILConstants.NETWORK_MODE_CDMA_NO_EVDO;
141     int NT_MODE_EVDO_NO_CDMA = RILConstants.NETWORK_MODE_EVDO_NO_CDMA;
142     int NT_MODE_GLOBAL       = RILConstants.NETWORK_MODE_GLOBAL;
143 
144     int NT_MODE_LTE_CDMA_AND_EVDO        = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO;
145     int NT_MODE_LTE_GSM_WCDMA            = RILConstants.NETWORK_MODE_LTE_GSM_WCDMA;
146     int NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA  = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA;
147     int NT_MODE_LTE_ONLY                 = RILConstants.NETWORK_MODE_LTE_ONLY;
148     int NT_MODE_LTE_WCDMA                = RILConstants.NETWORK_MODE_LTE_WCDMA;
149 
150     int NT_MODE_TDSCDMA_ONLY            = RILConstants.NETWORK_MODE_TDSCDMA_ONLY;
151     int NT_MODE_TDSCDMA_WCDMA           = RILConstants.NETWORK_MODE_TDSCDMA_WCDMA;
152     int NT_MODE_LTE_TDSCDMA             = RILConstants.NETWORK_MODE_LTE_TDSCDMA;
153     int NT_MODE_TDSCDMA_GSM             = RILConstants.NETWORK_MODE_TDSCDMA_GSM;
154     int NT_MODE_LTE_TDSCDMA_GSM         = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM;
155     int NT_MODE_TDSCDMA_GSM_WCDMA       = RILConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA;
156     int NT_MODE_LTE_TDSCDMA_WCDMA       = RILConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA;
157     int NT_MODE_LTE_TDSCDMA_GSM_WCDMA   = RILConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA;
158     int NT_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = RILConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
159     int NT_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = RILConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
160 
161     int PREFERRED_NT_MODE                = RILConstants.PREFERRED_NETWORK_MODE;
162 
163     // Used for CDMA roaming mode
164     // Home Networks only, as defined in PRL
165     static final int CDMA_RM_HOME        = CarrierConfigManager.CDMA_ROAMING_MODE_HOME;
166     // Roaming an Affiliated networks, as defined in PRL
167     static final int CDMA_RM_AFFILIATED  = CarrierConfigManager.CDMA_ROAMING_MODE_AFFILIATED;
168     // Roaming on Any Network, as defined in PRL
169     static final int CDMA_RM_ANY         = CarrierConfigManager.CDMA_ROAMING_MODE_ANY;
170 
171     // Used for CDMA subscription mode
172     static final int CDMA_SUBSCRIPTION_UNKNOWN  =-1; // Unknown
173     static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0; // RUIM/SIM (default)
174     static final int CDMA_SUBSCRIPTION_NV       = 1; // NV -> non-volatile memory
175 
176     static final int PREFERRED_CDMA_SUBSCRIPTION = CDMA_SUBSCRIPTION_NV;
177 
178     static final int TTY_MODE_OFF = 0;
179     static final int TTY_MODE_FULL = 1;
180     static final int TTY_MODE_HCO = 2;
181     static final int TTY_MODE_VCO = 3;
182 
183      /**
184      * CDMA OTA PROVISION STATUS, the same as RIL_CDMA_OTA_Status in ril.h
185      */
186 
187     public static final int CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED = 0;
188     public static final int CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED = 1;
189     public static final int CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED = 2;
190     public static final int CDMA_OTA_PROVISION_STATUS_SSD_UPDATED = 3;
191     public static final int CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED = 4;
192     public static final int CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED = 5;
193     public static final int CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED = 6;
194     public static final int CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED = 7;
195     public static final int CDMA_OTA_PROVISION_STATUS_COMMITTED = 8;
196     public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED = 9;
197     public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10;
198     public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11;
199 
200 
201     /**
202      * Get the current ServiceState. Use
203      * <code>registerForServiceStateChanged</code> to be informed of
204      * updates.
205      */
getServiceState()206     ServiceState getServiceState();
207 
208     /**
209      * Get the current CellLocation.
210      * @param workSource calling WorkSource
211      */
getCellLocation(WorkSource workSource)212     CellLocation getCellLocation(WorkSource workSource);
213 
214     /**
215      * Get the current DataState. No change notification exists at this
216      * interface -- use
217      * {@link android.telephony.PhoneStateListener} instead.
218      * @param apnType specify for which apn to get connection state info.
219      */
getDataConnectionState(String apnType)220     DataState getDataConnectionState(String apnType);
221 
222     /**
223      * Get the current DataActivityState. No change notification exists at this
224      * interface -- use
225      * {@link android.telephony.TelephonyManager} instead.
226      */
getDataActivityState()227     DataActivityState getDataActivityState();
228 
229     /**
230      * Returns a list of MMI codes that are pending. (They have initiated
231      * but have not yet completed).
232      * Presently there is only ever one.
233      * Use <code>registerForMmiInitiate</code>
234      * and <code>registerForMmiComplete</code> for change notification.
235      */
getPendingMmiCodes()236     public List<? extends MmiCode> getPendingMmiCodes();
237 
238     /**
239      * Sends user response to a USSD REQUEST message.  An MmiCode instance
240      * representing this response is sent to handlers registered with
241      * registerForMmiInitiate.
242      *
243      * @param ussdMessge    Message to send in the response.
244      */
sendUssdResponse(String ussdMessge)245     public void sendUssdResponse(String ussdMessge);
246 
247     /**
248      * Register for Supplementary Service notifications from the network.
249      * Message.obj will contain an AsyncResult.
250      * AsyncResult.result will be a SuppServiceNotification instance.
251      *
252      * @param h Handler that receives the notification message.
253      * @param what User-defined message code.
254      * @param obj User object.
255      */
registerForSuppServiceNotification(Handler h, int what, Object obj)256     void registerForSuppServiceNotification(Handler h, int what, Object obj);
257 
258     /**
259      * Unregisters for Supplementary Service notifications.
260      * Extraneous calls are tolerated silently
261      *
262      * @param h Handler to be removed from the registrant list.
263      */
unregisterForSuppServiceNotification(Handler h)264     void unregisterForSuppServiceNotification(Handler h);
265 
266     /**
267      * Answers a ringing or waiting call. Active calls, if any, go on hold.
268      * Answering occurs asynchronously, and final notification occurs via
269      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
270      * java.lang.Object) registerForPreciseCallStateChanged()}.
271      *
272      * @param videoState The video state in which to answer the call.
273      * @exception CallStateException when no call is ringing or waiting
274      */
acceptCall(int videoState)275     void acceptCall(int videoState) throws CallStateException;
276 
277     /**
278      * Reject (ignore) a ringing call. In GSM, this means UDUB
279      * (User Determined User Busy). Reject occurs asynchronously,
280      * and final notification occurs via
281      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
282      * java.lang.Object) registerForPreciseCallStateChanged()}.
283      *
284      * @exception CallStateException when no call is ringing or waiting
285      */
rejectCall()286     void rejectCall() throws CallStateException;
287 
288     /**
289      * Places any active calls on hold, and makes any held calls
290      *  active. Switch occurs asynchronously and may fail.
291      * Final notification occurs via
292      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
293      * java.lang.Object) registerForPreciseCallStateChanged()}.
294      *
295      * @exception CallStateException if a call is ringing, waiting, or
296      * dialing/alerting. In these cases, this operation may not be performed.
297      */
switchHoldingAndActive()298     void switchHoldingAndActive() throws CallStateException;
299 
300     /**
301      * Whether or not the phone can conference in the current phone
302      * state--that is, one call holding and one call active.
303      * @return true if the phone can conference; false otherwise.
304      */
canConference()305     boolean canConference();
306 
307     /**
308      * Conferences holding and active. Conference occurs asynchronously
309      * and may fail. Final notification occurs via
310      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
311      * java.lang.Object) registerForPreciseCallStateChanged()}.
312      *
313      * @exception CallStateException if canConference() would return false.
314      * In these cases, this operation may not be performed.
315      */
conference()316     void conference() throws CallStateException;
317 
318     /**
319      * Whether or not the phone can do explicit call transfer in the current
320      * phone state--that is, one call holding and one call active.
321      * @return true if the phone can do explicit call transfer; false otherwise.
322      */
canTransfer()323     boolean canTransfer();
324 
325     /**
326      * Connects the two calls and disconnects the subscriber from both calls
327      * Explicit Call Transfer occurs asynchronously
328      * and may fail. Final notification occurs via
329      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
330      * java.lang.Object) registerForPreciseCallStateChanged()}.
331      *
332      * @exception CallStateException if canTransfer() would return false.
333      * In these cases, this operation may not be performed.
334      */
explicitCallTransfer()335     void explicitCallTransfer() throws CallStateException;
336 
337     /**
338      * Clears all DISCONNECTED connections from Call connection lists.
339      * Calls that were in the DISCONNECTED state become idle. This occurs
340      * synchronously.
341      */
clearDisconnected()342     void clearDisconnected();
343 
344     /**
345      * Gets the foreground call object, which represents all connections that
346      * are dialing or active (all connections
347      * that have their audio path connected).<p>
348      *
349      * The foreground call is a singleton object. It is constant for the life
350      * of this phone. It is never null.<p>
351      *
352      * The foreground call will only ever be in one of these states:
353      * IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED.
354      *
355      * State change notification is available via
356      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
357      * java.lang.Object) registerForPreciseCallStateChanged()}.
358      */
getForegroundCall()359     Call getForegroundCall();
360 
361     /**
362      * Gets the background call object, which represents all connections that
363      * are holding (all connections that have been accepted or connected, but
364      * do not have their audio path connected). <p>
365      *
366      * The background call is a singleton object. It is constant for the life
367      * of this phone object . It is never null.<p>
368      *
369      * The background call will only ever be in one of these states:
370      * IDLE, HOLDING or DISCONNECTED.
371      *
372      * State change notification is available via
373      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
374      * java.lang.Object) registerForPreciseCallStateChanged()}.
375      */
getBackgroundCall()376     Call getBackgroundCall();
377 
378     /**
379      * Gets the ringing call object, which represents an incoming
380      * connection (if present) that is pending answer/accept. (This connection
381      * may be RINGING or WAITING, and there may be only one.)<p>
382 
383      * The ringing call is a singleton object. It is constant for the life
384      * of this phone. It is never null.<p>
385      *
386      * The ringing call will only ever be in one of these states:
387      * IDLE, INCOMING, WAITING or DISCONNECTED.
388      *
389      * State change notification is available via
390      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
391      * java.lang.Object) registerForPreciseCallStateChanged()}.
392      */
getRingingCall()393     Call getRingingCall();
394 
395     /**
396      * Initiate a new voice connection. This happens asynchronously, so you
397      * cannot assume the audio path is connected (or a call index has been
398      * assigned) until PhoneStateChanged notification has occurred.
399      *
400      * @param dialString The dial string.
401      * @param videoState The desired video state for the connection.
402      * @exception CallStateException if a new outgoing call is not currently
403      * possible because no more call slots exist or a call exists that is
404      * dialing, alerting, ringing, or waiting.  Other errors are
405      * handled asynchronously.
406      */
dial(String dialString, int videoState)407     Connection dial(String dialString, int videoState) throws CallStateException;
408 
409     /**
410      * Initiate a new voice connection with supplementary User to User
411      * Information. This happens asynchronously, so you cannot assume the audio
412      * path is connected (or a call index has been assigned) until
413      * PhoneStateChanged notification has occurred.
414      *
415      * NOTE: If adding another parameter, consider creating a DialArgs parameter instead to
416      * encapsulate all dial arguments and decrease scaffolding headache.
417      *
418      * @param dialString The dial string.
419      * @param uusInfo The UUSInfo.
420      * @param videoState The desired video state for the connection.
421      * @param intentExtras The extras from the original CALL intent.
422      * @exception CallStateException if a new outgoing call is not currently
423      *                possible because no more call slots exist or a call exists
424      *                that is dialing, alerting, ringing, or waiting. Other
425      *                errors are handled asynchronously.
426      */
dial(String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)427     Connection dial(String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)
428             throws CallStateException;
429 
430     /**
431      * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated
432      * without SEND (so <code>dial</code> is not appropriate).
433      *
434      * @param dialString the MMI command to be executed.
435      * @return true if MMI command is executed.
436      */
handlePinMmi(String dialString)437     boolean handlePinMmi(String dialString);
438 
439     /**
440      * Handles USSD commands
441      *
442      * @param ussdRequest the USSD command to be executed.
443      * @param wrappedCallback receives the callback result.
444      */
handleUssdRequest(String ussdRequest, ResultReceiver wrappedCallback)445     boolean handleUssdRequest(String ussdRequest, ResultReceiver wrappedCallback)
446             throws CallStateException;
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      */
handleInCallMmiCommands(String command)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      */
sendDtmf(char c)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      */
startDtmf(char c)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      */
stopDtmf()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      */
setRadioPower(boolean power)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      */
getLine1Number()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      */
getLine1AlphaTag()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      */
setLine1Number(String alphaTag, String number, Message onComplete)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      */
getVoiceMailNumber()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      */
getVoiceMailAlphaTag()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      */
setVoiceMailNumber(String alphaTag, String voiceMailNumber, Message onComplete)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      */
getCallForwardingOption(int commandInterfaceCFReason, Message onComplete)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      */
setCallForwardingOption(int commandInterfaceCFReason, int commandInterfaceCFAction, String dialingNumber, int timerSeconds, Message onComplete)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      */
getOutgoingCallerIdDisplay(Message onComplete)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      */
setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete)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      */
getCallWaiting(Message onComplete)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      */
setCallWaiting(boolean enable, Message onComplete)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      */
getAvailableNetworks(Message response)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      * @param workSource calling WorkSource
657      */
getNeighboringCids(Message response, WorkSource workSource)658     default void getNeighboringCids(Message response, WorkSource workSource){}
659 
660     /**
661      * Mutes or unmutes the microphone for the active call. The microphone
662      * is automatically unmuted if a call is answered, dialed, or resumed
663      * from a holding state.
664      *
665      * @param muted true to mute the microphone,
666      * false to activate the microphone.
667      */
668 
setMute(boolean muted)669     void setMute(boolean muted);
670 
671     /**
672      * Gets current mute status. Use
673      * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
674      * java.lang.Object) registerForPreciseCallStateChanged()}
675      * as a change notifcation, although presently phone state changed is not
676      * fired when setMute() is called.
677      *
678      * @return true is muting, false is unmuting
679      */
getMute()680     boolean getMute();
681 
682     /**
683      * Get the current active Data Call list
684      *
685      * @param response <strong>On success</strong>, "response" bytes is
686      * made available as:
687      * (String[])(((AsyncResult)response.obj).result).
688      * <strong>On failure</strong>,
689      * (((AsyncResult)response.obj).result) == null and
690      * (((AsyncResult)response.obj).exception) being an instance of
691      * com.android.internal.telephony.gsm.CommandException
692      */
getDataCallList(Message response)693     void getDataCallList(Message response);
694 
695     /**
696      * Update the ServiceState CellLocation for current network registration.
697      */
updateServiceLocation()698     void updateServiceLocation();
699 
700     /**
701      * Enable location update notifications.
702      */
enableLocationUpdates()703     void enableLocationUpdates();
704 
705     /**
706      * Disable location update notifications.
707      */
disableLocationUpdates()708     void disableLocationUpdates();
709 
710     /**
711      * @return true if enable data connection on roaming
712      */
getDataRoamingEnabled()713     boolean getDataRoamingEnabled();
714 
715     /**
716      * @param enable set true if enable data connection on roaming
717      */
setDataRoamingEnabled(boolean enable)718     void setDataRoamingEnabled(boolean enable);
719 
720     /**
721      * @return true if user has enabled data
722      */
getDataEnabled()723     boolean getDataEnabled();
724 
725     /**
726      * @param @enable set {@code true} if enable data connection
727      */
setDataEnabled(boolean enable)728     void setDataEnabled(boolean enable);
729 
730     /**
731      * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones.
732      */
getDeviceId()733     String getDeviceId();
734 
735     /**
736      * Retrieves the software version number for the device, e.g., IMEI/SV
737      * for GSM phones.
738      */
getDeviceSvn()739     String getDeviceSvn();
740 
741     /**
742      * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones.
743      */
getSubscriberId()744     String getSubscriberId();
745 
746     /**
747      * Retrieves the Group Identifier Level1 for GSM phones.
748      */
getGroupIdLevel1()749     String getGroupIdLevel1();
750 
751     /**
752      * Retrieves the Group Identifier Level2 for phones.
753      */
getGroupIdLevel2()754     String getGroupIdLevel2();
755 
756     /* CDMA support methods */
757 
758     /**
759      * Retrieves the ESN for CDMA phones.
760      */
getEsn()761     String getEsn();
762 
763     /**
764      * Retrieves MEID for CDMA phones.
765      */
getMeid()766     String getMeid();
767 
768     /**
769      * Retrieves IMEI for phones. Returns null if IMEI is not set.
770      */
getImei()771     String getImei();
772 
773     /**
774      * Retrieves the IccPhoneBookInterfaceManager of the Phone
775      */
getIccPhoneBookInterfaceManager()776     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager();
777 
778     /**
779      * Activate or deactivate cell broadcast SMS.
780      *
781      * @param activate
782      *            0 = activate, 1 = deactivate
783      * @param response
784      *            Callback message is empty on completion
785      */
activateCellBroadcastSms(int activate, Message response)786     void activateCellBroadcastSms(int activate, Message response);
787 
788     /**
789      * Query the current configuration of cdma cell broadcast SMS.
790      *
791      * @param response
792      *            Callback message is empty on completion
793      */
getCellBroadcastSmsConfig(Message response)794     void getCellBroadcastSmsConfig(Message response);
795 
796     /**
797      * Configure cell broadcast SMS.
798      *
799      * TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig
800      *
801      * @param response
802      *            Callback message is empty on completion
803      */
setCellBroadcastSmsConfig(int[] configValuesArray, Message response)804     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response);
805 }
806