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