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