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