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