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