1 /* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.internal.telephony; 18 19 import android.content.Context; 20 import android.net.LinkProperties; 21 import android.net.NetworkCapabilities; 22 import android.os.Handler; 23 import android.os.Message; 24 import android.telephony.CellInfo; 25 import android.telephony.CellLocation; 26 import android.telephony.PhoneStateListener; 27 import android.telephony.ServiceState; 28 import android.telephony.SignalStrength; 29 30 import com.android.internal.telephony.imsphone.ImsPhone; 31 import com.android.internal.telephony.test.SimulatedRadioControl; 32 import com.android.internal.telephony.uicc.IsimRecords; 33 import com.android.internal.telephony.uicc.UiccCard; 34 import com.android.internal.telephony.uicc.UsimServiceTable; 35 36 import com.android.internal.telephony.PhoneConstants.*; // ???? 37 38 import 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 */ 47 public 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 * Notifies when a Handover happens due to SRVCC or Silent Redial 319 */ 320 void registerForHandoverStateChanged(Handler h, int what, Object obj); 321 322 /** 323 * Unregisters for handover state notifications 324 */ 325 void unregisterForHandoverStateChanged(Handler h); 326 327 /** 328 * Register for getting notifications for change in the Call State {@link Call.State} 329 * This is called PreciseCallState because the call state is more precise than the 330 * {@link PhoneConstants.State} which can be obtained using the {@link PhoneStateListener} 331 * 332 * Resulting events will have an AsyncResult in <code>Message.obj</code>. 333 * AsyncResult.userData will be set to the obj argument here. 334 * The <em>h</em> parameter is held only by a weak reference. 335 */ 336 void registerForPreciseCallStateChanged(Handler h, int what, Object obj); 337 338 /** 339 * Unregisters for voice call state change notifications. 340 * Extraneous calls are tolerated silently. 341 */ 342 void unregisterForPreciseCallStateChanged(Handler h); 343 344 /** 345 * Notifies when a new ringing or waiting connection has appeared.<p> 346 * 347 * Messages received from this: 348 * Message.obj will be an AsyncResult 349 * AsyncResult.userObj = obj 350 * AsyncResult.result = a Connection. <p> 351 * Please check Connection.isRinging() to make sure the Connection 352 * has not dropped since this message was posted. 353 * If Connection.isRinging() is true, then 354 * Connection.getCall() == Phone.getRingingCall() 355 */ 356 void registerForNewRingingConnection(Handler h, int what, Object obj); 357 358 /** 359 * Unregisters for new ringing connection notification. 360 * Extraneous calls are tolerated silently 361 */ 362 363 void unregisterForNewRingingConnection(Handler h); 364 365 /** 366 * Notifies when an incoming call rings.<p> 367 * 368 * Messages received from this: 369 * Message.obj will be an AsyncResult 370 * AsyncResult.userObj = obj 371 * AsyncResult.result = a Connection. <p> 372 */ 373 void registerForIncomingRing(Handler h, int what, Object obj); 374 375 /** 376 * Unregisters for ring notification. 377 * Extraneous calls are tolerated silently 378 */ 379 380 void unregisterForIncomingRing(Handler h); 381 382 /** 383 * Notifies when out-band ringback tone is needed.<p> 384 * 385 * Messages received from this: 386 * Message.obj will be an AsyncResult 387 * AsyncResult.userObj = obj 388 * AsyncResult.result = boolean, true to start play ringback tone 389 * and false to stop. <p> 390 */ 391 void registerForRingbackTone(Handler h, int what, Object obj); 392 393 /** 394 * Unregisters for ringback tone notification. 395 */ 396 397 void unregisterForRingbackTone(Handler h); 398 399 /** 400 * Notifies when out-band on-hold tone is needed.<p> 401 * 402 * Messages received from this: 403 * Message.obj will be an AsyncResult 404 * AsyncResult.userObj = obj 405 * AsyncResult.result = boolean, true to start play on-hold tone 406 * and false to stop. <p> 407 */ 408 void registerForOnHoldTone(Handler h, int what, Object obj); 409 410 /** 411 * Unregisters for on-hold tone notification. 412 */ 413 414 void unregisterForOnHoldTone(Handler h); 415 416 /** 417 * Registers the handler to reset the uplink mute state to get 418 * uplink audio. 419 */ 420 void registerForResendIncallMute(Handler h, int what, Object obj); 421 422 /** 423 * Unregisters for resend incall mute notifications. 424 */ 425 void unregisterForResendIncallMute(Handler h); 426 427 /** 428 * Notifies when a voice connection has disconnected, either due to local 429 * or remote hangup or error. 430 * 431 * Messages received from this will have the following members:<p> 432 * <ul><li>Message.obj will be an AsyncResult</li> 433 * <li>AsyncResult.userObj = obj</li> 434 * <li>AsyncResult.result = a Connection object that is 435 * no longer connected.</li></ul> 436 */ 437 void registerForDisconnect(Handler h, int what, Object obj); 438 439 /** 440 * Unregisters for voice disconnection notification. 441 * Extraneous calls are tolerated silently 442 */ 443 void unregisterForDisconnect(Handler h); 444 445 446 /** 447 * Register for notifications of initiation of a new MMI code request. 448 * MMI codes for GSM are discussed in 3GPP TS 22.030.<p> 449 * 450 * Example: If Phone.dial is called with "*#31#", then the app will 451 * be notified here.<p> 452 * 453 * The returned <code>Message.obj</code> will contain an AsyncResult. 454 * 455 * <code>obj.result</code> will be an "MmiCode" object. 456 */ 457 void registerForMmiInitiate(Handler h, int what, Object obj); 458 459 /** 460 * Unregisters for new MMI initiate notification. 461 * Extraneous calls are tolerated silently 462 */ 463 void unregisterForMmiInitiate(Handler h); 464 465 /** 466 * Register for notifications that an MMI request has completed 467 * its network activity and is in its final state. This may mean a state 468 * of COMPLETE, FAILED, or CANCELLED. 469 * 470 * <code>Message.obj</code> will contain an AsyncResult. 471 * <code>obj.result</code> will be an "MmiCode" object 472 */ 473 void registerForMmiComplete(Handler h, int what, Object obj); 474 475 /** 476 * Unregisters for MMI complete notification. 477 * Extraneous calls are tolerated silently 478 */ 479 void unregisterForMmiComplete(Handler h); 480 481 /** 482 * Registration point for Ecm timer reset 483 * @param h handler to notify 484 * @param what user-defined message code 485 * @param obj placed in Message.obj 486 */ 487 public void registerForEcmTimerReset(Handler h, int what, Object obj); 488 489 /** 490 * Unregister for notification for Ecm timer reset 491 * @param h Handler to be removed from the registrant list. 492 */ 493 public void unregisterForEcmTimerReset(Handler h); 494 495 /** 496 * Returns a list of MMI codes that are pending. (They have initiated 497 * but have not yet completed). 498 * Presently there is only ever one. 499 * Use <code>registerForMmiInitiate</code> 500 * and <code>registerForMmiComplete</code> for change notification. 501 */ 502 public List<? extends MmiCode> getPendingMmiCodes(); 503 504 /** 505 * Sends user response to a USSD REQUEST message. An MmiCode instance 506 * representing this response is sent to handlers registered with 507 * registerForMmiInitiate. 508 * 509 * @param ussdMessge Message to send in the response. 510 */ 511 public void sendUssdResponse(String ussdMessge); 512 513 /** 514 * Register for ServiceState changed. 515 * Message.obj will contain an AsyncResult. 516 * AsyncResult.result will be a ServiceState instance 517 */ 518 void registerForServiceStateChanged(Handler h, int what, Object obj); 519 520 /** 521 * Unregisters for ServiceStateChange notification. 522 * Extraneous calls are tolerated silently 523 */ 524 void unregisterForServiceStateChanged(Handler h); 525 526 /** 527 * Register for Supplementary Service notifications from the network. 528 * Message.obj will contain an AsyncResult. 529 * AsyncResult.result will be a SuppServiceNotification instance. 530 * 531 * @param h Handler that receives the notification message. 532 * @param what User-defined message code. 533 * @param obj User object. 534 */ 535 void registerForSuppServiceNotification(Handler h, int what, Object obj); 536 537 /** 538 * Unregisters for Supplementary Service notifications. 539 * Extraneous calls are tolerated silently 540 * 541 * @param h Handler to be removed from the registrant list. 542 */ 543 void unregisterForSuppServiceNotification(Handler h); 544 545 /** 546 * Register for notifications when a supplementary service attempt fails. 547 * Message.obj will contain an AsyncResult. 548 * 549 * @param h Handler that receives the notification message. 550 * @param what User-defined message code. 551 * @param obj User object. 552 */ 553 void registerForSuppServiceFailed(Handler h, int what, Object obj); 554 555 /** 556 * Unregister for notifications when a supplementary service attempt fails. 557 * Extraneous calls are tolerated silently 558 * 559 * @param h Handler to be removed from the registrant list. 560 */ 561 void unregisterForSuppServiceFailed(Handler h); 562 563 /** 564 * Register for notifications when a sInCall VoicePrivacy is enabled 565 * 566 * @param h Handler that receives the notification message. 567 * @param what User-defined message code. 568 * @param obj User object. 569 */ 570 void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj); 571 572 /** 573 * Unegister for notifications when a sInCall VoicePrivacy is enabled 574 * 575 * @param h Handler to be removed from the registrant list. 576 */ 577 void unregisterForInCallVoicePrivacyOn(Handler h); 578 579 /** 580 * Register for notifications when a sInCall VoicePrivacy is disabled 581 * 582 * @param h Handler that receives the notification message. 583 * @param what User-defined message code. 584 * @param obj User object. 585 */ 586 void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj); 587 588 /** 589 * Unregister for notifications when a sInCall VoicePrivacy is disabled 590 * 591 * @param h Handler to be removed from the registrant list. 592 */ 593 void unregisterForInCallVoicePrivacyOff(Handler h); 594 595 /** 596 * Register for notifications when CDMA OTA Provision status change 597 * 598 * @param h Handler that receives the notification message. 599 * @param what User-defined message code. 600 * @param obj User object. 601 */ 602 void registerForCdmaOtaStatusChange(Handler h, int what, Object obj); 603 604 /** 605 * Unregister for notifications when CDMA OTA Provision status change 606 * @param h Handler to be removed from the registrant list. 607 */ 608 void unregisterForCdmaOtaStatusChange(Handler h); 609 610 /** 611 * Registration point for subscription info ready 612 * @param h handler to notify 613 * @param what what code of message when delivered 614 * @param obj placed in Message.obj 615 */ 616 public void registerForSubscriptionInfoReady(Handler h, int what, Object obj); 617 618 /** 619 * Unregister for notifications for subscription info 620 * @param h Handler to be removed from the registrant list. 621 */ 622 public void unregisterForSubscriptionInfoReady(Handler h); 623 624 /** 625 * Registration point for Sim records loaded 626 * @param h handler to notify 627 * @param what what code of message when delivered 628 * @param obj placed in Message.obj 629 */ 630 public void registerForSimRecordsLoaded(Handler h, int what, Object obj); 631 632 /** 633 * Unregister for notifications for Sim records loaded 634 * @param h Handler to be removed from the registrant list. 635 */ 636 public void unregisterForSimRecordsLoaded(Handler h); 637 638 /** 639 * Returns SIM record load state. Use 640 * <code>getSimCard().registerForReady()</code> for change notification. 641 * 642 * @return true if records from the SIM have been loaded and are 643 * available (if applicable). If not applicable to the underlying 644 * technology, returns true as well. 645 */ 646 boolean getIccRecordsLoaded(); 647 648 /** 649 * Returns the ICC card interface for this phone, or null 650 * if not applicable to underlying technology. 651 */ 652 IccCard getIccCard(); 653 654 /** 655 * Answers a ringing or waiting call. Active calls, if any, go on hold. 656 * Answering occurs asynchronously, and final notification occurs via 657 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 658 * java.lang.Object) registerForPreciseCallStateChanged()}. 659 * 660 * @param videoState The video state in which to answer the call. 661 * @exception CallStateException when no call is ringing or waiting 662 */ 663 void acceptCall(int videoState) throws CallStateException; 664 665 /** 666 * Reject (ignore) a ringing call. In GSM, this means UDUB 667 * (User Determined User Busy). Reject occurs asynchronously, 668 * and final notification occurs via 669 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 670 * java.lang.Object) registerForPreciseCallStateChanged()}. 671 * 672 * @exception CallStateException when no call is ringing or waiting 673 */ 674 void rejectCall() throws CallStateException; 675 676 /** 677 * Places any active calls on hold, and makes any held calls 678 * active. Switch occurs asynchronously and may fail. 679 * Final notification occurs via 680 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 681 * java.lang.Object) registerForPreciseCallStateChanged()}. 682 * 683 * @exception CallStateException if a call is ringing, waiting, or 684 * dialing/alerting. In these cases, this operation may not be performed. 685 */ 686 void switchHoldingAndActive() throws CallStateException; 687 688 /** 689 * Whether or not the phone can conference in the current phone 690 * state--that is, one call holding and one call active. 691 * @return true if the phone can conference; false otherwise. 692 */ 693 boolean canConference(); 694 695 /** 696 * Conferences holding and active. Conference occurs asynchronously 697 * and may fail. Final notification occurs via 698 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 699 * java.lang.Object) registerForPreciseCallStateChanged()}. 700 * 701 * @exception CallStateException if canConference() would return false. 702 * In these cases, this operation may not be performed. 703 */ 704 void conference() throws CallStateException; 705 706 /** 707 * Enable or disable enhanced Voice Privacy (VP). If enhanced VP is 708 * disabled, normal VP is enabled. 709 * 710 * @param enable whether true or false to enable or disable. 711 * @param onComplete a callback message when the action is completed. 712 */ 713 void enableEnhancedVoicePrivacy(boolean enable, Message onComplete); 714 715 /** 716 * Get the currently set Voice Privacy (VP) mode. 717 * 718 * @param onComplete a callback message when the action is completed. 719 */ 720 void getEnhancedVoicePrivacy(Message onComplete); 721 722 /** 723 * Whether or not the phone can do explicit call transfer in the current 724 * phone state--that is, one call holding and one call active. 725 * @return true if the phone can do explicit call transfer; false otherwise. 726 */ 727 boolean canTransfer(); 728 729 /** 730 * Connects the two calls and disconnects the subscriber from both calls 731 * Explicit Call Transfer occurs asynchronously 732 * and may fail. Final notification occurs via 733 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 734 * java.lang.Object) registerForPreciseCallStateChanged()}. 735 * 736 * @exception CallStateException if canTransfer() would return false. 737 * In these cases, this operation may not be performed. 738 */ 739 void explicitCallTransfer() throws CallStateException; 740 741 /** 742 * Clears all DISCONNECTED connections from Call connection lists. 743 * Calls that were in the DISCONNECTED state become idle. This occurs 744 * synchronously. 745 */ 746 void clearDisconnected(); 747 748 749 /** 750 * Gets the foreground call object, which represents all connections that 751 * are dialing or active (all connections 752 * that have their audio path connected).<p> 753 * 754 * The foreground call is a singleton object. It is constant for the life 755 * of this phone. It is never null.<p> 756 * 757 * The foreground call will only ever be in one of these states: 758 * IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED. 759 * 760 * State change notification is available via 761 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 762 * java.lang.Object) registerForPreciseCallStateChanged()}. 763 */ 764 Call getForegroundCall(); 765 766 /** 767 * Gets the background call object, which represents all connections that 768 * are holding (all connections that have been accepted or connected, but 769 * do not have their audio path connected). <p> 770 * 771 * The background call is a singleton object. It is constant for the life 772 * of this phone object . It is never null.<p> 773 * 774 * The background call will only ever be in one of these states: 775 * IDLE, HOLDING or DISCONNECTED. 776 * 777 * State change notification is available via 778 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 779 * java.lang.Object) registerForPreciseCallStateChanged()}. 780 */ 781 Call getBackgroundCall(); 782 783 /** 784 * Gets the ringing call object, which represents an incoming 785 * connection (if present) that is pending answer/accept. (This connection 786 * may be RINGING or WAITING, and there may be only one.)<p> 787 788 * The ringing call is a singleton object. It is constant for the life 789 * of this phone. It is never null.<p> 790 * 791 * The ringing call will only ever be in one of these states: 792 * IDLE, INCOMING, WAITING or DISCONNECTED. 793 * 794 * State change notification is available via 795 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 796 * java.lang.Object) registerForPreciseCallStateChanged()}. 797 */ 798 Call getRingingCall(); 799 800 /** 801 * Initiate a new voice connection. This happens asynchronously, so you 802 * cannot assume the audio path is connected (or a call index has been 803 * assigned) until PhoneStateChanged notification has occurred. 804 * 805 * @param dialString The dial string. 806 * @param videoState The desired video state for the connection. 807 * @exception CallStateException if a new outgoing call is not currently 808 * possible because no more call slots exist or a call exists that is 809 * dialing, alerting, ringing, or waiting. Other errors are 810 * handled asynchronously. 811 */ 812 Connection dial(String dialString, int videoState) throws CallStateException; 813 814 /** 815 * Initiate a new voice connection with supplementary User to User 816 * Information. This happens asynchronously, so you cannot assume the audio 817 * path is connected (or a call index has been assigned) until 818 * PhoneStateChanged notification has occurred. 819 * 820 * @param dialString The dial string. 821 * @param uusInfo The UUSInfo. 822 * @param videoState The desired video state for the connection. 823 * @exception CallStateException if a new outgoing call is not currently 824 * possible because no more call slots exist or a call exists 825 * that is dialing, alerting, ringing, or waiting. Other 826 * errors are handled asynchronously. 827 */ 828 Connection dial(String dialString, UUSInfo uusInfo, int videoState) throws CallStateException; 829 830 /** 831 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 832 * without SEND (so <code>dial</code> is not appropriate). 833 * 834 * @param dialString the MMI command to be executed. 835 * @return true if MMI command is executed. 836 */ 837 boolean handlePinMmi(String dialString); 838 839 /** 840 * Handles in-call MMI commands. While in a call, or while receiving a 841 * call, use this to execute MMI commands. 842 * see 3GPP 20.030, section 6.5.5.1 for specs on the allowed MMI commands. 843 * 844 * @param command the MMI command to be executed. 845 * @return true if the MMI command is executed. 846 * @throws CallStateException 847 */ 848 boolean handleInCallMmiCommands(String command) throws CallStateException; 849 850 /** 851 * Play a DTMF tone on the active call. Ignored if there is no active call. 852 * @param c should be one of 0-9, '*' or '#'. Other values will be 853 * silently ignored. 854 */ 855 void sendDtmf(char c); 856 857 /** 858 * Start to paly a DTMF tone on the active call. Ignored if there is no active call 859 * or there is a playing DTMF tone. 860 * @param c should be one of 0-9, '*' or '#'. Other values will be 861 * silently ignored. 862 */ 863 void startDtmf(char c); 864 865 /** 866 * Stop the playing DTMF tone. Ignored if there is no playing DTMF 867 * tone or no active call. 868 */ 869 void stopDtmf(); 870 871 /** 872 * send burst DTMF tone, it can send the string as single character or multiple character 873 * ignore if there is no active call or not valid digits string. 874 * Valid digit means only includes characters ISO-LATIN characters 0-9, *, # 875 * The difference between sendDtmf and sendBurstDtmf is sendDtmf only sends one character, 876 * this api can send single character and multiple character, also, this api has response 877 * back to caller. 878 * 879 * @param dtmfString is string representing the dialing digit(s) in the active call 880 * @param on the DTMF ON length in milliseconds, or 0 for default 881 * @param off the DTMF OFF length in milliseconds, or 0 for default 882 * @param onComplete is the callback message when the action is processed by BP 883 * 884 */ 885 void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete); 886 887 /** 888 * Sets the radio power on/off state (off is sometimes 889 * called "airplane mode"). Current state can be gotten via 890 * {@link #getServiceState()}.{@link 891 * android.telephony.ServiceState#getState() getState()}. 892 * <strong>Note: </strong>This request is asynchronous. 893 * getServiceState().getState() will not change immediately after this call. 894 * registerForServiceStateChanged() to find out when the 895 * request is complete. 896 * 897 * @param power true means "on", false means "off". 898 */ 899 void setRadioPower(boolean power); 900 901 /** 902 * Get voice message waiting indicator status. No change notification 903 * available on this interface. Use PhoneStateNotifier or similar instead. 904 * 905 * @return true if there is a voice message waiting 906 */ 907 boolean getMessageWaitingIndicator(); 908 909 /** 910 * Get voice call forwarding indicator status. No change notification 911 * available on this interface. Use PhoneStateNotifier or similar instead. 912 * 913 * @return true if there is a voice call forwarding 914 */ 915 boolean getCallForwardingIndicator(); 916 917 /** 918 * Get the line 1 phone number (MSISDN). For CDMA phones, the MDN is returned 919 * and {@link #getMsisdn()} will return the MSISDN on CDMA/LTE phones.<p> 920 * 921 * @return phone number. May return null if not 922 * available or the SIM is not ready 923 */ 924 String getLine1Number(); 925 926 /** 927 * Returns the alpha tag associated with the msisdn number. 928 * If there is no alpha tag associated or the record is not yet available, 929 * returns a default localized string. <p> 930 */ 931 String getLine1AlphaTag(); 932 933 /** 934 * Sets the MSISDN phone number in the SIM card. 935 * 936 * @param alphaTag the alpha tag associated with the MSISDN phone number 937 * (see getMsisdnAlphaTag) 938 * @param number the new MSISDN phone number to be set on the SIM. 939 * @param onComplete a callback message when the action is completed. 940 */ 941 void setLine1Number(String alphaTag, String number, Message onComplete); 942 943 /** 944 * Get the voice mail access phone number. Typically dialed when the 945 * user holds the "1" key in the phone app. May return null if not 946 * available or the SIM is not ready.<p> 947 */ 948 String getVoiceMailNumber(); 949 950 /** 951 * Returns unread voicemail count. This count is shown when the voicemail 952 * notification is expanded.<p> 953 */ 954 int getVoiceMessageCount(); 955 956 /** 957 * Returns the alpha tag associated with the voice mail number. 958 * If there is no alpha tag associated or the record is not yet available, 959 * returns a default localized string. <p> 960 * 961 * Please use this value instead of some other localized string when 962 * showing a name for this number in the UI. For example, call log 963 * entries should show this alpha tag. <p> 964 * 965 * Usage of this alpha tag in the UI is a common carrier requirement. 966 */ 967 String getVoiceMailAlphaTag(); 968 969 /** 970 * setVoiceMailNumber 971 * sets the voicemail number in the SIM card. 972 * 973 * @param alphaTag the alpha tag associated with the voice mail number 974 * (see getVoiceMailAlphaTag) 975 * @param voiceMailNumber the new voicemail number to be set on the SIM. 976 * @param onComplete a callback message when the action is completed. 977 */ 978 void setVoiceMailNumber(String alphaTag, 979 String voiceMailNumber, 980 Message onComplete); 981 982 /** 983 * getCallForwardingOptions 984 * gets a call forwarding option. The return value of 985 * ((AsyncResult)onComplete.obj) is an array of CallForwardInfo. 986 * 987 * @param commandInterfaceCFReason is one of the valid call forwarding 988 * CF_REASONS, as defined in 989 * <code>com.android.internal.telephony.CommandsInterface.</code> 990 * @param onComplete a callback message when the action is completed. 991 * @see com.android.internal.telephony.CallForwardInfo for details. 992 */ 993 void getCallForwardingOption(int commandInterfaceCFReason, 994 Message onComplete); 995 996 /** 997 * setCallForwardingOptions 998 * sets a call forwarding option. 999 * 1000 * @param commandInterfaceCFReason is one of the valid call forwarding 1001 * CF_REASONS, as defined in 1002 * <code>com.android.internal.telephony.CommandsInterface.</code> 1003 * @param commandInterfaceCFAction is one of the valid call forwarding 1004 * CF_ACTIONS, as defined in 1005 * <code>com.android.internal.telephony.CommandsInterface.</code> 1006 * @param dialingNumber is the target phone number to forward calls to 1007 * @param timerSeconds is used by CFNRy to indicate the timeout before 1008 * forwarding is attempted. 1009 * @param onComplete a callback message when the action is completed. 1010 */ 1011 void setCallForwardingOption(int commandInterfaceCFReason, 1012 int commandInterfaceCFAction, 1013 String dialingNumber, 1014 int timerSeconds, 1015 Message onComplete); 1016 1017 /** 1018 * getOutgoingCallerIdDisplay 1019 * gets outgoing caller id display. The return value of 1020 * ((AsyncResult)onComplete.obj) is an array of int, with a length of 2. 1021 * 1022 * @param onComplete a callback message when the action is completed. 1023 * @see com.android.internal.telephony.CommandsInterface#getCLIR for details. 1024 */ 1025 void getOutgoingCallerIdDisplay(Message onComplete); 1026 1027 /** 1028 * setOutgoingCallerIdDisplay 1029 * sets a call forwarding option. 1030 * 1031 * @param commandInterfaceCLIRMode is one of the valid call CLIR 1032 * modes, as defined in 1033 * <code>com.android.internal.telephony.CommandsInterface./code> 1034 * @param onComplete a callback message when the action is completed. 1035 */ 1036 void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, 1037 Message onComplete); 1038 1039 /** 1040 * getCallWaiting 1041 * gets call waiting activation state. The return value of 1042 * ((AsyncResult)onComplete.obj) is an array of int, with a length of 1. 1043 * 1044 * @param onComplete a callback message when the action is completed. 1045 * @see com.android.internal.telephony.CommandsInterface#queryCallWaiting for details. 1046 */ 1047 void getCallWaiting(Message onComplete); 1048 1049 /** 1050 * setCallWaiting 1051 * sets a call forwarding option. 1052 * 1053 * @param enable is a boolean representing the state that you are 1054 * requesting, true for enabled, false for disabled. 1055 * @param onComplete a callback message when the action is completed. 1056 */ 1057 void setCallWaiting(boolean enable, Message onComplete); 1058 1059 /** 1060 * Scan available networks. This method is asynchronous; . 1061 * On completion, <code>response.obj</code> is set to an AsyncResult with 1062 * one of the following members:.<p> 1063 *<ul> 1064 * <li><code>response.obj.result</code> will be a <code>List</code> of 1065 * <code>OperatorInfo</code> objects, or</li> 1066 * <li><code>response.obj.exception</code> will be set with an exception 1067 * on failure.</li> 1068 * </ul> 1069 */ 1070 void getAvailableNetworks(Message response); 1071 1072 /** 1073 * Switches network selection mode to "automatic", re-scanning and 1074 * re-selecting a network if appropriate. 1075 * 1076 * @param response The message to dispatch when the network selection 1077 * is complete. 1078 * 1079 * @see #selectNetworkManually(OperatorInfo, android.os.Message ) 1080 */ 1081 void setNetworkSelectionModeAutomatic(Message response); 1082 1083 /** 1084 * Manually selects a network. <code>response</code> is 1085 * dispatched when this is complete. <code>response.obj</code> will be 1086 * an AsyncResult, and <code>response.obj.exception</code> will be non-null 1087 * on failure. 1088 * 1089 * @see #setNetworkSelectionModeAutomatic(Message) 1090 */ 1091 void selectNetworkManually(OperatorInfo network, 1092 Message response); 1093 1094 /** 1095 * Requests to set the preferred network type for searching and registering 1096 * (CS/PS domain, RAT, and operation mode) 1097 * @param networkType one of NT_*_TYPE 1098 * @param response is callback message 1099 */ 1100 void setPreferredNetworkType(int networkType, Message response); 1101 1102 /** 1103 * Query the preferred network type setting 1104 * 1105 * @param response is callback message to report one of NT_*_TYPE 1106 */ 1107 void getPreferredNetworkType(Message response); 1108 1109 /** 1110 * Gets the default SMSC address. 1111 * 1112 * @param result Callback message contains the SMSC address. 1113 */ 1114 void getSmscAddress(Message result); 1115 1116 /** 1117 * Sets the default SMSC address. 1118 * 1119 * @param address new SMSC address 1120 * @param result Callback message is empty on completion 1121 */ 1122 void setSmscAddress(String address, Message result); 1123 1124 /** 1125 * Query neighboring cell IDs. <code>response</code> is dispatched when 1126 * this is complete. <code>response.obj</code> will be an AsyncResult, 1127 * and <code>response.obj.exception</code> will be non-null on failure. 1128 * On success, <code>AsyncResult.result</code> will be a <code>String[]</code> 1129 * containing the neighboring cell IDs. Index 0 will contain the count 1130 * of available cell IDs. Cell IDs are in hexadecimal format. 1131 * 1132 * @param response callback message that is dispatched when the query 1133 * completes. 1134 */ 1135 void getNeighboringCids(Message response); 1136 1137 /** 1138 * Sets an event to be fired when the telephony system processes 1139 * a post-dial character on an outgoing call.<p> 1140 * 1141 * Messages of type <code>what</code> will be sent to <code>h</code>. 1142 * The <code>obj</code> field of these Message's will be instances of 1143 * <code>AsyncResult</code>. <code>Message.obj.result</code> will be 1144 * a Connection object.<p> 1145 * 1146 * Message.arg1 will be the post dial character being processed, 1147 * or 0 ('\0') if end of string.<p> 1148 * 1149 * If Connection.getPostDialState() == WAIT, 1150 * the application must call 1151 * {@link com.android.internal.telephony.Connection#proceedAfterWaitChar() 1152 * Connection.proceedAfterWaitChar()} or 1153 * {@link com.android.internal.telephony.Connection#cancelPostDial() 1154 * Connection.cancelPostDial()} 1155 * for the telephony system to continue playing the post-dial 1156 * DTMF sequence.<p> 1157 * 1158 * If Connection.getPostDialState() == WILD, 1159 * the application must call 1160 * {@link com.android.internal.telephony.Connection#proceedAfterWildChar 1161 * Connection.proceedAfterWildChar()} 1162 * or 1163 * {@link com.android.internal.telephony.Connection#cancelPostDial() 1164 * Connection.cancelPostDial()} 1165 * for the telephony system to continue playing the 1166 * post-dial DTMF sequence.<p> 1167 * 1168 * Only one post dial character handler may be set. <p> 1169 * Calling this method with "h" equal to null unsets this handler.<p> 1170 */ 1171 void setOnPostDialCharacter(Handler h, int what, Object obj); 1172 1173 1174 /** 1175 * Mutes or unmutes the microphone for the active call. The microphone 1176 * is automatically unmuted if a call is answered, dialed, or resumed 1177 * from a holding state. 1178 * 1179 * @param muted true to mute the microphone, 1180 * false to activate the microphone. 1181 */ 1182 1183 void setMute(boolean muted); 1184 1185 /** 1186 * Gets current mute status. Use 1187 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 1188 * java.lang.Object) registerForPreciseCallStateChanged()} 1189 * as a change notifcation, although presently phone state changed is not 1190 * fired when setMute() is called. 1191 * 1192 * @return true is muting, false is unmuting 1193 */ 1194 boolean getMute(); 1195 1196 /** 1197 * Enables or disables echo suppression. 1198 */ 1199 void setEchoSuppressionEnabled(); 1200 1201 /** 1202 * Invokes RIL_REQUEST_OEM_HOOK_RAW on RIL implementation. 1203 * 1204 * @param data The data for the request. 1205 * @param response <strong>On success</strong>, 1206 * (byte[])(((AsyncResult)response.obj).result) 1207 * <strong>On failure</strong>, 1208 * (((AsyncResult)response.obj).result) == null and 1209 * (((AsyncResult)response.obj).exception) being an instance of 1210 * com.android.internal.telephony.gsm.CommandException 1211 * 1212 * @see #invokeOemRilRequestRaw(byte[], android.os.Message) 1213 */ 1214 void invokeOemRilRequestRaw(byte[] data, Message response); 1215 1216 /** 1217 * Invokes RIL_REQUEST_OEM_HOOK_Strings on RIL implementation. 1218 * 1219 * @param strings The strings to make available as the request data. 1220 * @param response <strong>On success</strong>, "response" bytes is 1221 * made available as: 1222 * (String[])(((AsyncResult)response.obj).result). 1223 * <strong>On failure</strong>, 1224 * (((AsyncResult)response.obj).result) == null and 1225 * (((AsyncResult)response.obj).exception) being an instance of 1226 * com.android.internal.telephony.gsm.CommandException 1227 * 1228 * @see #invokeOemRilRequestStrings(java.lang.String[], android.os.Message) 1229 */ 1230 void invokeOemRilRequestStrings(String[] strings, Message response); 1231 1232 /** 1233 * Get the current active Data Call list 1234 * 1235 * @param response <strong>On success</strong>, "response" bytes is 1236 * made available as: 1237 * (String[])(((AsyncResult)response.obj).result). 1238 * <strong>On failure</strong>, 1239 * (((AsyncResult)response.obj).result) == null and 1240 * (((AsyncResult)response.obj).exception) being an instance of 1241 * com.android.internal.telephony.gsm.CommandException 1242 */ 1243 void getDataCallList(Message response); 1244 1245 /** 1246 * Update the ServiceState CellLocation for current network registration. 1247 */ 1248 void updateServiceLocation(); 1249 1250 /** 1251 * Enable location update notifications. 1252 */ 1253 void enableLocationUpdates(); 1254 1255 /** 1256 * Disable location update notifications. 1257 */ 1258 void disableLocationUpdates(); 1259 1260 /** 1261 * For unit tests; don't send notifications to "Phone" 1262 * mailbox registrants if true. 1263 */ 1264 void setUnitTestMode(boolean f); 1265 1266 /** 1267 * @return true If unit test mode is enabled 1268 */ 1269 boolean getUnitTestMode(); 1270 1271 /** 1272 * Assign a specified band for RF configuration. 1273 * 1274 * @param bandMode one of BM_*_BAND 1275 * @param response is callback message 1276 */ 1277 void setBandMode(int bandMode, Message response); 1278 1279 /** 1280 * Query the list of band mode supported by RF. 1281 * 1282 * @param response is callback message 1283 * ((AsyncResult)response.obj).result is an int[] where int[0] is 1284 * the size of the array and the rest of each element representing 1285 * one available BM_*_BAND 1286 */ 1287 void queryAvailableBandMode(Message response); 1288 1289 /** 1290 * @return true if enable data connection on roaming 1291 */ 1292 boolean getDataRoamingEnabled(); 1293 1294 /** 1295 * @param enable set true if enable data connection on roaming 1296 */ 1297 void setDataRoamingEnabled(boolean enable); 1298 1299 /** 1300 * @return true if user has enabled data 1301 */ 1302 boolean getDataEnabled(); 1303 1304 /** 1305 * @param @enable set {@code true} if enable data connection 1306 */ 1307 void setDataEnabled(boolean enable); 1308 1309 /** 1310 * Query the CDMA roaming preference setting 1311 * 1312 * @param response is callback message to report one of CDMA_RM_* 1313 */ 1314 void queryCdmaRoamingPreference(Message response); 1315 1316 /** 1317 * Requests to set the CDMA roaming preference 1318 * @param cdmaRoamingType one of CDMA_RM_* 1319 * @param response is callback message 1320 */ 1321 void setCdmaRoamingPreference(int cdmaRoamingType, Message response); 1322 1323 /** 1324 * Requests to set the CDMA subscription mode 1325 * @param cdmaSubscriptionType one of CDMA_SUBSCRIPTION_* 1326 * @param response is callback message 1327 */ 1328 void setCdmaSubscription(int cdmaSubscriptionType, Message response); 1329 1330 /** 1331 * If this is a simulated phone interface, returns a SimulatedRadioControl. 1332 * @return SimulatedRadioControl if this is a simulated interface; 1333 * otherwise, null. 1334 */ 1335 SimulatedRadioControl getSimulatedRadioControl(); 1336 1337 /** 1338 * Report on whether data connectivity is allowed. 1339 */ 1340 boolean isDataConnectivityPossible(); 1341 1342 /** 1343 * Report on whether data connectivity is allowed for an APN. 1344 */ 1345 boolean isDataConnectivityPossible(String apnType); 1346 1347 /** 1348 * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones. 1349 */ 1350 String getDeviceId(); 1351 1352 /** 1353 * Retrieves the software version number for the device, e.g., IMEI/SV 1354 * for GSM phones. 1355 */ 1356 String getDeviceSvn(); 1357 1358 /** 1359 * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones. 1360 */ 1361 String getSubscriberId(); 1362 1363 /** 1364 * Retrieves the Group Identifier Level1 for GSM phones. 1365 */ 1366 String getGroupIdLevel1(); 1367 1368 /** 1369 * Retrieves the serial number of the ICC, if applicable. 1370 */ 1371 String getIccSerialNumber(); 1372 1373 /* CDMA support methods */ 1374 1375 /** 1376 * Retrieves the MIN for CDMA phones. 1377 */ 1378 String getCdmaMin(); 1379 1380 /** 1381 * Check if subscription data has been assigned to mMin 1382 * 1383 * return true if MIN info is ready; false otherwise. 1384 */ 1385 boolean isMinInfoReady(); 1386 1387 /** 1388 * Retrieves PRL Version for CDMA phones 1389 */ 1390 String getCdmaPrlVersion(); 1391 1392 /** 1393 * Retrieves the ESN for CDMA phones. 1394 */ 1395 String getEsn(); 1396 1397 /** 1398 * Retrieves MEID for CDMA phones. 1399 */ 1400 String getMeid(); 1401 1402 /** 1403 * Retrieves the MSISDN from the UICC. For GSM/UMTS phones, this is equivalent to 1404 * {@link #getLine1Number()}. For CDMA phones, {@link #getLine1Number()} returns 1405 * the MDN, so this method is provided to return the MSISDN on CDMA/LTE phones. 1406 */ 1407 String getMsisdn(); 1408 1409 /** 1410 * Retrieves IMEI for phones. Returns null if IMEI is not set. 1411 */ 1412 String getImei(); 1413 1414 /** 1415 * Retrieves the PhoneSubInfo of the Phone 1416 */ 1417 public PhoneSubInfo getPhoneSubInfo(); 1418 1419 /** 1420 * Retrieves the IccPhoneBookInterfaceManager of the Phone 1421 */ 1422 public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(); 1423 1424 /** 1425 * setTTYMode 1426 * sets a TTY mode option. 1427 * @param ttyMode is a one of the following: 1428 * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} 1429 * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} 1430 * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} 1431 * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} 1432 * @param onComplete a callback message when the action is completed 1433 */ 1434 void setTTYMode(int ttyMode, Message onComplete); 1435 1436 /** 1437 * queryTTYMode 1438 * query the status of the TTY mode 1439 * 1440 * @param onComplete a callback message when the action is completed. 1441 */ 1442 void queryTTYMode(Message onComplete); 1443 1444 /** 1445 * Activate or deactivate cell broadcast SMS. 1446 * 1447 * @param activate 1448 * 0 = activate, 1 = deactivate 1449 * @param response 1450 * Callback message is empty on completion 1451 */ 1452 void activateCellBroadcastSms(int activate, Message response); 1453 1454 /** 1455 * Query the current configuration of cdma cell broadcast SMS. 1456 * 1457 * @param response 1458 * Callback message is empty on completion 1459 */ 1460 void getCellBroadcastSmsConfig(Message response); 1461 1462 /** 1463 * Configure cell broadcast SMS. 1464 * 1465 * TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig 1466 * 1467 * @param response 1468 * Callback message is empty on completion 1469 */ 1470 public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response); 1471 1472 public void notifyDataActivity(); 1473 1474 /** 1475 * Returns the CDMA ERI icon index to display 1476 */ 1477 public int getCdmaEriIconIndex(); 1478 1479 /** 1480 * Returns the CDMA ERI icon mode, 1481 * 0 - ON 1482 * 1 - FLASHING 1483 */ 1484 public int getCdmaEriIconMode(); 1485 1486 /** 1487 * Returns the CDMA ERI text, 1488 */ 1489 public String getCdmaEriText(); 1490 1491 /** 1492 * request to exit emergency call back mode 1493 * the caller should use setOnECMModeExitResponse 1494 * to receive the emergency callback mode exit response 1495 */ 1496 void exitEmergencyCallbackMode(); 1497 1498 /** 1499 * this decides if the dial number is OTA(Over the air provision) number or not 1500 * @param dialStr is string representing the dialing digit(s) 1501 * @return true means the dialStr is OTA number, and false means the dialStr is not OTA number 1502 */ 1503 boolean isOtaSpNumber(String dialStr); 1504 1505 /** 1506 * Returns true if OTA Service Provisioning needs to be performed. 1507 */ 1508 boolean needsOtaServiceProvisioning(); 1509 1510 /** 1511 * Register for notifications when CDMA call waiting comes 1512 * 1513 * @param h Handler that receives the notification message. 1514 * @param what User-defined message code. 1515 * @param obj User object. 1516 */ 1517 void registerForCallWaiting(Handler h, int what, Object obj); 1518 1519 /** 1520 * Unegister for notifications when CDMA Call waiting comes 1521 * @param h Handler to be removed from the registrant list. 1522 */ 1523 void unregisterForCallWaiting(Handler h); 1524 1525 1526 /** 1527 * Register for signal information notifications from the network. 1528 * Message.obj will contain an AsyncResult. 1529 * AsyncResult.result will be a SuppServiceNotification instance. 1530 * 1531 * @param h Handler that receives the notification message. 1532 * @param what User-defined message code. 1533 * @param obj User object. 1534 */ 1535 1536 void registerForSignalInfo(Handler h, int what, Object obj) ; 1537 /** 1538 * Unregisters for signal information notifications. 1539 * Extraneous calls are tolerated silently 1540 * 1541 * @param h Handler to be removed from the registrant list. 1542 */ 1543 void unregisterForSignalInfo(Handler h); 1544 1545 /** 1546 * Register for display information notifications from the network. 1547 * Message.obj will contain an AsyncResult. 1548 * AsyncResult.result will be a SuppServiceNotification instance. 1549 * 1550 * @param h Handler that receives the notification message. 1551 * @param what User-defined message code. 1552 * @param obj User object. 1553 */ 1554 void registerForDisplayInfo(Handler h, int what, Object obj); 1555 1556 /** 1557 * Unregisters for display information notifications. 1558 * Extraneous calls are tolerated silently 1559 * 1560 * @param h Handler to be removed from the registrant list. 1561 */ 1562 void unregisterForDisplayInfo(Handler h) ; 1563 1564 /** 1565 * Register for CDMA number information record notification from the network. 1566 * Message.obj will contain an AsyncResult. 1567 * AsyncResult.result will be a CdmaInformationRecords.CdmaNumberInfoRec 1568 * instance. 1569 * 1570 * @param h Handler that receives the notification message. 1571 * @param what User-defined message code. 1572 * @param obj User object. 1573 */ 1574 void registerForNumberInfo(Handler h, int what, Object obj); 1575 1576 /** 1577 * Unregisters for number information record notifications. 1578 * Extraneous calls are tolerated silently 1579 * 1580 * @param h Handler to be removed from the registrant list. 1581 */ 1582 void unregisterForNumberInfo(Handler h); 1583 1584 /** 1585 * Register for CDMA redirected number information record notification 1586 * from the network. 1587 * Message.obj will contain an AsyncResult. 1588 * AsyncResult.result will be a CdmaInformationRecords.CdmaRedirectingNumberInfoRec 1589 * instance. 1590 * 1591 * @param h Handler that receives the notification message. 1592 * @param what User-defined message code. 1593 * @param obj User object. 1594 */ 1595 void registerForRedirectedNumberInfo(Handler h, int what, Object obj); 1596 1597 /** 1598 * Unregisters for redirected number information record notification. 1599 * Extraneous calls are tolerated silently 1600 * 1601 * @param h Handler to be removed from the registrant list. 1602 */ 1603 void unregisterForRedirectedNumberInfo(Handler h); 1604 1605 /** 1606 * Register for CDMA line control information record notification 1607 * from the network. 1608 * Message.obj will contain an AsyncResult. 1609 * AsyncResult.result will be a CdmaInformationRecords.CdmaLineControlInfoRec 1610 * instance. 1611 * 1612 * @param h Handler that receives the notification message. 1613 * @param what User-defined message code. 1614 * @param obj User object. 1615 */ 1616 void registerForLineControlInfo(Handler h, int what, Object obj); 1617 1618 /** 1619 * Unregisters for line control information notifications. 1620 * Extraneous calls are tolerated silently 1621 * 1622 * @param h Handler to be removed from the registrant list. 1623 */ 1624 void unregisterForLineControlInfo(Handler h); 1625 1626 /** 1627 * Register for CDMA T53 CLIR information record notifications 1628 * from the network. 1629 * Message.obj will contain an AsyncResult. 1630 * AsyncResult.result will be a CdmaInformationRecords.CdmaT53ClirInfoRec 1631 * instance. 1632 * 1633 * @param h Handler that receives the notification message. 1634 * @param what User-defined message code. 1635 * @param obj User object. 1636 */ 1637 void registerFoT53ClirlInfo(Handler h, int what, Object obj); 1638 1639 /** 1640 * Unregisters for T53 CLIR information record notification 1641 * Extraneous calls are tolerated silently 1642 * 1643 * @param h Handler to be removed from the registrant list. 1644 */ 1645 void unregisterForT53ClirInfo(Handler h); 1646 1647 /** 1648 * Register for CDMA T53 audio control information record notifications 1649 * from the network. 1650 * Message.obj will contain an AsyncResult. 1651 * AsyncResult.result will be a CdmaInformationRecords.CdmaT53AudioControlInfoRec 1652 * instance. 1653 * 1654 * @param h Handler that receives the notification message. 1655 * @param what User-defined message code. 1656 * @param obj User object. 1657 */ 1658 void registerForT53AudioControlInfo(Handler h, int what, Object obj); 1659 1660 /** 1661 * Unregisters for T53 audio control information record notifications. 1662 * Extraneous calls are tolerated silently 1663 * 1664 * @param h Handler to be removed from the registrant list. 1665 */ 1666 void unregisterForT53AudioControlInfo(Handler h); 1667 1668 /** 1669 * registers for exit emergency call back mode request response 1670 * 1671 * @param h Handler that receives the notification message. 1672 * @param what User-defined message code. 1673 * @param obj User object. 1674 */ 1675 1676 void setOnEcbModeExitResponse(Handler h, int what, Object obj); 1677 1678 /** 1679 * Unregisters for exit emergency call back mode request response 1680 * 1681 * @param h Handler to be removed from the registrant list. 1682 */ 1683 void unsetOnEcbModeExitResponse(Handler h); 1684 1685 /** 1686 * Return if the current radio is LTE on CDMA. This 1687 * is a tri-state return value as for a period of time 1688 * the mode may be unknown. 1689 * 1690 * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE} 1691 * or {@link PhoneConstants#LTE_ON_CDMA_TRUE} 1692 */ 1693 public int getLteOnCdmaMode(); 1694 1695 /** 1696 * TODO: Adding a function for each property is not good. 1697 * A fucntion of type getPhoneProp(propType) where propType is an 1698 * enum of GSM+CDMA+LTE props would be a better approach. 1699 * 1700 * Get "Restriction of menu options for manual PLMN selection" bit 1701 * status from EF_CSP data, this belongs to "Value Added Services Group". 1702 * @return true if this bit is set or EF_CSP data is unavailable, 1703 * false otherwise 1704 */ 1705 boolean isCspPlmnEnabled(); 1706 1707 /** 1708 * Return an interface to retrieve the ISIM records for IMS, if available. 1709 * @return the interface to retrieve the ISIM records, or null if not supported 1710 */ 1711 IsimRecords getIsimRecords(); 1712 1713 /** 1714 * Sets the SIM voice message waiting indicator records. 1715 * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported 1716 * @param countWaiting The number of messages waiting, if known. Use 1717 * -1 to indicate that an unknown number of 1718 * messages are waiting 1719 */ 1720 void setVoiceMessageWaiting(int line, int countWaiting); 1721 1722 /** 1723 * Gets the USIM service table from the UICC, if present and available. 1724 * @return an interface to the UsimServiceTable record, or null if not available 1725 */ 1726 UsimServiceTable getUsimServiceTable(); 1727 1728 /** 1729 * Gets the Uicc card corresponding to this phone. 1730 * @return the UiccCard object corresponding to the phone ID. 1731 */ 1732 UiccCard getUiccCard(); 1733 1734 /** 1735 * Unregister from all events it registered for and dispose objects 1736 * created by this object. 1737 */ 1738 void dispose(); 1739 1740 /** 1741 * Remove references to external object stored in this object. 1742 */ 1743 void removeReferences(); 1744 1745 /** 1746 * Update the phone object if the voice radio technology has changed 1747 * 1748 * @param voiceRadioTech The new voice radio technology 1749 */ 1750 void updatePhoneObject(int voiceRadioTech); 1751 1752 /** 1753 * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. 1754 * Used for device configuration by some CDMA operators. 1755 * 1756 * @param itemID the ID of the item to read 1757 * @param response callback message with the String response in the obj field 1758 */ 1759 void nvReadItem(int itemID, Message response); 1760 1761 /** 1762 * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}. 1763 * Used for device configuration by some CDMA operators. 1764 * 1765 * @param itemID the ID of the item to read 1766 * @param itemValue the value to write, as a String 1767 * @param response Callback message. 1768 */ 1769 void nvWriteItem(int itemID, String itemValue, Message response); 1770 1771 /** 1772 * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage. 1773 * Used for device configuration by some CDMA operators. 1774 * 1775 * @param preferredRoamingList byte array containing the new PRL 1776 * @param response Callback message. 1777 */ 1778 void nvWriteCdmaPrl(byte[] preferredRoamingList, Message response); 1779 1780 /** 1781 * Perform the specified type of NV config reset. The radio will be taken offline 1782 * and the device must be rebooted after erasing the NV. Used for device 1783 * configuration by some CDMA operators. 1784 * 1785 * @param resetType reset type: 1: reload NV reset, 2: erase NV reset, 3: factory NV reset 1786 * @param response Callback message. 1787 */ 1788 void nvResetConfig(int resetType, Message response); 1789 1790 /* 1791 * Returns the subscription id. 1792 */ 1793 public long getSubId(); 1794 1795 /* 1796 * Returns the phone id. 1797 */ 1798 public int getPhoneId(); 1799 1800 /** 1801 * Get P-CSCF address from PCO after data connection is established or modified. 1802 * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN 1803 */ 1804 public String[] getPcscfAddress(String apnType); 1805 1806 /** 1807 * Set IMS registration state 1808 */ 1809 public void setImsRegistrationState(boolean registered); 1810 1811 /** 1812 * Return the ImsPhone phone co-managed with this phone 1813 * @return an instance of an ImsPhone phone 1814 */ 1815 public Phone getImsPhone(); 1816 1817 /** 1818 * Release the local instance of the ImsPhone and disconnect from 1819 * the phone. 1820 * @return the instance of the ImsPhone phone previously owned 1821 */ 1822 public ImsPhone relinquishOwnershipOfImsPhone(); 1823 1824 /** 1825 * Take ownership and wire-up the input ImsPhone 1826 * @param imsPhone ImsPhone to be used. 1827 */ 1828 public void acquireOwnershipOfImsPhone(ImsPhone imsPhone); 1829 1830 /** 1831 * Return the service state of mImsPhone if it is STATE_IN_SERVICE 1832 * otherwise return the current voice service state 1833 */ 1834 int getVoicePhoneServiceState(); 1835 1836 /** 1837 * Override the service provider name and the operator name for the current ICCID. 1838 */ 1839 public boolean setOperatorBrandOverride(String brand); 1840 1841 /** 1842 * Is Radio Present on the device and is it accessible 1843 */ 1844 public boolean isRadioAvailable(); 1845 1846 /** 1847 * shutdown Radio gracefully 1848 */ 1849 public void shutdownRadio(); 1850 } 1851