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