blob: 49f183151e278354f931a50568c0e2e283a8255d [file] [log] [blame]
Sailesh Nepal1bef3392016-01-24 18:21:53 -08001/*
2 * Copyright (C) 2016 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 android.telecom;
18
Hall Liuff4a1252020-01-01 16:27:14 -080019import android.Manifest;
Tyler Gunn7e45b722018-12-04 12:56:45 -080020import android.annotation.NonNull;
Hall Liuff4a1252020-01-01 16:27:14 -080021import android.annotation.RequiresPermission;
Sailesh Nepal1bef3392016-01-24 18:21:53 -080022import android.annotation.SdkConstant;
Hall Liu6dfa2492019-10-01 17:20:39 -070023import android.annotation.SystemApi;
24import android.annotation.TestApi;
Sailesh Nepal1bef3392016-01-24 18:21:53 -080025import android.app.Service;
tonyzhu9e1d4f82018-10-22 15:11:31 +080026import android.content.ComponentName;
Sailesh Nepal1bef3392016-01-24 18:21:53 -080027import android.content.Intent;
Tyler Gunn460b7d42020-05-15 10:19:32 -070028import android.content.pm.ServiceInfo;
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080029import android.net.Uri;
Sailesh Nepal1bef3392016-01-24 18:21:53 -080030import android.os.Handler;
31import android.os.IBinder;
32import android.os.Looper;
33import android.os.Message;
34import android.os.RemoteException;
35
36import com.android.internal.os.SomeArgs;
Sailesh Nepal1bef3392016-01-24 18:21:53 -080037import com.android.internal.telecom.ICallScreeningAdapter;
Tyler Gunne0caec72018-11-30 14:21:18 -080038import com.android.internal.telecom.ICallScreeningService;
Sailesh Nepal1bef3392016-01-24 18:21:53 -080039
40/**
41 * This service can be implemented by the default dialer (see
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080042 * {@link TelecomManager#getDefaultDialerPackage()}) or a third party app to allow or disallow
Tyler Gunna842e7622019-03-29 11:32:08 -070043 * incoming calls before they are shown to a user. A {@link CallScreeningService} can also see
44 * outgoing calls for the purpose of providing caller ID services for those calls.
Sailesh Nepal1bef3392016-01-24 18:21:53 -080045 * <p>
46 * Below is an example manifest registration for a {@code CallScreeningService}.
47 * <pre>
48 * {@code
49 * <service android:name="your.package.YourCallScreeningServiceImplementation"
50 * android:permission="android.permission.BIND_SCREENING_SERVICE">
51 * <intent-filter>
52 * <action android:name="android.telecom.CallScreeningService"/>
53 * </intent-filter>
54 * </service>
55 * }
56 * </pre>
Tyler Gunn7e45b722018-12-04 12:56:45 -080057 * <p>
58 * A CallScreeningService performs two functions:
59 * <ol>
60 * <li>Call blocking/screening - the service can choose which calls will ring on the user's
61 * device, and which will be silently sent to voicemail.</li>
Tyler Gunna842e7622019-03-29 11:32:08 -070062 * <li>Call identification - services which provide call identification functionality can
63 * display a user-interface of their choosing which contains identifying information for a call.
64 * </li>
Tyler Gunn7e45b722018-12-04 12:56:45 -080065 * </ol>
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080066 * <p>
Tyler Gunn467acc42020-10-07 15:42:06 -070067 * <h2>Becoming the CallScreeningService</h2>
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080068 * Telecom will bind to a single app chosen by the user which implements the
69 * {@link CallScreeningService} API when there are new incoming and outgoing calls.
70 * <p>
71 * The code snippet below illustrates how your app can request that it fills the call screening
72 * role.
73 * <pre>
74 * {@code
75 * private static final int REQUEST_ID = 1;
76 *
77 * public void requestRole() {
78 * RoleManager roleManager = (RoleManager) getSystemService(ROLE_SERVICE);
Grace Jia2d21e952019-09-20 14:57:00 -070079 * Intent intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_CALL_SCREENING);
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080080 * startActivityForResult(intent, REQUEST_ID);
81 * }
82 *
83 * &#64;Override
84 * public void onActivityResult(int requestCode, int resultCode, Intent data) {
85 * if (requestCode == REQUEST_ID) {
86 * if (resultCode == android.app.Activity.RESULT_OK) {
87 * // Your app is now the call screening app
88 * } else {
89 * // Your app is not the call screening app
90 * }
91 * }
92 * }
Tyler Gunn467acc42020-10-07 15:42:06 -070093 * }
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080094 * </pre>
Tyler Gunn467acc42020-10-07 15:42:06 -070095 *
96 * <h2>CallScreeningService Lifecycle</h2>
97 *
98 * The framework binds to the {@link CallScreeningService} implemented by the user-chosen app
99 * filling the {@link android.app.role.RoleManager#ROLE_CALL_SCREENING} role when incoming calls are
100 * received (prior to ringing) and when outgoing calls are placed. The platform calls the
101 * {@link #onScreenCall(Call.Details)} method to provide your service with details about the call.
102 * <p>
103 * For incoming calls, the {@link CallScreeningService} must call
104 * {@link #respondToCall(Call.Details, CallResponse)} within 5 seconds of being bound to indicate to
105 * the platform whether the call should be blocked or not. Your app must do this even if it is
106 * primarily performing caller ID operations and not screening calls. It is important to perform
107 * screening operations in a timely matter as the user's device will not begin ringing until the
108 * response is received (or the timeout is hit). A {@link CallScreeningService} may choose to
109 * perform local database lookups to help determine if a call should be screened or not; care should
110 * be taken to ensure the timeout is not repeatedly hit, causing delays in the incoming call flow.
111 * <p>
112 * If your app provides a caller ID experience, it should launch an activity to show the caller ID
113 * information from {@link #onScreenCall(Call.Details)}.
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800114 */
115public abstract class CallScreeningService extends Service {
116 /**
117 * The {@link Intent} that must be declared as handled by the service.
118 */
119 @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
120 public static final String SERVICE_INTERFACE = "android.telecom.CallScreeningService";
121
122 private static final int MSG_SCREEN_CALL = 1;
123
124 private final Handler mHandler = new Handler(Looper.getMainLooper()) {
125 @Override
126 public void handleMessage(Message msg) {
127 switch (msg.what) {
128 case MSG_SCREEN_CALL:
129 SomeArgs args = (SomeArgs) msg.obj;
130 try {
131 mCallScreeningAdapter = (ICallScreeningAdapter) args.arg1;
Grace Jia90b38042019-11-06 14:12:33 -0800132 Call.Details callDetails = Call.Details
133 .createFromParcelableCall((ParcelableCall) args.arg2);
134 onScreenCall(callDetails);
135 if (callDetails.getCallDirection() == Call.Details.DIRECTION_OUTGOING) {
136 mCallScreeningAdapter.allowCall(callDetails.getTelecomCallId());
137 }
138 } catch (RemoteException e) {
139 Log.w(this, "Exception when screening call: " + e);
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800140 } finally {
141 args.recycle();
142 }
143 break;
144 }
145 }
146 };
147
148 private final class CallScreeningBinder extends ICallScreeningService.Stub {
149 @Override
150 public void screenCall(ICallScreeningAdapter adapter, ParcelableCall call) {
151 Log.v(this, "screenCall");
152 SomeArgs args = SomeArgs.obtain();
153 args.arg1 = adapter;
154 args.arg2 = call;
155 mHandler.obtainMessage(MSG_SCREEN_CALL, args).sendToTarget();
156 }
157 }
158
159 private ICallScreeningAdapter mCallScreeningAdapter;
160
161 /*
162 * Information about how to respond to an incoming call.
163 */
Sailesh Nepalf4460712016-01-27 16:45:51 -0800164 public static class CallResponse {
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800165 private final boolean mShouldDisallowCall;
166 private final boolean mShouldRejectCall;
Usman Abdullah47b392d2019-03-06 15:54:56 -0800167 private final boolean mShouldSilenceCall;
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800168 private final boolean mShouldSkipCallLog;
169 private final boolean mShouldSkipNotification;
Hall Liu69554cf2019-11-11 17:44:09 -0800170 private final boolean mShouldScreenCallViaAudioProcessing;
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800171
172 private CallResponse(
173 boolean shouldDisallowCall,
174 boolean shouldRejectCall,
Usman Abdullah47b392d2019-03-06 15:54:56 -0800175 boolean shouldSilenceCall,
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800176 boolean shouldSkipCallLog,
Hall Liu6dfa2492019-10-01 17:20:39 -0700177 boolean shouldSkipNotification,
Hall Liu69554cf2019-11-11 17:44:09 -0800178 boolean shouldScreenCallViaAudioProcessing) {
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800179 if (!shouldDisallowCall
180 && (shouldRejectCall || shouldSkipCallLog || shouldSkipNotification)) {
181 throw new IllegalStateException("Invalid response state for allowed call.");
182 }
183
Hall Liu69554cf2019-11-11 17:44:09 -0800184 if (shouldDisallowCall && shouldScreenCallViaAudioProcessing) {
Hall Liu6dfa2492019-10-01 17:20:39 -0700185 throw new IllegalStateException("Invalid response state for allowed call.");
186 }
187
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800188 mShouldDisallowCall = shouldDisallowCall;
189 mShouldRejectCall = shouldRejectCall;
190 mShouldSkipCallLog = shouldSkipCallLog;
191 mShouldSkipNotification = shouldSkipNotification;
Usman Abdullah47b392d2019-03-06 15:54:56 -0800192 mShouldSilenceCall = shouldSilenceCall;
Hall Liu69554cf2019-11-11 17:44:09 -0800193 mShouldScreenCallViaAudioProcessing = shouldScreenCallViaAudioProcessing;
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800194 }
195
196 /*
197 * @return Whether the incoming call should be blocked.
198 */
199 public boolean getDisallowCall() {
200 return mShouldDisallowCall;
201 }
202
203 /*
204 * @return Whether the incoming call should be disconnected as if the user had manually
205 * rejected it.
206 */
207 public boolean getRejectCall() {
208 return mShouldRejectCall;
209 }
210
211 /*
Usman Abdullah47b392d2019-03-06 15:54:56 -0800212 * @return Whether the ringtone should be silenced for the incoming call.
213 */
214 public boolean getSilenceCall() {
215 return mShouldSilenceCall;
216 }
217
218 /*
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800219 * @return Whether the incoming call should not be displayed in the call log.
220 */
221 public boolean getSkipCallLog() {
222 return mShouldSkipCallLog;
223 }
224
225 /*
226 * @return Whether a missed call notification should not be shown for the incoming call.
227 */
228 public boolean getSkipNotification() {
229 return mShouldSkipNotification;
230 }
231
Hall Liu6dfa2492019-10-01 17:20:39 -0700232 /**
233 * @return Whether we should enter the {@link Call#STATE_AUDIO_PROCESSING} state to allow
234 * for further screening of the call.
235 * @hide
236 */
Hall Liu69554cf2019-11-11 17:44:09 -0800237 public boolean getShouldScreenCallViaAudioProcessing() {
238 return mShouldScreenCallViaAudioProcessing;
Hall Liu6dfa2492019-10-01 17:20:39 -0700239 }
240
Sailesh Nepalf4460712016-01-27 16:45:51 -0800241 public static class Builder {
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800242 private boolean mShouldDisallowCall;
243 private boolean mShouldRejectCall;
Usman Abdullah47b392d2019-03-06 15:54:56 -0800244 private boolean mShouldSilenceCall;
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800245 private boolean mShouldSkipCallLog;
246 private boolean mShouldSkipNotification;
Hall Liu69554cf2019-11-11 17:44:09 -0800247 private boolean mShouldScreenCallViaAudioProcessing;
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800248
Tyler Gunne0caec72018-11-30 14:21:18 -0800249 /**
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800250 * Sets whether the incoming call should be blocked.
251 */
252 public Builder setDisallowCall(boolean shouldDisallowCall) {
253 mShouldDisallowCall = shouldDisallowCall;
254 return this;
255 }
256
Tyler Gunne0caec72018-11-30 14:21:18 -0800257 /**
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800258 * Sets whether the incoming call should be disconnected as if the user had manually
259 * rejected it. This property should only be set to true if the call is disallowed.
260 */
261 public Builder setRejectCall(boolean shouldRejectCall) {
262 mShouldRejectCall = shouldRejectCall;
263 return this;
264 }
265
Tyler Gunne0caec72018-11-30 14:21:18 -0800266 /**
Usman Abdullah47b392d2019-03-06 15:54:56 -0800267 * Sets whether ringing should be silenced for the incoming call. When set
268 * to {@code true}, the Telecom framework will not play a ringtone for the call.
269 * The call will, however, still be sent to the default dialer app if it is not blocked.
270 * A {@link CallScreeningService} can use this to ensure a potential nuisance call is
271 * still surfaced to the user, but in a less intrusive manner.
272 *
273 * Setting this to true only makes sense when the call has not been disallowed
274 * using {@link #setDisallowCall(boolean)}.
275 */
276 public @NonNull Builder setSilenceCall(boolean shouldSilenceCall) {
277 mShouldSilenceCall = shouldSilenceCall;
278 return this;
279 }
280
281 /**
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800282 * Sets whether the incoming call should not be displayed in the call log. This property
283 * should only be set to true if the call is disallowed.
Tyler Gunne0caec72018-11-30 14:21:18 -0800284 * <p>
285 * Note: Calls will still be logged with type
286 * {@link android.provider.CallLog.Calls#BLOCKED_TYPE}, regardless of how this property
287 * is set.
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800288 */
289 public Builder setSkipCallLog(boolean shouldSkipCallLog) {
290 mShouldSkipCallLog = shouldSkipCallLog;
291 return this;
292 }
293
Tyler Gunne0caec72018-11-30 14:21:18 -0800294 /**
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800295 * Sets whether a missed call notification should not be shown for the incoming call.
296 * This property should only be set to true if the call is disallowed.
297 */
298 public Builder setSkipNotification(boolean shouldSkipNotification) {
299 mShouldSkipNotification = shouldSkipNotification;
300 return this;
301 }
302
Hall Liu6dfa2492019-10-01 17:20:39 -0700303 /**
304 * Sets whether to request background audio processing so that the in-call service can
305 * screen the call further. If set to {@code true}, {@link #setDisallowCall} should be
306 * called with {@code false}, and all other parameters in this builder will be ignored.
Tyler Gunn460b7d42020-05-15 10:19:32 -0700307 * <p>
Hall Liu6dfa2492019-10-01 17:20:39 -0700308 * This request will only be honored if the {@link CallScreeningService} shares the same
309 * uid as the default dialer app. Otherwise, the call will go through as usual.
Tyler Gunn460b7d42020-05-15 10:19:32 -0700310 * <p>
311 * Apps built with SDK version {@link android.os.Build.VERSION_CODES#R} or later which
312 * are using the microphone as part of audio processing should specify the
313 * foreground service type using the attribute
314 * {@link android.R.attr#foregroundServiceType} in the {@link CallScreeningService}
315 * service element of the app's manifest file.
316 * The {@link ServiceInfo#FOREGROUND_SERVICE_TYPE_MICROPHONE} attribute should be
317 * specified.
318 * @see
319 * <a href="https://developer.android.com/preview/privacy/foreground-service-types">
320 * the Android Developer Site</a> for more information.
Hall Liu6dfa2492019-10-01 17:20:39 -0700321 *
Hall Liu69554cf2019-11-11 17:44:09 -0800322 * @param shouldScreenCallViaAudioProcessing Whether to request further call screening.
Hall Liu6dfa2492019-10-01 17:20:39 -0700323 * @hide
324 */
325 @SystemApi
326 @TestApi
Hall Liuff4a1252020-01-01 16:27:14 -0800327 @RequiresPermission(Manifest.permission.CAPTURE_AUDIO_OUTPUT)
Hall Liu69554cf2019-11-11 17:44:09 -0800328 public @NonNull Builder setShouldScreenCallViaAudioProcessing(
329 boolean shouldScreenCallViaAudioProcessing) {
330 mShouldScreenCallViaAudioProcessing = shouldScreenCallViaAudioProcessing;
Hall Liu6dfa2492019-10-01 17:20:39 -0700331 return this;
332 }
333
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800334 public CallResponse build() {
335 return new CallResponse(
336 mShouldDisallowCall,
337 mShouldRejectCall,
Usman Abdullah47b392d2019-03-06 15:54:56 -0800338 mShouldSilenceCall,
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800339 mShouldSkipCallLog,
Hall Liu6dfa2492019-10-01 17:20:39 -0700340 mShouldSkipNotification,
Hall Liu69554cf2019-11-11 17:44:09 -0800341 mShouldScreenCallViaAudioProcessing);
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800342 }
343 }
344 }
345
346 public CallScreeningService() {
347 }
348
349 @Override
350 public IBinder onBind(Intent intent) {
351 Log.v(this, "onBind");
352 return new CallScreeningBinder();
353 }
354
355 @Override
356 public boolean onUnbind(Intent intent) {
357 Log.v(this, "onUnbind");
358 return false;
359 }
360
361 /**
Tyler Gunn467acc42020-10-07 15:42:06 -0700362 * Called when a new incoming or outgoing call is added.
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800363 * <p>
364 * A {@link CallScreeningService} must indicate whether an incoming call is allowed or not by
365 * calling
366 * {@link CallScreeningService#respondToCall(Call.Details, CallScreeningService.CallResponse)}.
367 * Your app can tell if a call is an incoming call by checking to see if
368 * {@link Call.Details#getCallDirection()} is {@link Call.Details#DIRECTION_INCOMING}.
369 * <p>
Tyler Gunn467acc42020-10-07 15:42:06 -0700370 * <em>Note:</em> A {@link CallScreeningService} must respond to a call within 5 seconds. After
371 * this time, the framework will unbind from the {@link CallScreeningService} and ignore its
372 * response.
373 * <p>
374 * <em>Note:</em> The {@link Call.Details} instance provided to a call screening service will
375 * only have the following properties set. The rest of the {@link Call.Details} properties will
376 * be set to their default value or {@code null}.
Tyler Gunne0caec72018-11-30 14:21:18 -0800377 * <ul>
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800378 * <li>{@link Call.Details#getCallDirection()}</li>
Tyler Gunn467acc42020-10-07 15:42:06 -0700379 * <li>{@link Call.Details#getCallerNumberVerificationStatus()}</li>
Tyler Gunne0caec72018-11-30 14:21:18 -0800380 * <li>{@link Call.Details#getConnectTimeMillis()}</li>
381 * <li>{@link Call.Details#getCreationTimeMillis()}</li>
382 * <li>{@link Call.Details#getHandle()}</li>
Tyler Gunne0caec72018-11-30 14:21:18 -0800383 * </ul>
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800384 * <p>
385 * Only calls where the {@link Call.Details#getHandle() handle} {@link Uri#getScheme() scheme}
386 * is {@link PhoneAccount#SCHEME_TEL} are passed for call
387 * screening. Further, only calls which are not in the user's contacts are passed for
Tyler Gunn467acc42020-10-07 15:42:06 -0700388 * screening, unless the {@link CallScreeningService} has been granted
389 * {@link Manifest.permission#READ_CONTACTS} permission by the user. For outgoing calls, no
390 * post-dial digits are passed.
391 * <p>
392 * Calls with a {@link Call.Details#getHandlePresentation()} of
393 * {@link TelecomManager#PRESENTATION_RESTRICTED}, {@link TelecomManager#PRESENTATION_UNKNOWN}
394 * or {@link TelecomManager#PRESENTATION_PAYPHONE} presentation are not provided to the
395 * {@link CallScreeningService}.
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800396 *
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800397 * @param callDetails Information about a new call, see {@link Call.Details}.
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800398 */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800399 public abstract void onScreenCall(@NonNull Call.Details callDetails);
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800400
401 /**
Usman Abdullah47b392d2019-03-06 15:54:56 -0800402 * Responds to the given incoming call, either allowing it, silencing it or disallowing it.
Tyler Gunn7e45b722018-12-04 12:56:45 -0800403 * <p>
404 * The {@link CallScreeningService} calls this method to inform the system whether the call
Usman Abdullah47b392d2019-03-06 15:54:56 -0800405 * should be silently blocked or not. In the event that it should not be blocked, it may
406 * also be requested to ring silently.
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800407 * <p>
408 * Calls to this method are ignored unless the {@link Call.Details#getCallDirection()} is
409 * {@link Call.Details#DIRECTION_INCOMING}.
Tyler Gunn467acc42020-10-07 15:42:06 -0700410 * <p>
411 * For incoming calls, a {@link CallScreeningService} MUST call this method within 5 seconds of
412 * {@link #onScreenCall(Call.Details)} being invoked by the platform.
413 * <p>
414 * Calls which are blocked/rejected will be logged to the system call log with a call type of
415 * {@link android.provider.CallLog.Calls#BLOCKED_TYPE} and
416 * {@link android.provider.CallLog.Calls#BLOCK_REASON_CALL_SCREENING_SERVICE} block reason.
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800417 *
418 * @param callDetails The call to allow.
Tyler Gunn7e45b722018-12-04 12:56:45 -0800419 * <p>
420 * Must be the same {@link Call.Details call} which was provided to the
421 * {@link CallScreeningService} via {@link #onScreenCall(Call.Details)}.
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800422 * @param response The {@link CallScreeningService.CallResponse} which contains information
423 * about how to respond to a call.
424 */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800425 public final void respondToCall(@NonNull Call.Details callDetails,
426 @NonNull CallResponse response) {
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800427 try {
428 if (response.getDisallowCall()) {
429 mCallScreeningAdapter.disallowCall(
430 callDetails.getTelecomCallId(),
431 response.getRejectCall(),
432 !response.getSkipCallLog(),
tonyzhu9e1d4f82018-10-22 15:11:31 +0800433 !response.getSkipNotification(),
434 new ComponentName(getPackageName(), getClass().getName()));
Usman Abdullah47b392d2019-03-06 15:54:56 -0800435 } else if (response.getSilenceCall()) {
436 mCallScreeningAdapter.silenceCall(callDetails.getTelecomCallId());
Hall Liu69554cf2019-11-11 17:44:09 -0800437 } else if (response.getShouldScreenCallViaAudioProcessing()) {
Hall Liu31de23d2019-10-11 15:38:29 -0700438 mCallScreeningAdapter.screenCallFurther(callDetails.getTelecomCallId());
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800439 } else {
440 mCallScreeningAdapter.allowCall(callDetails.getTelecomCallId());
441 }
442 } catch (RemoteException e) {
443 }
444 }
Sailesh Nepal1bef3392016-01-24 18:21:53 -0800445}