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.telephony.CellInfo; 21 import android.telephony.NeighboringCellInfo; 22 23 import com.android.internal.telephony.ITelephonyListener; 24 25 import java.util.List; 26 27 /** 28 * Interface used to interact with the phone. Mostly this is used by the 29 * TelephonyManager class. A few places are still using this directly. 30 * Please clean them up if possible and use TelephonyManager insteadl. 31 * 32 * {@hide} 33 */ 34 interface ITelephony { 35 36 /** 37 * Dial a number. This doesn't place the call. It displays 38 * the Dialer screen. 39 * @param number the number to be dialed. If null, this 40 * would display the Dialer screen with no number pre-filled. 41 */ dial(String number)42 void dial(String number); 43 44 /** 45 * Place a call to the specified number. 46 * @param number the number to be called. 47 */ call(String callingPackage, String number)48 void call(String callingPackage, String number); 49 50 /** 51 * If there is currently a call in progress, show the call screen. 52 * The DTMF dialpad may or may not be visible initially, depending on 53 * whether it was up when the user last exited the InCallScreen. 54 * 55 * @return true if the call screen was shown. 56 */ showCallScreen()57 boolean showCallScreen(); 58 59 /** 60 * Variation of showCallScreen() that also specifies whether the 61 * DTMF dialpad should be initially visible when the InCallScreen 62 * comes up. 63 * 64 * @param showDialpad if true, make the dialpad visible initially, 65 * otherwise hide the dialpad initially. 66 * @return true if the call screen was shown. 67 * 68 * @see showCallScreen 69 */ showCallScreenWithDialpad(boolean showDialpad)70 boolean showCallScreenWithDialpad(boolean showDialpad); 71 72 /** 73 * End call if there is a call in progress, otherwise does nothing. 74 * 75 * @return whether it hung up 76 */ endCall()77 boolean endCall(); 78 79 /** 80 * Answer the currently-ringing call. 81 * 82 * If there's already a current active call, that call will be 83 * automatically put on hold. If both lines are currently in use, the 84 * current active call will be ended. 85 * 86 * TODO: provide a flag to let the caller specify what policy to use 87 * if both lines are in use. (The current behavior is hardwired to 88 * "answer incoming, end ongoing", which is how the CALL button 89 * is specced to behave.) 90 * 91 * TODO: this should be a oneway call (especially since it's called 92 * directly from the key queue thread). 93 */ answerRingingCall()94 void answerRingingCall(); 95 96 /** 97 * Silence the ringer if an incoming call is currently ringing. 98 * (If vibrating, stop the vibrator also.) 99 * 100 * It's safe to call this if the ringer has already been silenced, or 101 * even if there's no incoming call. (If so, this method will do nothing.) 102 * 103 * TODO: this should be a oneway call too (see above). 104 * (Actually *all* the methods here that return void can 105 * probably be oneway.) 106 */ silenceRinger()107 void silenceRinger(); 108 109 /** 110 * Check if we are in either an active or holding call 111 * @return true if the phone state is OFFHOOK. 112 */ isOffhook()113 boolean isOffhook(); 114 115 /** 116 * Check if an incoming phone call is ringing or call waiting. 117 * @return true if the phone state is RINGING. 118 */ isRinging()119 boolean isRinging(); 120 121 /** 122 * Check if the phone is idle. 123 * @return true if the phone state is IDLE. 124 */ isIdle()125 boolean isIdle(); 126 127 /** 128 * Check to see if the radio is on or not. 129 * @return returns true if the radio is on. 130 */ isRadioOn()131 boolean isRadioOn(); 132 133 /** 134 * Check if the SIM pin lock is enabled. 135 * @return true if the SIM pin lock is enabled. 136 */ isSimPinEnabled()137 boolean isSimPinEnabled(); 138 139 /** 140 * Cancels the missed calls notification. 141 */ cancelMissedCallsNotification()142 void cancelMissedCallsNotification(); 143 144 /** 145 * Supply a pin to unlock the SIM. Blocks until a result is determined. 146 * @param pin The pin to check. 147 * @return whether the operation was a success. 148 */ supplyPin(String pin)149 boolean supplyPin(String pin); 150 151 /** 152 * Supply puk to unlock the SIM and set SIM pin to new pin. 153 * Blocks until a result is determined. 154 * @param puk The puk to check. 155 * pin The new pin to be set in SIM 156 * @return whether the operation was a success. 157 */ supplyPuk(String puk, String pin)158 boolean supplyPuk(String puk, String pin); 159 160 /** 161 * Supply a pin to unlock the SIM. Blocks until a result is determined. 162 * Returns a specific success/error code. 163 * @param pin The pin to check. 164 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 165 * retValue[1] = number of attempts remaining if known otherwise -1 166 */ supplyPinReportResult(String pin)167 int[] supplyPinReportResult(String pin); 168 169 /** 170 * Supply puk to unlock the SIM and set SIM pin to new pin. 171 * Blocks until a result is determined. 172 * Returns a specific success/error code 173 * @param puk The puk to check 174 * pin The pin to check. 175 * @return retValue[0] = Phone.PIN_RESULT_SUCCESS on success. Otherwise error code 176 * retValue[1] = number of attempts remaining if known otherwise -1 177 */ supplyPukReportResult(String puk, String pin)178 int[] supplyPukReportResult(String puk, String pin); 179 180 /** 181 * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated 182 * without SEND (so <code>dial</code> is not appropriate). 183 * 184 * @param dialString the MMI command to be executed. 185 * @return true if MMI command is executed. 186 */ handlePinMmi(String dialString)187 boolean handlePinMmi(String dialString); 188 189 /** 190 * Toggles the radio on or off. 191 */ toggleRadioOnOff()192 void toggleRadioOnOff(); 193 194 /** 195 * Set the radio to on or off 196 */ setRadio(boolean turnOn)197 boolean setRadio(boolean turnOn); 198 199 /** 200 * Set the radio to on or off unconditionally 201 */ setRadioPower(boolean turnOn)202 boolean setRadioPower(boolean turnOn); 203 204 /** 205 * Request to update location information in service state 206 */ updateServiceLocation()207 void updateServiceLocation(); 208 209 /** 210 * Enable location update notifications. 211 */ enableLocationUpdates()212 void enableLocationUpdates(); 213 214 /** 215 * Disable location update notifications. 216 */ disableLocationUpdates()217 void disableLocationUpdates(); 218 219 /** 220 * Enable a specific APN type. 221 */ enableApnType(String type)222 int enableApnType(String type); 223 224 /** 225 * Disable a specific APN type. 226 */ disableApnType(String type)227 int disableApnType(String type); 228 229 /** 230 * Allow mobile data connections. 231 */ enableDataConnectivity()232 boolean enableDataConnectivity(); 233 234 /** 235 * Disallow mobile data connections. 236 */ disableDataConnectivity()237 boolean disableDataConnectivity(); 238 239 /** 240 * Report whether data connectivity is possible. 241 */ isDataConnectivityPossible()242 boolean isDataConnectivityPossible(); 243 getCellLocation()244 Bundle getCellLocation(); 245 246 /** 247 * Returns the neighboring cell information of the device. 248 */ getNeighboringCellInfo(String callingPkg)249 List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg); 250 getCallState()251 int getCallState(); getDataActivity()252 int getDataActivity(); getDataState()253 int getDataState(); 254 255 /** 256 * Returns the current active phone type as integer. 257 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE 258 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE 259 */ getActivePhoneType()260 int getActivePhoneType(); 261 262 /** 263 * Returns the CDMA ERI icon index to display 264 */ getCdmaEriIconIndex()265 int getCdmaEriIconIndex(); 266 267 /** 268 * Returns the CDMA ERI icon mode, 269 * 0 - ON 270 * 1 - FLASHING 271 */ getCdmaEriIconMode()272 int getCdmaEriIconMode(); 273 274 /** 275 * Returns the CDMA ERI text, 276 */ getCdmaEriText()277 String getCdmaEriText(); 278 279 /** 280 * Returns true if OTA service provisioning needs to run. 281 * Only relevant on some technologies, others will always 282 * return false. 283 */ needsOtaServiceProvisioning()284 boolean needsOtaServiceProvisioning(); 285 286 /** 287 * Returns the unread count of voicemails 288 */ getVoiceMessageCount()289 int getVoiceMessageCount(); 290 291 /** 292 * Returns the network type for data transmission 293 */ getNetworkType()294 int getNetworkType(); 295 296 /** 297 * Returns the network type for data transmission 298 */ getDataNetworkType()299 int getDataNetworkType(); 300 301 /** 302 * Returns the network type for voice 303 */ getVoiceNetworkType()304 int getVoiceNetworkType(); 305 306 /** 307 * Return true if an ICC card is present 308 */ hasIccCard()309 boolean hasIccCard(); 310 311 /** 312 * Return if the current radio is LTE on CDMA. This 313 * is a tri-state return value as for a period of time 314 * the mode may be unknown. 315 * 316 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} 317 * or {@link PHone#LTE_ON_CDMA_TRUE} 318 */ getLteOnCdmaMode()319 int getLteOnCdmaMode(); 320 321 /** 322 * Returns the all observed cell information of the device. 323 */ getAllCellInfo()324 List<CellInfo> getAllCellInfo(); 325 326 /** 327 * Sets minimum time in milli-seconds between onCellInfoChanged 328 */ setCellInfoListRate(int rateInMillis)329 void setCellInfoListRate(int rateInMillis); 330 331 /** 332 * Put a call on hold. 333 */ toggleHold()334 void toggleHold(); 335 336 /** 337 * Merge foreground and background calls. 338 */ merge()339 void merge(); 340 341 /** 342 * Swap foreground and background calls. 343 */ swap()344 void swap(); 345 346 /** 347 * Mute the phone. 348 */ mute(boolean mute)349 void mute(boolean mute); 350 351 /** 352 * Start playing DTMF tone for the specified digit. 353 * 354 * @param digit the digit that corresponds with the desired tone. 355 * @param timedShortcode whether the specified digit should be played as a timed short code. 356 */ playDtmfTone(char digit, boolean timedShortCode)357 void playDtmfTone(char digit, boolean timedShortCode); 358 359 /** 360 * Stop playing DTMF tones. 361 */ stopDtmfTone()362 void stopDtmfTone(); 363 364 /** 365 * Register a callback. 366 */ addListener(ITelephonyListener listener)367 void addListener(ITelephonyListener listener); 368 369 /** 370 * Unregister a callback. 371 */ removeListener(ITelephonyListener listener)372 void removeListener(ITelephonyListener listener); 373 } 374 375