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