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.annotation.NonNull; 20 import android.compat.annotation.UnsupportedAppUsage; 21 import android.os.Bundle; 22 import android.os.Handler; 23 import android.os.Message; 24 import android.os.ResultReceiver; 25 import android.os.WorkSource; 26 import android.telecom.VideoProfile; 27 import android.telephony.ImsiEncryptionInfo; 28 import android.telephony.NetworkScanRequest; 29 import android.telephony.PreciseDataConnectionState; 30 import android.telephony.ServiceState; 31 import android.telephony.TelephonyManager; 32 33 import com.android.internal.telephony.PhoneConstants.DataState; 34 35 import java.util.List; 36 37 /** 38 * Internal interface used to control the phone; SDK developers cannot 39 * obtain this interface. 40 * 41 * {@hide} 42 * 43 */ 44 public interface PhoneInternalInterface { 45 46 /** used to enable additional debug messages */ 47 static final boolean DEBUG_PHONE = true; 48 49 public enum DataActivityState { 50 /** 51 * The state of a data activity. 52 * <ul> 53 * <li>NONE = No traffic</li> 54 * <li>DATAIN = Receiving IP ppp traffic</li> 55 * <li>DATAOUT = Sending IP ppp traffic</li> 56 * <li>DATAINANDOUT = Both receiving and sending IP ppp traffic</li> 57 * <li>DORMANT = The data connection is still active, 58 but physical link is down</li> 59 * </ul> 60 */ 61 @UnsupportedAppUsage 62 NONE, DATAIN, DATAOUT, DATAINANDOUT, DORMANT; 63 } 64 65 enum SuppService { 66 UNKNOWN, SWITCH, SEPARATE, TRANSFER, CONFERENCE, REJECT, HANGUP, RESUME, HOLD; 67 } 68 69 /** 70 * Arguments that control behavior of dialing a call. 71 */ 72 public static class DialArgs { 73 public static class Builder<T extends Builder<T>> { 74 protected UUSInfo mUusInfo; 75 protected int mVideoState = VideoProfile.STATE_AUDIO_ONLY; 76 protected Bundle mIntentExtras; 77 setUusInfo(UUSInfo uusInfo)78 public T setUusInfo(UUSInfo uusInfo) { 79 mUusInfo = uusInfo; 80 return (T) this; 81 } 82 setVideoState(int videoState)83 public T setVideoState(int videoState) { 84 mVideoState = videoState; 85 return (T) this; 86 } 87 setIntentExtras(Bundle intentExtras)88 public T setIntentExtras(Bundle intentExtras) { 89 this.mIntentExtras = intentExtras; 90 return (T) this; 91 } 92 build()93 public PhoneInternalInterface.DialArgs build() { 94 return new DialArgs(this); 95 } 96 } 97 98 /** The UUSInfo */ 99 public final UUSInfo uusInfo; 100 101 /** The desired video state for the connection. */ 102 public final int videoState; 103 104 /** The extras from the original CALL intent. */ 105 public final Bundle intentExtras; 106 DialArgs(Builder b)107 protected DialArgs(Builder b) { 108 this.uusInfo = b.mUusInfo; 109 this.videoState = b.mVideoState; 110 this.intentExtras = b.mIntentExtras; 111 } 112 } 113 114 // "Features" accessible through the connectivity manager 115 static final String FEATURE_ENABLE_MMS = "enableMMS"; 116 static final String FEATURE_ENABLE_SUPL = "enableSUPL"; 117 static final String FEATURE_ENABLE_DUN = "enableDUN"; 118 static final String FEATURE_ENABLE_HIPRI = "enableHIPRI"; 119 static final String FEATURE_ENABLE_DUN_ALWAYS = "enableDUNAlways"; 120 static final String FEATURE_ENABLE_FOTA = "enableFOTA"; 121 static final String FEATURE_ENABLE_IMS = "enableIMS"; 122 static final String FEATURE_ENABLE_CBS = "enableCBS"; 123 static final String FEATURE_ENABLE_EMERGENCY = "enableEmergency"; 124 125 /** 126 * Optional reasons for disconnect and connect 127 */ 128 static final String REASON_ROAMING_ON = "roamingOn"; 129 static final String REASON_ROAMING_OFF = "roamingOff"; 130 static final String REASON_DATA_DISABLED_INTERNAL = "dataDisabledInternal"; 131 static final String REASON_DATA_ENABLED = "dataEnabled"; 132 static final String REASON_DATA_ATTACHED = "dataAttached"; 133 static final String REASON_DATA_DETACHED = "dataDetached"; 134 static final String REASON_CDMA_DATA_ATTACHED = "cdmaDataAttached"; 135 static final String REASON_CDMA_DATA_DETACHED = "cdmaDataDetached"; 136 static final String REASON_APN_CHANGED = "apnChanged"; 137 static final String REASON_APN_SWITCHED = "apnSwitched"; 138 static final String REASON_APN_FAILED = "apnFailed"; 139 static final String REASON_RESTORE_DEFAULT_APN = "restoreDefaultApn"; 140 static final String REASON_RADIO_TURNED_OFF = "radioTurnedOff"; 141 static final String REASON_PDP_RESET = "pdpReset"; 142 static final String REASON_VOICE_CALL_ENDED = "2GVoiceCallEnded"; 143 static final String REASON_VOICE_CALL_STARTED = "2GVoiceCallStarted"; 144 static final String REASON_PS_RESTRICT_ENABLED = "psRestrictEnabled"; 145 static final String REASON_PS_RESTRICT_DISABLED = "psRestrictDisabled"; 146 static final String REASON_SIM_LOADED = "simLoaded"; 147 static final String REASON_NW_TYPE_CHANGED = "nwTypeChanged"; 148 static final String REASON_DATA_DEPENDENCY_MET = "dependencyMet"; 149 static final String REASON_DATA_DEPENDENCY_UNMET = "dependencyUnmet"; 150 static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection"; 151 static final String REASON_CONNECTED = "connected"; 152 static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration"; 153 static final String REASON_DATA_SPECIFIC_DISABLED = "specificDisabled"; 154 static final String REASON_SIM_NOT_READY = "simNotReady"; 155 static final String REASON_IWLAN_AVAILABLE = "iwlanAvailable"; 156 static final String REASON_CARRIER_CHANGE = "carrierChange"; 157 static final String REASON_CARRIER_ACTION_DISABLE_METERED_APN = 158 "carrierActionDisableMeteredApn"; 159 static final String REASON_CSS_INDICATOR_CHANGED = "cssIndicatorChanged"; 160 static final String REASON_RELEASED_BY_CONNECTIVITY_SERVICE = "releasedByConnectivityService"; 161 static final String REASON_DATA_ENABLED_OVERRIDE = "dataEnabledOverride"; 162 static final String REASON_IWLAN_DATA_SERVICE_DIED = "iwlanDataServiceDied"; 163 164 // Used for band mode selection methods 165 static final int BM_UNSPECIFIED = RILConstants.BAND_MODE_UNSPECIFIED; // automatic 166 static final int BM_EURO_BAND = RILConstants.BAND_MODE_EURO; 167 static final int BM_US_BAND = RILConstants.BAND_MODE_USA; 168 static final int BM_JPN_BAND = RILConstants.BAND_MODE_JPN; 169 static final int BM_AUS_BAND = RILConstants.BAND_MODE_AUS; 170 static final int BM_AUS2_BAND = RILConstants.BAND_MODE_AUS_2; 171 static final int BM_CELL_800 = RILConstants.BAND_MODE_CELL_800; 172 static final int BM_PCS = RILConstants.BAND_MODE_PCS; 173 static final int BM_JTACS = RILConstants.BAND_MODE_JTACS; 174 static final int BM_KOREA_PCS = RILConstants.BAND_MODE_KOREA_PCS; 175 static final int BM_4_450M = RILConstants.BAND_MODE_5_450M; 176 static final int BM_IMT2000 = RILConstants.BAND_MODE_IMT2000; 177 static final int BM_7_700M2 = RILConstants.BAND_MODE_7_700M_2; 178 static final int BM_8_1800M = RILConstants.BAND_MODE_8_1800M; 179 static final int BM_9_900M = RILConstants.BAND_MODE_9_900M; 180 static final int BM_10_800M_2 = RILConstants.BAND_MODE_10_800M_2; 181 static final int BM_EURO_PAMR = RILConstants.BAND_MODE_EURO_PAMR_400M; 182 static final int BM_AWS = RILConstants.BAND_MODE_AWS; 183 static final int BM_US_2500M = RILConstants.BAND_MODE_USA_2500M; 184 static final int BM_NUM_BAND_MODES = 19; //Total number of band modes 185 186 @UnsupportedAppUsage 187 int PREFERRED_NT_MODE = RILConstants.PREFERRED_NETWORK_MODE; 188 189 // Used for CDMA roaming mode 190 // Home Networks only, as defined in PRL 191 int CDMA_RM_HOME = TelephonyManager.CDMA_ROAMING_MODE_HOME; 192 // Roaming an Affiliated networks, as defined in PRL 193 int CDMA_RM_AFFILIATED = TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED; 194 // Roaming on Any Network, as defined in PRL 195 int CDMA_RM_ANY = TelephonyManager.CDMA_ROAMING_MODE_ANY; 196 197 // Used for CDMA subscription mode 198 // Unknown 199 static final int CDMA_SUBSCRIPTION_UNKNOWN = TelephonyManager.CDMA_SUBSCRIPTION_UNKNOWN; 200 // RUIM/SIM (default) 201 static final int CDMA_SUBSCRIPTION_RUIM_SIM = TelephonyManager.CDMA_SUBSCRIPTION_RUIM_SIM; 202 // NV -> non-volatile memory 203 static final int CDMA_SUBSCRIPTION_NV = TelephonyManager.CDMA_SUBSCRIPTION_NV; 204 205 static final int PREFERRED_CDMA_SUBSCRIPTION = CDMA_SUBSCRIPTION_RUIM_SIM; 206 207 static final int TTY_MODE_OFF = 0; 208 static final int TTY_MODE_FULL = 1; 209 static final int TTY_MODE_HCO = 2; 210 static final int TTY_MODE_VCO = 3; 211 212 /** 213 * CDMA OTA PROVISION STATUS, the same as RIL_CDMA_OTA_Status in ril.h 214 */ 215 216 public static final int CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED = 0; 217 public static final int CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED = 1; 218 public static final int CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED = 2; 219 public static final int CDMA_OTA_PROVISION_STATUS_SSD_UPDATED = 3; 220 public static final int CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED = 4; 221 public static final int CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED = 5; 222 public static final int CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED = 6; 223 public static final int CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED = 7; 224 public static final int CDMA_OTA_PROVISION_STATUS_COMMITTED = 8; 225 public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED = 9; 226 public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10; 227 public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11; 228 229 230 /** 231 * Get the current ServiceState. Use 232 * <code>registerForServiceStateChanged</code> to be informed of 233 * updates. 234 */ getServiceState()235 ServiceState getServiceState(); 236 237 /** 238 * Get the current DataState. No change notification exists at this 239 * interface -- use 240 * {@link android.telephony.PhoneStateListener} instead. 241 * @param apnType specify for which apn to get connection state info. 242 */ getDataConnectionState(String apnType)243 DataState getDataConnectionState(String apnType); 244 245 /** 246 * Get the current Precise DataState. No change notification exists at this 247 * interface -- use 248 * {@link android.telephony.PhoneStateListener} instead. 249 * 250 * @param apnType specify for which apn to get connection state info. 251 * @return the PreciseDataConnectionState for the data connection supporting apnType 252 */ getPreciseDataConnectionState(String apnType)253 PreciseDataConnectionState getPreciseDataConnectionState(String apnType); 254 255 /** 256 * Get the current DataActivityState. No change notification exists at this 257 * interface -- use 258 * {@link android.telephony.TelephonyManager} instead. 259 */ getDataActivityState()260 DataActivityState getDataActivityState(); 261 262 /** 263 * Returns a list of MMI codes that are pending. (They have initiated 264 * but have not yet completed). 265 * Presently there is only ever one. 266 * Use <code>registerForMmiInitiate</code> 267 * and <code>registerForMmiComplete</code> for change notification. 268 */ getPendingMmiCodes()269 public List<? extends MmiCode> getPendingMmiCodes(); 270 271 /** 272 * Sends user response to a USSD REQUEST message. An MmiCode instance 273 * representing this response is sent to handlers registered with 274 * registerForMmiInitiate. 275 * 276 * @param ussdMessge Message to send in the response. 277 */ sendUssdResponse(String ussdMessge)278 public void sendUssdResponse(String ussdMessge); 279 280 /** 281 * Register for Supplementary Service notifications from the network. 282 * Message.obj will contain an AsyncResult. 283 * AsyncResult.result will be a SuppServiceNotification instance. 284 * 285 * @param h Handler that receives the notification message. 286 * @param what User-defined message code. 287 * @param obj User object. 288 */ registerForSuppServiceNotification(Handler h, int what, Object obj)289 void registerForSuppServiceNotification(Handler h, int what, Object obj); 290 291 /** 292 * Unregisters for Supplementary Service notifications. 293 * Extraneous calls are tolerated silently 294 * 295 * @param h Handler to be removed from the registrant list. 296 */ unregisterForSuppServiceNotification(Handler h)297 void unregisterForSuppServiceNotification(Handler h); 298 299 /** 300 * Answers a ringing or waiting call. Active calls, if any, go on hold. 301 * Answering occurs asynchronously, and final notification occurs via 302 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 303 * java.lang.Object) registerForPreciseCallStateChanged()}. 304 * 305 * @param videoState The video state in which to answer the call. 306 * @exception CallStateException when no call is ringing or waiting 307 */ acceptCall(int videoState)308 void acceptCall(int videoState) throws CallStateException; 309 310 /** 311 * Reject (ignore) a ringing call. In GSM, this means UDUB 312 * (User Determined User Busy). Reject occurs asynchronously, 313 * and final notification occurs via 314 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 315 * java.lang.Object) registerForPreciseCallStateChanged()}. 316 * 317 * @exception CallStateException when no call is ringing or waiting 318 */ rejectCall()319 void rejectCall() throws CallStateException; 320 321 /** 322 * Places any active calls on hold, and makes any held calls 323 * active. Switch occurs asynchronously and may fail. 324 * Final notification occurs via 325 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 326 * java.lang.Object) registerForPreciseCallStateChanged()}. 327 * 328 * @exception CallStateException if a call is ringing, waiting, or 329 * dialing/alerting. In these cases, this operation may not be performed. 330 */ switchHoldingAndActive()331 void switchHoldingAndActive() throws CallStateException; 332 333 /** 334 * Whether or not the phone can conference in the current phone 335 * state--that is, one call holding and one call active. 336 * @return true if the phone can conference; false otherwise. 337 */ canConference()338 boolean canConference(); 339 340 /** 341 * Conferences holding and active. Conference occurs asynchronously 342 * and may fail. Final notification occurs via 343 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 344 * java.lang.Object) registerForPreciseCallStateChanged()}. 345 * 346 * @exception CallStateException if canConference() would return false. 347 * In these cases, this operation may not be performed. 348 */ conference()349 void conference() throws CallStateException; 350 351 /** 352 * Whether or not the phone can do explicit call transfer in the current 353 * phone state--that is, one call holding and one call active. 354 * @return true if the phone can do explicit call transfer; false otherwise. 355 */ canTransfer()356 boolean canTransfer(); 357 358 /** 359 * Connects the two calls and disconnects the subscriber from both calls 360 * Explicit Call Transfer occurs asynchronously 361 * and may fail. Final notification occurs via 362 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 363 * java.lang.Object) registerForPreciseCallStateChanged()}. 364 * 365 * @exception CallStateException if canTransfer() would return false. 366 * In these cases, this operation may not be performed. 367 */ explicitCallTransfer()368 void explicitCallTransfer() throws CallStateException; 369 370 /** 371 * Clears all DISCONNECTED connections from Call connection lists. 372 * Calls that were in the DISCONNECTED state become idle. This occurs 373 * synchronously. 374 */ clearDisconnected()375 void clearDisconnected(); 376 377 /** 378 * Gets the foreground call object, which represents all connections that 379 * are dialing or active (all connections 380 * that have their audio path connected).<p> 381 * 382 * The foreground call is a singleton object. It is constant for the life 383 * of this phone. It is never null.<p> 384 * 385 * The foreground call will only ever be in one of these states: 386 * IDLE, ACTIVE, DIALING, ALERTING, or DISCONNECTED. 387 * 388 * State change notification is available via 389 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 390 * java.lang.Object) registerForPreciseCallStateChanged()}. 391 */ getForegroundCall()392 Call getForegroundCall(); 393 394 /** 395 * Gets the background call object, which represents all connections that 396 * are holding (all connections that have been accepted or connected, but 397 * do not have their audio path connected). <p> 398 * 399 * The background call is a singleton object. It is constant for the life 400 * of this phone object . It is never null.<p> 401 * 402 * The background call will only ever be in one of these states: 403 * IDLE, HOLDING or DISCONNECTED. 404 * 405 * State change notification is available via 406 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 407 * java.lang.Object) registerForPreciseCallStateChanged()}. 408 */ getBackgroundCall()409 Call getBackgroundCall(); 410 411 /** 412 * Gets the ringing call object, which represents an incoming 413 * connection (if present) that is pending answer/accept. (This connection 414 * may be RINGING or WAITING, and there may be only one.)<p> 415 416 * The ringing call is a singleton object. It is constant for the life 417 * of this phone. It is never null.<p> 418 * 419 * The ringing call will only ever be in one of these states: 420 * IDLE, INCOMING, WAITING or DISCONNECTED. 421 * 422 * State change notification is available via 423 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 424 * java.lang.Object) registerForPreciseCallStateChanged()}. 425 */ getRingingCall()426 Call getRingingCall(); 427 428 /** 429 * Initiate a new voice connection. This happens asynchronously, so you 430 * cannot assume the audio path is connected (or a call index has been 431 * assigned) until PhoneStateChanged notification has occurred. 432 * 433 * @param dialString The dial string. 434 * @param dialArgs Parameters to perform the dial with. 435 * @exception CallStateException if a new outgoing call is not currently 436 * possible because no more call slots exist or a call exists 437 * that is dialing, alerting, ringing, or waiting. Other 438 * errors are handled asynchronously. 439 */ dial(String dialString, @NonNull DialArgs dialArgs)440 Connection dial(String dialString, @NonNull DialArgs dialArgs) throws CallStateException; 441 442 /** 443 * Initiate a new conference connection. This happens asynchronously, so you 444 * cannot assume the audio path is connected (or a call index has been 445 * assigned) until PhoneStateChanged notification has occurred. 446 * 447 * @param participantsToDial The participants to dial. 448 * @param dialArgs Parameters to perform the start conference with. 449 * @exception CallStateException if a new outgoing call is not currently 450 * possible because no more call slots exist or a call exists 451 * that is dialing, alerting, ringing, or waiting. Other 452 * errors are handled asynchronously. 453 */ startConference(String[] participantsToDial, @NonNull DialArgs dialArgs)454 Connection startConference(String[] participantsToDial, @NonNull DialArgs dialArgs) 455 throws CallStateException; 456 457 /** 458 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 459 * without SEND (so <code>dial</code> is not appropriate). 460 * 461 * @param dialString the MMI command to be executed. 462 * @return true if MMI command is executed. 463 */ handlePinMmi(String dialString)464 boolean handlePinMmi(String dialString); 465 466 /** 467 * Handles USSD commands 468 * 469 * @param ussdRequest the USSD command to be executed. 470 * @param wrappedCallback receives the callback result. 471 */ handleUssdRequest(String ussdRequest, ResultReceiver wrappedCallback)472 boolean handleUssdRequest(String ussdRequest, ResultReceiver wrappedCallback) 473 throws CallStateException; 474 475 /** 476 * Handles in-call MMI commands. While in a call, or while receiving a 477 * call, use this to execute MMI commands. 478 * see 3GPP 20.030, section 6.5.5.1 for specs on the allowed MMI commands. 479 * 480 * @param command the MMI command to be executed. 481 * @return true if the MMI command is executed. 482 * @throws CallStateException 483 */ handleInCallMmiCommands(String command)484 boolean handleInCallMmiCommands(String command) throws CallStateException; 485 486 /** 487 * Play a DTMF tone on the active call. Ignored if there is no active call. 488 * @param c should be one of 0-9, '*' or '#'. Other values will be 489 * silently ignored. 490 */ sendDtmf(char c)491 void sendDtmf(char c); 492 493 /** 494 * Start to paly a DTMF tone on the active call. Ignored if there is no active call 495 * or there is a playing DTMF tone. 496 * @param c should be one of 0-9, '*' or '#'. Other values will be 497 * silently ignored. 498 */ startDtmf(char c)499 void startDtmf(char c); 500 501 /** 502 * Stop the playing DTMF tone. Ignored if there is no playing DTMF 503 * tone or no active call. 504 */ stopDtmf()505 void stopDtmf(); 506 507 /** 508 * Sets the radio power on/off state (off is sometimes 509 * called "airplane mode"). Current state can be gotten via 510 * {@link #getServiceState()}.{@link 511 * android.telephony.ServiceState#getState() getState()}. 512 * <strong>Note: </strong>This request is asynchronous. 513 * getServiceState().getState() will not change immediately after this call. 514 * registerForServiceStateChanged() to find out when the 515 * request is complete. 516 * 517 * @param power true means "on", false means "off". 518 */ setRadioPower(boolean power)519 default void setRadioPower(boolean power) { 520 setRadioPower(power, false, false, false); 521 } 522 523 /** 524 * Sets the radio power on/off state with option to specify whether it's for emergency call 525 * (off is sometimes called "airplane mode"). Current state can be gotten via 526 * {@link #getServiceState()}.{@link 527 * android.telephony.ServiceState#getState() getState()}. 528 * <strong>Note: </strong>This request is asynchronous. 529 * getServiceState().getState() will not change immediately after this call. 530 * registerForServiceStateChanged() to find out when the 531 * request is complete. 532 * 533 * @param power true means "on", false means "off". 534 * @param forEmergencyCall true means the purpose of turning radio power on is for emergency 535 * call. No effect if power is set false. 536 * @param isSelectedPhoneForEmergencyCall true means this phone / modem is selected to place 537 * emergency call after turning power on. No effect if power 538 * or forEmergency is set false. 539 * @param forceApply true means always call setRadioPower HAL API without checking against 540 * current radio power state. It's needed when: radio was powered on into 541 * emergency call mode, to exit from that mode, we set radio 542 * power on again with forEmergencyCall being false. 543 */ setRadioPower(boolean power, boolean forEmergencyCall, boolean isSelectedPhoneForEmergencyCall, boolean forceApply)544 default void setRadioPower(boolean power, boolean forEmergencyCall, 545 boolean isSelectedPhoneForEmergencyCall, boolean forceApply) {} 546 547 /** 548 * Get the line 1 phone number (MSISDN). For CDMA phones, the MDN is returned 549 * and {@link #getMsisdn()} will return the MSISDN on CDMA/LTE phones.<p> 550 * 551 * @return phone number. May return null if not 552 * available or the SIM is not ready 553 */ getLine1Number()554 String getLine1Number(); 555 556 /** 557 * Returns the alpha tag associated with the msisdn number. 558 * If there is no alpha tag associated or the record is not yet available, 559 * returns a default localized string. <p> 560 */ getLine1AlphaTag()561 String getLine1AlphaTag(); 562 563 /** 564 * Sets the MSISDN phone number in the SIM card. 565 * 566 * @param alphaTag the alpha tag associated with the MSISDN phone number 567 * (see getMsisdnAlphaTag) 568 * @param number the new MSISDN phone number to be set on the SIM. 569 * @param onComplete a callback message when the action is completed. 570 * 571 * @return true if req is sent, false otherwise. If req is not sent there will be no response, 572 * that is, onComplete will never be sent. 573 */ setLine1Number(String alphaTag, String number, Message onComplete)574 boolean setLine1Number(String alphaTag, String number, Message onComplete); 575 576 /** 577 * Get the voice mail access phone number. Typically dialed when the 578 * user holds the "1" key in the phone app. May return null if not 579 * available or the SIM is not ready.<p> 580 */ getVoiceMailNumber()581 String getVoiceMailNumber(); 582 583 /** 584 * Returns the alpha tag associated with the voice mail number. 585 * If there is no alpha tag associated or the record is not yet available, 586 * returns a default localized string. <p> 587 * 588 * Please use this value instead of some other localized string when 589 * showing a name for this number in the UI. For example, call log 590 * entries should show this alpha tag. <p> 591 * 592 * Usage of this alpha tag in the UI is a common carrier requirement. 593 */ getVoiceMailAlphaTag()594 String getVoiceMailAlphaTag(); 595 596 /** 597 * setVoiceMailNumber 598 * sets the voicemail number in the SIM card. 599 * 600 * @param alphaTag the alpha tag associated with the voice mail number 601 * (see getVoiceMailAlphaTag) 602 * @param voiceMailNumber the new voicemail number to be set on the SIM. 603 * @param onComplete a callback message when the action is completed. 604 */ setVoiceMailNumber(String alphaTag, String voiceMailNumber, Message onComplete)605 void setVoiceMailNumber(String alphaTag, 606 String voiceMailNumber, 607 Message onComplete); 608 609 /** 610 * getCallForwardingOptions 611 * gets a call forwarding option for SERVICE_CLASS_VOICE. The return value of 612 * ((AsyncResult)onComplete.obj) is an array of CallForwardInfo. 613 * 614 * @param commandInterfaceCFReason is one of the valid call forwarding 615 * CF_REASONS, as defined in 616 * <code>com.android.internal.telephony.CommandsInterface.</code> 617 * @param onComplete a callback message when the action is completed. 618 * @see com.android.internal.telephony.CallForwardInfo for details. 619 */ getCallForwardingOption(int commandInterfaceCFReason, Message onComplete)620 void getCallForwardingOption(int commandInterfaceCFReason, 621 Message onComplete); 622 623 /** 624 * getCallForwardingOptions 625 * gets a call forwarding option. The return value of 626 * ((AsyncResult)onComplete.obj) is an array of CallForwardInfo. 627 * 628 * @param commandInterfaceCFReason is one of the valid call forwarding 629 * CF_REASONS, as defined in 630 * <code>com.android.internal.telephony.CommandsInterface.</code> 631 * @param serviceClass is a sum of SERVICE_CLASS_* as defined in 632 * <code>com.android.internal.telephony.CommandsInterface.</code> 633 * @param onComplete a callback message when the action is completed. 634 * @see com.android.internal.telephony.CallForwardInfo for details. 635 */ getCallForwardingOption(int commandInterfaceCFReason, int serviceClass, Message onComplete)636 void getCallForwardingOption(int commandInterfaceCFReason, int serviceClass, 637 Message onComplete); 638 639 /** 640 * setCallForwardingOptions 641 * sets a call forwarding option for SERVICE_CLASS_VOICE. 642 * 643 * @param commandInterfaceCFAction is one of the valid call forwarding 644 * CF_ACTIONS, as defined in 645 * <code>com.android.internal.telephony.CommandsInterface.</code> 646 * @param commandInterfaceCFReason is one of the valid call forwarding 647 * CF_REASONS, as defined in 648 * <code>com.android.internal.telephony.CommandsInterface.</code> 649 * @param dialingNumber is the target phone number to forward calls to 650 * @param timerSeconds is used by CFNRy to indicate the timeout before 651 * forwarding is attempted. 652 * @param onComplete a callback message when the action is completed. 653 */ setCallForwardingOption(int commandInterfaceCFAction, int commandInterfaceCFReason, String dialingNumber, int timerSeconds, Message onComplete)654 void setCallForwardingOption(int commandInterfaceCFAction, 655 int commandInterfaceCFReason, 656 String dialingNumber, 657 int timerSeconds, 658 Message onComplete); 659 660 /** 661 * setCallForwardingOptions 662 * sets a call forwarding option. 663 * 664 * @param commandInterfaceCFAction is one of the valid call forwarding 665 * CF_ACTIONS, as defined in 666 * <code>com.android.internal.telephony.CommandsInterface.</code> 667 * @param commandInterfaceCFReason is one of the valid call forwarding 668 * CF_REASONS, as defined in 669 * <code>com.android.internal.telephony.CommandsInterface.</code> 670 * @param dialingNumber is the target phone number to forward calls to 671 * @param serviceClass is a sum of SERVICE_CLASS_* as defined in 672 * <code>com.android.internal.telephony.CommandsInterface.</code> 673 * @param timerSeconds is used by CFNRy to indicate the timeout before 674 * forwarding is attempted. 675 * @param onComplete a callback message when the action is completed. 676 */ setCallForwardingOption(int commandInterfaceCFAction, int commandInterfaceCFReason, String dialingNumber, int serviceClass, int timerSeconds, Message onComplete)677 void setCallForwardingOption(int commandInterfaceCFAction, 678 int commandInterfaceCFReason, 679 String dialingNumber, 680 int serviceClass, 681 int timerSeconds, 682 Message onComplete); 683 684 /** 685 * Gets a call barring option. The return value of ((AsyncResult) onComplete.obj) will be an 686 * Integer representing the sum of enabled serivice classes (sum of SERVICE_CLASS_*) 687 * 688 * @param facility is one of CB_FACILTY_* 689 * @param password is password or "" if not required 690 * @param serviceClass is a sum of SERVICE_CLASS_* 691 * @param onComplete is callback message when the action is completed. 692 */ getCallBarring(String facility, String password, Message onComplete, int serviceClass)693 public void getCallBarring(String facility, 694 String password, 695 Message onComplete, 696 int serviceClass); 697 698 /** 699 * Sets a call barring option. 700 * 701 * @param facility is one of CB_FACILTY_* 702 * @param lockState is true means lock, false means unlock 703 * @param password is password or "" if not required 704 * @param serviceClass is a sum of SERVICE_CLASS_* 705 * @param onComplete is callback message when the action is completed. 706 */ setCallBarring(String facility, boolean lockState, String password, Message onComplete, int serviceClass)707 public void setCallBarring(String facility, 708 boolean lockState, 709 String password, 710 Message onComplete, 711 int serviceClass); 712 713 /** 714 * getOutgoingCallerIdDisplay 715 * gets outgoing caller id display. The return value of 716 * ((AsyncResult)onComplete.obj) is an array of int, with a length of 2. 717 * 718 * @param onComplete a callback message when the action is completed. 719 * @see com.android.internal.telephony.CommandsInterface#getCLIR for details. 720 */ getOutgoingCallerIdDisplay(Message onComplete)721 void getOutgoingCallerIdDisplay(Message onComplete); 722 723 /** 724 * setOutgoingCallerIdDisplay 725 * sets a call forwarding option. 726 * 727 * @param commandInterfaceCLIRMode is one of the valid call CLIR 728 * modes, as defined in 729 * <code>com.android.internal.telephony.CommandsInterface./code> 730 * @param onComplete a callback message when the action is completed. 731 */ setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete)732 void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, 733 Message onComplete); 734 735 /** 736 * getCallWaiting 737 * gets call waiting activation state. The return value of 738 * ((AsyncResult)onComplete.obj) is an array of int, with a length of 1. 739 * 740 * @param onComplete a callback message when the action is completed. 741 * @see com.android.internal.telephony.CommandsInterface#queryCallWaiting for details. 742 */ getCallWaiting(Message onComplete)743 void getCallWaiting(Message onComplete); 744 745 /** 746 * setCallWaiting 747 * sets a call forwarding option. 748 * 749 * @param enable is a boolean representing the state that you are 750 * requesting, true for enabled, false for disabled. 751 * @param onComplete a callback message when the action is completed. 752 */ setCallWaiting(boolean enable, Message onComplete)753 void setCallWaiting(boolean enable, Message onComplete); 754 755 /** 756 * Scan available networks. This method is asynchronous; . 757 * On completion, <code>response.obj</code> is set to an AsyncResult with 758 * one of the following members:.<p> 759 *<ul> 760 * <li><code>response.obj.result</code> will be a <code>List</code> of 761 * <code>OperatorInfo</code> objects, or</li> 762 * <li><code>response.obj.exception</code> will be set with an exception 763 * on failure.</li> 764 * </ul> 765 */ getAvailableNetworks(Message response)766 void getAvailableNetworks(Message response); 767 768 /** 769 * Start a network scan. This method is asynchronous; . 770 * On completion, <code>response.obj</code> is set to an AsyncResult with 771 * one of the following members:.<p> 772 * <ul> 773 * <li><code>response.obj.result</code> will be a <code>NetworkScanResult</code> object, or</li> 774 * <li><code>response.obj.exception</code> will be set with an exception 775 * on failure.</li> 776 * </ul> 777 */ startNetworkScan(NetworkScanRequest nsr, Message response)778 void startNetworkScan(NetworkScanRequest nsr, Message response); 779 780 /** 781 * Stop ongoing network scan. This method is asynchronous; . 782 * On completion, <code>response.obj</code> is set to an AsyncResult with 783 * one of the following members:.<p> 784 * <ul> 785 * <li><code>response.obj.result</code> will be a <code>NetworkScanResult</code> object, or</li> 786 * <li><code>response.obj.exception</code> will be set with an exception 787 * on failure.</li> 788 * </ul> 789 */ stopNetworkScan(Message response)790 void stopNetworkScan(Message response); 791 792 /** 793 * Mutes or unmutes the microphone for the active call. The microphone 794 * is automatically unmuted if a call is answered, dialed, or resumed 795 * from a holding state. 796 * 797 * @param muted true to mute the microphone, 798 * false to activate the microphone. 799 */ 800 setMute(boolean muted)801 void setMute(boolean muted); 802 803 /** 804 * Gets current mute status. Use 805 * {@link #registerForPreciseCallStateChanged(android.os.Handler, int, 806 * java.lang.Object) registerForPreciseCallStateChanged()} 807 * as a change notifcation, although presently phone state changed is not 808 * fired when setMute() is called. 809 * 810 * @return true is muting, false is unmuting 811 */ getMute()812 boolean getMute(); 813 814 /** 815 * Update the ServiceState CellLocation for current network registration. 816 * 817 * @param workSource the caller to be billed for work. 818 */ updateServiceLocation(WorkSource workSource)819 default void updateServiceLocation(WorkSource workSource) {} 820 821 /** 822 * To be deleted. 823 */ updateServiceLocation()824 default void updateServiceLocation() {} 825 826 /** 827 * Enable location update notifications. 828 */ enableLocationUpdates()829 void enableLocationUpdates(); 830 831 /** 832 * Disable location update notifications. 833 */ disableLocationUpdates()834 void disableLocationUpdates(); 835 836 /** 837 * @return true if enable data connection on roaming 838 */ getDataRoamingEnabled()839 boolean getDataRoamingEnabled(); 840 841 /** 842 * @param enable set true if enable data connection on roaming 843 */ setDataRoamingEnabled(boolean enable)844 void setDataRoamingEnabled(boolean enable); 845 846 /** 847 * @return true if user has enabled data 848 */ isUserDataEnabled()849 boolean isUserDataEnabled(); 850 851 /** 852 * Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones. 853 */ getDeviceId()854 String getDeviceId(); 855 856 /** 857 * Retrieves the software version number for the device, e.g., IMEI/SV 858 * for GSM phones. 859 */ getDeviceSvn()860 String getDeviceSvn(); 861 862 /** 863 * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones. 864 */ getSubscriberId()865 String getSubscriberId(); 866 867 /** 868 * Retrieves the Group Identifier Level1 for GSM phones. 869 */ getGroupIdLevel1()870 String getGroupIdLevel1(); 871 872 /** 873 * Retrieves the Group Identifier Level2 for phones. 874 */ getGroupIdLevel2()875 String getGroupIdLevel2(); 876 877 /* CDMA support methods */ 878 879 /** 880 * Retrieves the ESN for CDMA phones. 881 */ getEsn()882 String getEsn(); 883 884 /** 885 * Retrieves MEID for CDMA phones. 886 */ getMeid()887 String getMeid(); 888 889 /** 890 * Retrieves IMEI for phones. Returns null if IMEI is not set. 891 */ getImei()892 String getImei(); 893 894 /** 895 * Retrieves the IccPhoneBookInterfaceManager of the Phone 896 */ getIccPhoneBookInterfaceManager()897 public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(); 898 899 /** 900 * Activate or deactivate cell broadcast SMS. 901 * 902 * @param activate 903 * 0 = activate, 1 = deactivate 904 * @param response 905 * Callback message is empty on completion 906 */ activateCellBroadcastSms(int activate, Message response)907 void activateCellBroadcastSms(int activate, Message response); 908 909 /** 910 * Query the current configuration of cdma cell broadcast SMS. 911 * 912 * @param response 913 * Callback message is empty on completion 914 */ getCellBroadcastSmsConfig(Message response)915 void getCellBroadcastSmsConfig(Message response); 916 917 /** 918 * Configure cell broadcast SMS. 919 * 920 * TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig 921 * 922 * @param response 923 * Callback message is empty on completion 924 */ setCellBroadcastSmsConfig(int[] configValuesArray, Message response)925 public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response); 926 927 /* 928 * Sets the carrier information needed to encrypt the IMSI and IMPI. 929 * @param imsiEncryptionInfo Carrier specific information that will be used to encrypt the 930 * IMSI and IMPI. This includes the Key type, the Public key 931 * {@link java.security.PublicKey} and the Key identifier. 932 */ setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo)933 public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo); 934 935 /** 936 * Returns Carrier specific information that will be used to encrypt the IMSI and IMPI. 937 * @param keyType whether the key is being used for WLAN or ePDG. 938 * @return ImsiEncryptionInfo which includes the Key Type, the Public Key 939 * {@link java.security.PublicKey} and the Key Identifier. 940 * The keyIdentifier This is used by the server to help it locate the private key to 941 * decrypt the permanent identity. 942 */ getCarrierInfoForImsiEncryption(int keyType)943 public ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int keyType); 944 945 /** 946 * Resets the Carrier Keys, by deleting them from the database and sending a download intent. 947 */ resetCarrierKeysForImsiEncryption()948 public void resetCarrierKeysForImsiEncryption(); 949 } 950