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