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