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
17package com.android.internal.telecom;
18
19import android.content.ComponentName;
20import android.content.Intent;
21import android.telecom.ParcelableCallAnalytics;
22import android.telecom.PhoneAccountHandle;
23import android.net.Uri;
24import android.os.Bundle;
25import 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 */
32interface 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     */
38    void showInCallScreen(boolean showDialpad, String callingPackage);
39
40    /**
41     * @see TelecomServiceImpl#getDefaultOutgoingPhoneAccount
42     */
43    PhoneAccountHandle getDefaultOutgoingPhoneAccount(in String uriScheme, String callingPackage);
44
45    /**
46     * @see TelecomServiceImpl#getUserSelectedOutgoingPhoneAccount
47     */
48    PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
49
50    /**
51     * @see TelecomServiceImpl#setUserSelectedOutgoingPhoneAccount
52     */
53    void setUserSelectedOutgoingPhoneAccount(in PhoneAccountHandle account);
54
55    /**
56     * @see TelecomServiceImpl#getCallCapablePhoneAccounts
57     */
58    List<PhoneAccountHandle> getCallCapablePhoneAccounts(
59            boolean includeDisabledAccounts, String callingPackage);
60
61    /**
62     * @see TelecomManager#getPhoneAccountsSupportingScheme
63     */
64    List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme,
65            String callingPackage);
66
67    /**
68     * @see TelecomManager#getPhoneAccountsForPackage
69     */
70    List<PhoneAccountHandle> getPhoneAccountsForPackage(in String packageName);
71
72    /**
73     * @see TelecomManager#getPhoneAccount
74     */
75    PhoneAccount getPhoneAccount(in PhoneAccountHandle account);
76
77    /**
78     * @see TelecomManager#getAllPhoneAccountsCount
79     */
80    int getAllPhoneAccountsCount();
81
82    /**
83     * @see TelecomManager#getAllPhoneAccounts
84     */
85    List<PhoneAccount> getAllPhoneAccounts();
86
87    /**
88     * @see TelecomManager#getAllPhoneAccountHandles
89     */
90    List<PhoneAccountHandle> getAllPhoneAccountHandles();
91
92    /**
93     * @see TelecomServiceImpl#getSimCallManager
94     */
95    PhoneAccountHandle getSimCallManager();
96
97    /**
98     * @see TelecomServiceImpl#getSimCallManagerForUser
99     */
100    PhoneAccountHandle getSimCallManagerForUser(int userId);
101
102    /**
103     * @see TelecomServiceImpl#registerPhoneAccount
104     */
105    void registerPhoneAccount(in PhoneAccount metadata);
106
107    /**
108     * @see TelecomServiceImpl#unregisterPhoneAccount
109     */
110    void unregisterPhoneAccount(in PhoneAccountHandle account);
111
112    /**
113     * @see TelecomServiceImpl#clearAccounts
114     */
115    void clearAccounts(String packageName);
116
117    /**
118     * @see TelecomServiceImpl#isVoiceMailNumber
119     */
120    boolean isVoiceMailNumber(in PhoneAccountHandle accountHandle, String number,
121            String callingPackage);
122
123    /**
124     * @see TelecomServiceImpl#getVoiceMailNumber
125     */
126    String getVoiceMailNumber(in PhoneAccountHandle accountHandle, String callingPackage);
127
128    /**
129     * @see TelecomServiceImpl#getLine1Number
130     */
131    String getLine1Number(in PhoneAccountHandle accountHandle, String callingPackage);
132
133    /**
134     * @see TelecomServiceImpl#getDefaultPhoneApp
135     */
136    ComponentName getDefaultPhoneApp();
137
138    /**
139     * @see TelecomServiceImpl#getDefaultDialerPackage
140     */
141    String getDefaultDialerPackage();
142
143    /**
144     * @see TelecomServiceImpl#getSystemDialerPackage
145     */
146    String getSystemDialerPackage();
147
148    /**
149    * @see TelecomServiceImpl#dumpCallAnalytics
150    */
151    List<ParcelableCallAnalytics> dumpCallAnalytics();
152
153    //
154    // Internal system apis relating to call management.
155    //
156
157    /**
158     * @see TelecomServiceImpl#silenceRinger
159     */
160    void silenceRinger(String callingPackage);
161
162    /**
163     * @see TelecomServiceImpl#isInCall
164     */
165    boolean isInCall(String callingPackage);
166
167    /**
168     * @see TelecomServiceImpl#isRinging
169     */
170    boolean isRinging(String callingPackage);
171
172    /**
173     * @see TelecomServiceImpl#getCallState
174     */
175    int getCallState();
176
177    /**
178     * @see TelecomServiceImpl#endCall
179     */
180    boolean endCall();
181
182    /**
183     * @see TelecomServiceImpl#acceptRingingCall
184     */
185    void acceptRingingCall();
186
187    /**
188     * @see TelecomServiceImpl#acceptRingingCallWithVideoState(int)
189     */
190    void acceptRingingCallWithVideoState(int videoState);
191
192    /**
193     * @see TelecomServiceImpl#cancelMissedCallsNotification
194     */
195    void cancelMissedCallsNotification(String callingPackage);
196
197    /**
198     * @see TelecomServiceImpl#handleMmi
199     */
200    boolean handlePinMmi(String dialString, String callingPackage);
201
202    /**
203     * @see TelecomServiceImpl#handleMmi
204     */
205    boolean handlePinMmiForPhoneAccount(in PhoneAccountHandle accountHandle, String dialString,
206            String callingPackage);
207
208    /**
209     * @see TelecomServiceImpl#getAdnUriForPhoneAccount
210     */
211    Uri getAdnUriForPhoneAccount(in PhoneAccountHandle accountHandle, String callingPackage);
212
213    /**
214     * @see TelecomServiceImpl#isTtySupported
215     */
216    boolean isTtySupported(String callingPackage);
217
218    /**
219     * @see TelecomServiceImpl#getCurrentTtyMode
220     */
221    int getCurrentTtyMode(String callingPackage);
222
223    /**
224     * @see TelecomServiceImpl#addNewIncomingCall
225     */
226    void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras);
227
228    /**
229     * @see TelecomServiceImpl#addNewUnknownCall
230     */
231    void addNewUnknownCall(in PhoneAccountHandle phoneAccount, in Bundle extras);
232
233    /**
234     * @see TelecomServiceImpl#placeCall
235     */
236    void placeCall(in Uri handle, in Bundle extras, String callingPackage);
237
238    /**
239     * @see TelecomServiceImpl#enablePhoneAccount
240     */
241    boolean enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled);
242
243    /**
244     * @see TelecomServiceImpl#setDefaultDialer
245     */
246    boolean setDefaultDialer(in String packageName);
247
248    /**
249    * @see TelecomServiceImpl#createManageBlockedNumbersIntent
250    **/
251    Intent createManageBlockedNumbersIntent();
252}
253