1 /* 2 * Copyright (C) 2014 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.telecom; 18 19 import android.content.ComponentName; 20 import android.content.Intent; 21 import android.telecom.TelecomAnalytics; 22 import android.telecom.PhoneAccountHandle; 23 import android.net.Uri; 24 import android.os.Bundle; 25 import android.os.UserHandle; 26 import android.telecom.PhoneAccount; 27 import android.content.pm.ParceledListSlice; 28 import android.telecom.CallAttributes; 29 import com.android.internal.telecom.ICallEventCallback; 30 31 /** 32 * Interface used to interact with Telecom. Mostly this is used by TelephonyManager for passing 33 * commands that were previously handled by ITelephony. 34 * {@hide} 35 */ 36 interface ITelecomService { 37 /** 38 * Brings the in-call screen to the foreground if there is an active call. 39 * 40 * @param showDialpad if true, make the dialpad visible initially. 41 */ showInCallScreen(boolean showDialpad, String callingPackage, String callingFeatureId)42 void showInCallScreen(boolean showDialpad, String callingPackage, String callingFeatureId); 43 44 /** 45 * @see TelecomServiceImpl#getDefaultOutgoingPhoneAccount 46 */ getDefaultOutgoingPhoneAccount(in String uriScheme, String callingPackage, String callingFeatureId)47 PhoneAccountHandle getDefaultOutgoingPhoneAccount(in String uriScheme, String callingPackage, 48 String callingFeatureId); 49 50 /** 51 * @see TelecomServiceImpl#getUserSelectedOutgoingPhoneAccount 52 */ getUserSelectedOutgoingPhoneAccount(String callingPackage)53 PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(String callingPackage); 54 55 /** 56 * @see TelecomServiceImpl#setUserSelectedOutgoingPhoneAccount 57 */ setUserSelectedOutgoingPhoneAccount(in PhoneAccountHandle account)58 void setUserSelectedOutgoingPhoneAccount(in PhoneAccountHandle account); 59 60 /** 61 * @see TelecomServiceImpl#getCallCapablePhoneAccounts 62 */ getCallCapablePhoneAccounts( boolean includeDisabledAccounts, String callingPackage, String callingFeatureId, boolean acrossProfiles)63 ParceledListSlice<PhoneAccountHandle> getCallCapablePhoneAccounts( 64 boolean includeDisabledAccounts, String callingPackage, 65 String callingFeatureId, boolean acrossProfiles); 66 67 /** 68 * @see TelecomServiceImpl#getSelfManagedPhoneAccounts 69 */ getSelfManagedPhoneAccounts(String callingPackage, String callingFeatureId)70 ParceledListSlice<PhoneAccountHandle> getSelfManagedPhoneAccounts(String callingPackage, 71 String callingFeatureId); 72 73 /** 74 * @see TelecomServiceImpl#getOwnSelfManagedPhoneAccounts 75 */ getOwnSelfManagedPhoneAccounts(String callingPackage, String callingFeatureId)76 ParceledListSlice<PhoneAccountHandle> getOwnSelfManagedPhoneAccounts(String callingPackage, 77 String callingFeatureId); 78 79 /** 80 * @see TelecomManager#getPhoneAccountsSupportingScheme 81 */ getPhoneAccountsSupportingScheme(in String uriScheme, String callingPackage)82 ParceledListSlice<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme, 83 String callingPackage); 84 85 /** 86 * @see TelecomManager#getPhoneAccountsForPackage 87 */ getPhoneAccountsForPackage(in String packageName)88 ParceledListSlice<PhoneAccountHandle> getPhoneAccountsForPackage(in String packageName); 89 90 /** 91 * @see TelecomManager#getPhoneAccount 92 */ getPhoneAccount(in PhoneAccountHandle account, String callingPackage)93 PhoneAccount getPhoneAccount(in PhoneAccountHandle account, String callingPackage); 94 95 /** 96 * @see TelecomManager#getPhoneAccount 97 */ getRegisteredPhoneAccounts(String callingPackage, String callingFeatureId)98 ParceledListSlice<PhoneAccount> getRegisteredPhoneAccounts(String callingPackage, 99 String callingFeatureId); 100 101 /** 102 * @see TelecomManager#getAllPhoneAccountsCount 103 */ getAllPhoneAccountsCount()104 int getAllPhoneAccountsCount(); 105 106 /** 107 * @see TelecomManager#getAllPhoneAccounts 108 */ getAllPhoneAccounts()109 ParceledListSlice<PhoneAccount> getAllPhoneAccounts(); 110 111 /** 112 * @see TelecomManager#getAllPhoneAccountHandles 113 */ getAllPhoneAccountHandles()114 ParceledListSlice<PhoneAccountHandle> getAllPhoneAccountHandles(); 115 116 /** 117 * @see TelecomServiceImpl#getSimCallManager 118 */ getSimCallManager(int subId, String callingPackage)119 PhoneAccountHandle getSimCallManager(int subId, String callingPackage); 120 121 /** 122 * @see TelecomServiceImpl#getSimCallManagerForUser 123 */ getSimCallManagerForUser(int userId, String callingPackage)124 PhoneAccountHandle getSimCallManagerForUser(int userId, String callingPackage); 125 126 /** 127 * @see TelecomServiceImpl#registerPhoneAccount 128 */ registerPhoneAccount(in PhoneAccount metadata, String callingPackage)129 void registerPhoneAccount(in PhoneAccount metadata, String callingPackage); 130 131 /** 132 * @see TelecomServiceImpl#unregisterPhoneAccount 133 */ unregisterPhoneAccount(in PhoneAccountHandle account, String callingPackage)134 void unregisterPhoneAccount(in PhoneAccountHandle account, String callingPackage); 135 136 /** 137 * @see TelecomServiceImpl#clearAccounts 138 */ clearAccounts(String packageName)139 void clearAccounts(String packageName); 140 141 /** 142 * @see TelecomServiceImpl#isVoiceMailNumber 143 */ isVoiceMailNumber(in PhoneAccountHandle accountHandle, String number, String callingPackage, String callingFeatureId)144 boolean isVoiceMailNumber(in PhoneAccountHandle accountHandle, String number, 145 String callingPackage, String callingFeatureId); 146 147 /** 148 * @see TelecomServiceImpl#getVoiceMailNumber 149 */ getVoiceMailNumber(in PhoneAccountHandle accountHandle, String callingPackage, String callingFeatureId)150 String getVoiceMailNumber(in PhoneAccountHandle accountHandle, String callingPackage, 151 String callingFeatureId); 152 153 /** 154 * @see TelecomServiceImpl#getLine1Number 155 */ getLine1Number(in PhoneAccountHandle accountHandle, String callingPackage, String callingFeatureId)156 String getLine1Number(in PhoneAccountHandle accountHandle, String callingPackage, 157 String callingFeatureId); 158 159 /** 160 * @see TelecomServiceImpl#getDefaultPhoneApp 161 */ getDefaultPhoneApp()162 ComponentName getDefaultPhoneApp(); 163 164 /** 165 * @see TelecomServiceImpl#getDefaultDialerPackage 166 */ getDefaultDialerPackage(String callingPackage)167 String getDefaultDialerPackage(String callingPackage); 168 169 /** 170 * @see TelecomServiceImpl#getDefaultDialerPackage 171 */ getDefaultDialerPackageForUser(int userId)172 String getDefaultDialerPackageForUser(int userId); 173 174 /** 175 * @see TelecomServiceImpl#getSystemDialerPackage 176 */ getSystemDialerPackage(String callingPackage)177 String getSystemDialerPackage(String callingPackage); 178 179 /** 180 * @see TelecomServiceImpl#dumpCallAnalytics 181 */ dumpCallAnalytics()182 TelecomAnalytics dumpCallAnalytics(); 183 184 // 185 // Internal system apis relating to call management. 186 // 187 188 /** 189 * @see TelecomServiceImpl#silenceRinger 190 */ silenceRinger(String callingPackage)191 void silenceRinger(String callingPackage); 192 193 /** 194 * @see TelecomServiceImpl#isInCall 195 */ isInCall(String callingPackage, String callingFeatureId)196 boolean isInCall(String callingPackage, String callingFeatureId); 197 198 /** 199 * @see TelecomServiceImpl#hasManageOngoingCallsPermission 200 */ hasManageOngoingCallsPermission(String callingPackage)201 boolean hasManageOngoingCallsPermission(String callingPackage); 202 203 /** 204 * @see TelecomServiceImpl#isInManagedCall 205 */ isInManagedCall(String callingPackage, String callingFeatureId)206 boolean isInManagedCall(String callingPackage, String callingFeatureId); 207 208 /** 209 * @see TelecomServiceImpl#isRinging 210 */ isRinging(String callingPackage)211 boolean isRinging(String callingPackage); 212 213 /** 214 * @see TelecomServiceImpl#getCallState 215 * Note: only kept around to not break app compat, however this will throw a SecurityException 216 * on API 31+. 217 */ 218 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) getCallState()219 int getCallState(); 220 221 /** 222 * @see TelecomServiceImpl#getCallState 223 */ getCallStateUsingPackage(String callingPackage, String callingFeatureId)224 int getCallStateUsingPackage(String callingPackage, String callingFeatureId); 225 226 /** 227 * @see TelecomServiceImpl#endCall 228 */ endCall(String callingPackage)229 boolean endCall(String callingPackage); 230 231 /** 232 * @see TelecomServiceImpl#acceptRingingCall 233 */ acceptRingingCall(String callingPackage)234 void acceptRingingCall(String callingPackage); 235 236 /** 237 * @see TelecomServiceImpl#acceptRingingCallWithVideoState(int) 238 */ acceptRingingCallWithVideoState(String callingPackage, int videoState)239 void acceptRingingCallWithVideoState(String callingPackage, int videoState); 240 241 /** 242 * @see TelecomServiceImpl#cancelMissedCallsNotification 243 */ cancelMissedCallsNotification(String callingPackage)244 void cancelMissedCallsNotification(String callingPackage); 245 246 /** 247 * @see TelecomServiceImpl#handleMmi 248 */ handlePinMmi(String dialString, String callingPackage)249 boolean handlePinMmi(String dialString, String callingPackage); 250 251 /** 252 * @see TelecomServiceImpl#handleMmi 253 */ handlePinMmiForPhoneAccount(in PhoneAccountHandle accountHandle, String dialString, String callingPackage)254 boolean handlePinMmiForPhoneAccount(in PhoneAccountHandle accountHandle, String dialString, 255 String callingPackage); 256 257 /** 258 * @see TelecomServiceImpl#getAdnUriForPhoneAccount 259 */ getAdnUriForPhoneAccount(in PhoneAccountHandle accountHandle, String callingPackage)260 Uri getAdnUriForPhoneAccount(in PhoneAccountHandle accountHandle, String callingPackage); 261 262 /** 263 * @see TelecomServiceImpl#isTtySupported 264 */ isTtySupported(String callingPackage, String callingFeatureId)265 boolean isTtySupported(String callingPackage, String callingFeatureId); 266 267 /** 268 * @see TelecomServiceImpl#getCurrentTtyMode 269 */ getCurrentTtyMode(String callingPackage, String callingFeatureId)270 int getCurrentTtyMode(String callingPackage, String callingFeatureId); 271 272 /** 273 * @see TelecomServiceImpl#addNewIncomingCall 274 */ addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras, String callingPackage)275 void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras, 276 String callingPackage); 277 278 /** 279 * @see TelecomServiceImpl#addNewIncomingConference 280 */ addNewIncomingConference(in PhoneAccountHandle phoneAccount, in Bundle extras, String callingPackage)281 void addNewIncomingConference(in PhoneAccountHandle phoneAccount, in Bundle extras, 282 String callingPackage); 283 284 285 /** 286 * @see TelecomServiceImpl#addNewUnknownCall 287 */ addNewUnknownCall(in PhoneAccountHandle phoneAccount, in Bundle extras)288 void addNewUnknownCall(in PhoneAccountHandle phoneAccount, in Bundle extras); 289 290 /** 291 * @see TelecomServiceImpl#startConference 292 */ startConference(in List<Uri> participants, in Bundle extras, String callingPackage)293 void startConference(in List<Uri> participants, in Bundle extras, 294 String callingPackage); 295 296 /** 297 * @see TelecomServiceImpl#placeCall 298 */ placeCall(in Uri handle, in Bundle extras, String callingPackage, String callingFeatureId)299 void placeCall(in Uri handle, in Bundle extras, String callingPackage, String callingFeatureId); 300 301 /** 302 * @see TelecomServiceImpl#enablePhoneAccount 303 */ enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled)304 boolean enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled); 305 306 /** 307 * @see TelecomServiceImpl#setDefaultDialer 308 */ setDefaultDialer(in String packageName)309 boolean setDefaultDialer(in String packageName); 310 311 /** 312 * Stop suppressing blocked numbers after a call to emergency services. Shell only. 313 */ stopBlockSuppression()314 void stopBlockSuppression(); 315 316 /** 317 * @see TelecomServiceImpl#createManageBlockedNumbersIntent 318 **/ createManageBlockedNumbersIntent(String callingPackage)319 Intent createManageBlockedNumbersIntent(String callingPackage); 320 321 /** 322 * @see TelecomServiceImpl#createLaunchEmergencyDialerIntent 323 */ createLaunchEmergencyDialerIntent(in String number)324 Intent createLaunchEmergencyDialerIntent(in String number); 325 326 /** 327 * @see TelecomServiceImpl#isIncomingCallPermitted 328 */ isIncomingCallPermitted(in PhoneAccountHandle phoneAccountHandle, String callingPackage)329 boolean isIncomingCallPermitted(in PhoneAccountHandle phoneAccountHandle, 330 String callingPackage); 331 332 /** 333 * @see TelecomServiceImpl#isOutgoingCallPermitted 334 */ isOutgoingCallPermitted(in PhoneAccountHandle phoneAccountHandle, String callingPackage)335 boolean isOutgoingCallPermitted(in PhoneAccountHandle phoneAccountHandle, 336 String callingPackage); 337 338 /** 339 * @see TelecomServiceImpl#waitOnHandler 340 */ waitOnHandlers()341 void waitOnHandlers(); 342 343 /** 344 * @see TelecomServiceImpl#acceptHandover 345 */ acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct, String callingPackage)346 void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct, 347 String callingPackage); 348 349 /** 350 * @see TelecomServiceImpl#setTestEmergencyPhoneAccountPackageNameFilter 351 */ setTestEmergencyPhoneAccountPackageNameFilter(String packageName)352 void setTestEmergencyPhoneAccountPackageNameFilter(String packageName); 353 354 /** 355 * @see TelecomServiceImpl#isInEmergencyCall 356 */ isInEmergencyCall()357 boolean isInEmergencyCall(); 358 359 /** 360 * @see TelecomServiceImpl#handleCallIntent 361 */ handleCallIntent(in Intent intent, in String callingPackageProxy)362 void handleCallIntent(in Intent intent, in String callingPackageProxy); 363 cleanupStuckCalls()364 void cleanupStuckCalls(); 365 cleanupOrphanPhoneAccounts()366 int cleanupOrphanPhoneAccounts(); 367 isNonUiInCallServiceBound(in String packageName)368 boolean isNonUiInCallServiceBound(in String packageName); 369 resetCarMode()370 void resetCarMode(); 371 setTestDefaultCallRedirectionApp(String packageName)372 void setTestDefaultCallRedirectionApp(String packageName); 373 374 /** 375 * @see TelecomServiceImpl#requestLogMark 376 */ requestLogMark(in String message)377 void requestLogMark(in String message); 378 setTestPhoneAcctSuggestionComponent(String flattenedComponentName)379 void setTestPhoneAcctSuggestionComponent(String flattenedComponentName); 380 setTestDefaultCallScreeningApp(String packageName)381 void setTestDefaultCallScreeningApp(String packageName); 382 addOrRemoveTestCallCompanionApp(String packageName, boolean isAdded)383 void addOrRemoveTestCallCompanionApp(String packageName, boolean isAdded); 384 385 /** 386 * @see TelecomServiceImpl#setSystemDialer 387 */ setSystemDialer(in ComponentName testComponentName)388 void setSystemDialer(in ComponentName testComponentName); 389 390 /** 391 * @see TelecomServiceImpl#setTestDefaultDialer 392 */ setTestDefaultDialer(in String packageName)393 void setTestDefaultDialer(in String packageName); 394 395 /** 396 * @see TelecomServiceImpl#setTestCallDiagnosticService 397 */ setTestCallDiagnosticService(in String packageName)398 void setTestCallDiagnosticService(in String packageName); 399 400 /** 401 * @see TelecomServiceImpl#isInSelfManagedCall 402 */ isInSelfManagedCall(String packageName, in UserHandle userHandle, String callingPackage)403 boolean isInSelfManagedCall(String packageName, in UserHandle userHandle, 404 String callingPackage); 405 406 /** 407 * @see TelecomServiceImpl#addCall 408 */ addCall(in CallAttributes callAttributes, in ICallEventCallback callback, String callId, String callingPackage)409 void addCall(in CallAttributes callAttributes, in ICallEventCallback callback, String callId, 410 String callingPackage); 411 } 412