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