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