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 number)45 void call(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 * Request to update location information in service state 178 */ updateServiceLocation()179 void updateServiceLocation(); 180 181 /** 182 * Enable location update notifications. 183 */ enableLocationUpdates()184 void enableLocationUpdates(); 185 186 /** 187 * Disable location update notifications. 188 */ disableLocationUpdates()189 void disableLocationUpdates(); 190 191 /** 192 * Enable a specific APN type. 193 */ enableApnType(String type)194 int enableApnType(String type); 195 196 /** 197 * Disable a specific APN type. 198 */ disableApnType(String type)199 int disableApnType(String type); 200 201 /** 202 * Allow mobile data connections. 203 */ enableDataConnectivity()204 boolean enableDataConnectivity(); 205 206 /** 207 * Disallow mobile data connections. 208 */ disableDataConnectivity()209 boolean disableDataConnectivity(); 210 211 /** 212 * Report whether data connectivity is possible. 213 */ isDataConnectivityPossible()214 boolean isDataConnectivityPossible(); 215 getCellLocation()216 Bundle getCellLocation(); 217 218 /** 219 * Returns the neighboring cell information of the device. 220 */ getNeighboringCellInfo()221 List<NeighboringCellInfo> getNeighboringCellInfo(); 222 getCallState()223 int getCallState(); getDataActivity()224 int getDataActivity(); getDataState()225 int getDataState(); 226 227 /** 228 * Returns the current active phone type as integer. 229 * Returns TelephonyManager.PHONE_TYPE_CDMA if RILConstants.CDMA_PHONE 230 * and TelephonyManager.PHONE_TYPE_GSM if RILConstants.GSM_PHONE 231 */ getActivePhoneType()232 int getActivePhoneType(); 233 234 /** 235 * Returns the CDMA ERI icon index to display 236 */ getCdmaEriIconIndex()237 int getCdmaEriIconIndex(); 238 239 /** 240 * Returns the CDMA ERI icon mode, 241 * 0 - ON 242 * 1 - FLASHING 243 */ getCdmaEriIconMode()244 int getCdmaEriIconMode(); 245 246 /** 247 * Returns the CDMA ERI text, 248 */ getCdmaEriText()249 String getCdmaEriText(); 250 251 /** 252 * Returns true if OTA service provisioning needs to run. 253 * Only relevant on some technologies, others will always 254 * return false. 255 */ needsOtaServiceProvisioning()256 boolean needsOtaServiceProvisioning(); 257 258 /** 259 * Returns the unread count of voicemails 260 */ getVoiceMessageCount()261 int getVoiceMessageCount(); 262 263 /** 264 * Returns the network type 265 */ getNetworkType()266 int getNetworkType(); 267 268 /** 269 * Return true if an ICC card is present 270 */ hasIccCard()271 boolean hasIccCard(); 272 273 /** 274 * Return if the current radio is LTE on CDMA. This 275 * is a tri-state return value as for a period of time 276 * the mode may be unknown. 277 * 278 * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} 279 * or {@link PHone#LTE_ON_CDMA_TRUE} 280 */ getLteOnCdmaMode()281 int getLteOnCdmaMode(); 282 283 /** 284 * Returns the all observed cell information of the device. 285 */ getAllCellInfo()286 List<CellInfo> getAllCellInfo(); 287 } 288 289