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