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