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