Refactor CallScreeningService

Take the call response directly from the client app and do all logic
Telecom-side. Also pipe through the response to the connection service.

Bug: Bug: 179412110
Test: atest ConnectionServiceTest CallScreeningServiceTest
Change-Id: Ia01fb6f491da9d0ebb227c02a2b4d031b88e6b86
diff --git a/src/com/android/server/telecom/CallScreeningServiceHelper.java b/src/com/android/server/telecom/CallScreeningServiceHelper.java
index f02b924..9435250 100644
--- a/src/com/android/server/telecom/CallScreeningServiceHelper.java
+++ b/src/com/android/server/telecom/CallScreeningServiceHelper.java
@@ -55,23 +55,8 @@
         }
 
         @Override
-        public void allowCall(String s) throws RemoteException {
-            unbindCallScreeningService();
-        }
-
-        @Override
-        public void silenceCall(String s) throws RemoteException {
-            unbindCallScreeningService();
-        }
-
-        @Override
-        public void screenCallFurther(String callId) throws RemoteException {
-            unbindCallScreeningService();
-        }
-
-        @Override
-        public void disallowCall(String s, boolean b, boolean b1, boolean b2,
-                ComponentName componentName) throws RemoteException {
+        public void onScreeningResponse(String callId, ComponentName componentName,
+                CallScreeningService.ParcelableCallResponse callResponse) {
             unbindCallScreeningService();
         }
 
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index a3a9b89..e0cc01e 100755
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -764,7 +764,8 @@
             boolean isInContacts = incomingCall.getCallerInfo() != null
                     && incomingCall.getCallerInfo().contactExists;
             incomingCall.getConnectionService().onCallFilteringCompleted(incomingCall,
-                    !result.shouldAllowCall, isInContacts);
+                    !result.shouldAllowCall, isInContacts, result.mCallScreeningResponse,
+                    result.mIsResponseFromSystemDialer);
         }
 
         if (result.shouldAllowCall) {
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index 5a1b8bd..744c6a0 100755
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -31,6 +31,7 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.telecom.CallAudioState;
+import android.telecom.CallScreeningService;
 import android.telecom.Connection;
 import android.telecom.ConnectionRequest;
 import android.telecom.ConnectionService;
@@ -1864,7 +1865,9 @@
         }
     }
 
-    void onCallFilteringCompleted(Call call, boolean isBlocked, boolean isInContacts) {
+    void onCallFilteringCompleted(Call call, boolean isBlocked, boolean isInContacts,
+            CallScreeningService.ParcelableCallResponse callScreeningResponse,
+            boolean isResponseFromSystemDialer) {
         final String callId = mCallIdMapper.getCallId(call);
         if (callId != null && isServiceValid("onCallFilteringCompleted")) {
             try {
@@ -1874,6 +1877,7 @@
                                 getComponentName().getPackageName());
                 if (contactsPermission == PackageManager.PERMISSION_GRANTED) {
                     mServiceInterface.onCallFilteringCompleted(callId, isBlocked, isInContacts,
+                            callScreeningResponse, isResponseFromSystemDialer,
                             Log.getExternalSession(TELECOM_ABBREVIATION));
                 } else {
                     logOutgoing("Skipping call filtering complete message for %s due"
diff --git a/src/com/android/server/telecom/callfiltering/CallFilteringResult.java b/src/com/android/server/telecom/callfiltering/CallFilteringResult.java
index d95d578..a853f2f 100644
--- a/src/com/android/server/telecom/callfiltering/CallFilteringResult.java
+++ b/src/com/android/server/telecom/callfiltering/CallFilteringResult.java
@@ -18,6 +18,7 @@
 
 import android.provider.CallLog;
 import android.provider.CallLog.Calls;
+import android.telecom.CallScreeningService;
 import android.text.TextUtils;
 
 import java.util.Objects;
@@ -34,6 +35,8 @@
         private int mCallBlockReason = Calls.BLOCK_REASON_NOT_BLOCKED;
         private CharSequence mCallScreeningAppName = null;
         private String mCallScreeningComponentName = null;
+        private CallScreeningService.ParcelableCallResponse mCallScreeningResponse = null;
+        private boolean mIsResponseFromSystemDialer = false;
 
         public Builder setShouldAllowCall(boolean shouldAllowCall) {
             mShouldAllowCall = shouldAllowCall;
@@ -80,6 +83,13 @@
             return this;
         }
 
+        public Builder setCallScreeningResponse(
+                CallScreeningService.ParcelableCallResponse response, boolean isFromSystemDialer) {
+            mCallScreeningResponse = response;
+            mIsResponseFromSystemDialer = isFromSystemDialer;
+            return this;
+        }
+
         public Builder setContactExists(boolean contactExists) {
             mContactExists = contactExists;
             return this;
@@ -96,14 +106,16 @@
                     .setShouldScreenViaAudio(result.shouldScreenViaAudio)
                     .setCallScreeningAppName(result.mCallScreeningAppName)
                     .setCallScreeningComponentName(result.mCallScreeningComponentName)
+                    .setCallScreeningResponse(result.mCallScreeningResponse,
+                            result.mIsResponseFromSystemDialer)
                     .setContactExists(result.contactExists);
         }
 
         public CallFilteringResult build() {
             return new CallFilteringResult(mShouldAllowCall, mShouldReject, mShouldSilence,
                     mShouldAddToCallLog, mShouldShowNotification, mCallBlockReason,
-                    mCallScreeningAppName, mCallScreeningComponentName, mShouldScreenViaAudio,
-                    mContactExists);
+                    mCallScreeningAppName, mCallScreeningComponentName, mCallScreeningResponse,
+                    mIsResponseFromSystemDialer, mShouldScreenViaAudio, mContactExists);
         }
     }
 
@@ -116,11 +128,15 @@
     public int mCallBlockReason;
     public CharSequence mCallScreeningAppName;
     public String mCallScreeningComponentName;
+    public CallScreeningService.ParcelableCallResponse mCallScreeningResponse;
+    public boolean mIsResponseFromSystemDialer;
     public boolean contactExists;
 
     private CallFilteringResult(boolean shouldAllowCall, boolean shouldReject, boolean
             shouldSilence, boolean shouldAddToCallLog, boolean shouldShowNotification, int
             callBlockReason, CharSequence callScreeningAppName, String callScreeningComponentName,
+            CallScreeningService.ParcelableCallResponse callScreeningResponse,
+            boolean isResponseFromSystemDialer,
             boolean shouldScreenViaAudio, boolean contactExists) {
         this.shouldAllowCall = shouldAllowCall;
         this.shouldReject = shouldReject;
@@ -131,6 +147,8 @@
         this.mCallBlockReason = callBlockReason;
         this.mCallScreeningAppName = callScreeningAppName;
         this.mCallScreeningComponentName = callScreeningComponentName;
+        this.mCallScreeningResponse = callScreeningResponse;
+        this.mIsResponseFromSystemDialer = isResponseFromSystemDialer;
         this.contactExists = contactExists;
     }
 
@@ -148,25 +166,25 @@
 
         if (isBlockedByProvider(mCallBlockReason)) {
             return getCombinedCallFilteringResult(other, mCallBlockReason,
-                null /*callScreeningAppName*/, null /*callScreeningComponentName*/);
+                    null /*callScreeningAppName*/, null /*callScreeningComponentName*/);
         } else if (isBlockedByProvider(other.mCallBlockReason)) {
             return getCombinedCallFilteringResult(other, other.mCallBlockReason,
-                null /*callScreeningAppName*/, null /*callScreeningComponentName*/);
+                    null /*callScreeningAppName*/, null /*callScreeningComponentName*/);
         }
 
         if (mCallBlockReason == Calls.BLOCK_REASON_DIRECT_TO_VOICEMAIL
-            || other.mCallBlockReason == Calls.BLOCK_REASON_DIRECT_TO_VOICEMAIL) {
+                || other.mCallBlockReason == Calls.BLOCK_REASON_DIRECT_TO_VOICEMAIL) {
             return getCombinedCallFilteringResult(other, Calls.BLOCK_REASON_DIRECT_TO_VOICEMAIL,
-                null /*callScreeningAppName*/, null /*callScreeningComponentName*/);
+                    null /*callScreeningAppName*/, null /*callScreeningComponentName*/);
         }
 
         if (shouldReject && mCallBlockReason == CallLog.Calls.BLOCK_REASON_CALL_SCREENING_SERVICE) {
             return getCombinedCallFilteringResult(other, Calls.BLOCK_REASON_CALL_SCREENING_SERVICE,
-                mCallScreeningAppName, mCallScreeningComponentName);
+                    mCallScreeningAppName, mCallScreeningComponentName);
         } else if (other.shouldReject && other.mCallBlockReason == CallLog.Calls
-            .BLOCK_REASON_CALL_SCREENING_SERVICE) {
+                .BLOCK_REASON_CALL_SCREENING_SERVICE) {
             return getCombinedCallFilteringResult(other, Calls.BLOCK_REASON_CALL_SCREENING_SERVICE,
-                other.mCallScreeningAppName, other.mCallScreeningComponentName);
+                    other.mCallScreeningAppName, other.mCallScreeningComponentName);
         }
 
         if (shouldScreenViaAudio) {
@@ -177,15 +195,16 @@
                     other.mCallScreeningAppName, other.mCallScreeningComponentName);
         }
 
-        return new Builder()
+        Builder b = new Builder()
                 .setShouldAllowCall(shouldAllowCall && other.shouldAllowCall)
                 .setShouldReject(shouldReject || other.shouldReject)
                 .setShouldSilence(shouldSilence || other.shouldSilence)
                 .setShouldAddToCallLog(shouldAddToCallLog && other.shouldAddToCallLog)
                 .setShouldShowNotification(shouldShowNotification && other.shouldShowNotification)
                 .setShouldScreenViaAudio(shouldScreenViaAudio || other.shouldScreenViaAudio)
-                .setContactExists(contactExists || other.contactExists)
-                .build();
+                .setContactExists(contactExists || other.contactExists);
+        combineScreeningResponses(b, this, other);
+        return b.build();
     }
 
     private boolean isBlockedByProvider(int blockReason) {
@@ -201,8 +220,9 @@
     }
 
     private CallFilteringResult getCombinedCallFilteringResult(CallFilteringResult other,
-        int callBlockReason, CharSequence callScreeningAppName, String callScreeningComponentName) {
-        return new Builder()
+            int callBlockReason, CharSequence callScreeningAppName,
+            String callScreeningComponentName) {
+        Builder b = new Builder()
                 .setShouldAllowCall(shouldAllowCall && other.shouldAllowCall)
                 .setShouldReject(shouldReject || other.shouldReject)
                 .setShouldSilence(shouldSilence || other.shouldSilence)
@@ -212,10 +232,22 @@
                 .setCallBlockReason(callBlockReason)
                 .setCallScreeningAppName(callScreeningAppName)
                 .setCallScreeningComponentName(callScreeningComponentName)
-                .setContactExists(contactExists || other.contactExists)
-                .build();
+                .setContactExists(contactExists || other.contactExists);
+        combineScreeningResponses(b, this, other);
+        return b.build();
     }
 
+    private static void combineScreeningResponses(Builder builder, CallFilteringResult r1,
+            CallFilteringResult r2) {
+        if (r1.mIsResponseFromSystemDialer) {
+            builder.setCallScreeningResponse(r1.mCallScreeningResponse, true);
+        } else if (r2.mIsResponseFromSystemDialer) {
+            builder.setCallScreeningResponse(r2.mCallScreeningResponse, true);
+        } else {
+            builder.setCallScreeningResponse(r1.mCallScreeningResponse == null
+                    ? r2.mCallScreeningResponse : r1.mCallScreeningResponse, false);
+        }
+    }
 
     @Override
     public boolean equals(Object o) {
diff --git a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
index 486cd8d..4a308e0 100644
--- a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
+++ b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
@@ -25,6 +25,7 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.provider.CallLog;
+import android.telecom.CallScreeningService;
 import android.telecom.Log;
 import android.telecom.TelecomManager;
 
@@ -64,15 +65,44 @@
         }
 
         @Override
-        public void allowCall(String callId) {
-            Long token = Binder.clearCallingIdentity();
+        public void onScreeningResponse(String callId, ComponentName componentName,
+                CallScreeningService.ParcelableCallResponse callResponse) {
+            if (callResponse == null) {
+                Log.w(this, "Null responses are only supposed to happen for outgoing calls");
+                return;
+            }
+            if (callResponse.shouldDisallowCall()) {
+                disallowCall(callId, componentName, callResponse);
+            } else if (callResponse.shouldSilenceCall()) {
+                silenceCall(callId, componentName, callResponse);
+            } else if (callResponse.shouldScreenCallViaAudioProcessing()) {
+                screenCallFurther(callId, componentName, callResponse);
+            } else {
+                allowCall(callId, componentName, callResponse);
+            }
+        }
+
+        public void allowCall(String callId, ComponentName componentName,
+                CallScreeningService.ParcelableCallResponse response) {
+            long token = Binder.clearCallingIdentity();
             Log.startSession("NCSSF.aC");
             try {
                 if (mCall == null || (!mCall.getId().equals(callId))) {
                     Log.w(this, "allowCall, unknown call id: %s", callId);
                 }
-                Log.addEvent(mCall, LogUtils.Events.SCREENING_COMPLETED, mPriorStageResult);
-                mResultFuture.complete(mPriorStageResult);
+                CallFilteringResult result = new CallFilteringResult.Builder()
+                        .setShouldAllowCall(true)
+                        .setShouldReject(false)
+                        .setShouldSilence(false)
+                        .setShouldAddToCallLog(mPriorStageResult.shouldAddToCallLog)
+                        .setShouldShowNotification(mPriorStageResult.shouldShowNotification)
+                        .setCallScreeningAppName(mAppName)
+                        .setCallScreeningComponentName(componentName.flattenToString())
+                        .setCallScreeningResponse(response, isSystemDialer())
+                        .setContactExists(mPriorStageResult.contactExists)
+                        .build();
+                Log.addEvent(mCall, LogUtils.Events.SCREENING_COMPLETED, result);
+                mResultFuture.complete(result);
             } finally {
                 unbindCallScreeningService();
                 Binder.restoreCallingIdentity(token);
@@ -80,24 +110,23 @@
             }
         }
 
-        @Override
-        public void disallowCall(String callId, boolean shouldReject,
-                boolean shouldAddToCallLog, boolean shouldShowNotification,
-                ComponentName componentName) {
+        public void disallowCall(String callId, ComponentName componentName,
+                CallScreeningService.ParcelableCallResponse response) {
             long token = Binder.clearCallingIdentity();
             Log.startSession("NCSSF.dC");
             try {
                 if (mCall != null && mCall.getId().equals(callId)) {
                     CallFilteringResult result = new CallFilteringResult.Builder()
                             .setShouldAllowCall(false)
-                            .setShouldReject(shouldReject)
+                            .setShouldReject(response.shouldRejectCall())
                             .setShouldSilence(false)
-                            .setShouldAddToCallLog(shouldAddToCallLog
+                            .setShouldAddToCallLog(!response.shouldSkipCallLog()
                                     || packageTypeShouldAdd(mPackagetype))
-                            .setShouldShowNotification(shouldShowNotification)
+                            .setShouldShowNotification(!response.shouldSkipNotification())
                             .setCallBlockReason(CallLog.Calls.BLOCK_REASON_CALL_SCREENING_SERVICE)
                             .setCallScreeningAppName(mAppName)
                             .setCallScreeningComponentName(componentName.flattenToString())
+                            .setCallScreeningResponse(response, isSystemDialer())
                             .setContactExists(mPriorStageResult.contactExists)
                             .build();
                     Log.addEvent(mCall, LogUtils.Events.SCREENING_COMPLETED, result);
@@ -113,8 +142,8 @@
             }
         }
 
-        @Override
-        public void silenceCall(String callId) {
+        public void silenceCall(String callId, ComponentName componentName,
+                CallScreeningService.ParcelableCallResponse response) {
             long token = Binder.clearCallingIdentity();
             Log.startSession("NCSSF.sC");
             try {
@@ -125,6 +154,9 @@
                             .setShouldSilence(true)
                             .setShouldAddToCallLog(true)
                             .setShouldShowNotification(true)
+                            .setCallScreeningResponse(response, isSystemDialer())
+                            .setCallScreeningAppName(mAppName)
+                            .setCallScreeningComponentName(componentName.flattenToString())
                             .setContactExists(mPriorStageResult.contactExists)
                             .build();
                     Log.addEvent(mCall, LogUtils.Events.SCREENING_COMPLETED, result);
@@ -140,8 +172,8 @@
             }
         }
 
-        @Override
-        public void screenCallFurther(String callId) {
+        public void screenCallFurther(String callId, ComponentName componentName,
+                CallScreeningService.ParcelableCallResponse response) {
             if (mPackagetype != PACKAGE_TYPE_DEFAULT_DIALER) {
                 throw new SecurityException("Only the default/system dialer may request screen via"
                     + "background call audio");
@@ -158,6 +190,8 @@
                             .setShouldSilence(false)
                             .setShouldScreenViaAudio(true)
                             .setCallScreeningAppName(mAppName)
+                            .setCallScreeningComponentName(componentName.flattenToString())
+                            .setCallScreeningResponse(response, isSystemDialer())
                             .setContactExists(mPriorStageResult.contactExists)
                             .build();
                     Log.addEvent(mCall, LogUtils.Events.SCREENING_COMPLETED, result);
diff --git a/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java b/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java
index e3c68c9..50cd731 100644
--- a/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java
+++ b/src/com/android/server/telecom/callfiltering/IncomingCallFilterGraph.java
@@ -49,7 +49,7 @@
     private final HandlerThread mHandlerThread;
     private final TelecomSystem.SyncRoot mLock;
     private List<CallFilter> mFiltersList;
-    private CallFilter mDummyComplete;
+    private CallFilter mCompletionSentinel;
     private boolean mFinished;
     private CallFilteringResult mCurrentResult;
     private Context mContext;
@@ -70,7 +70,7 @@
                     scheduleFilter(filter);
                 }
             }
-            if (mFilter.equals(mDummyComplete)) {
+            if (mFilter.equals(mCompletionSentinel)) {
                 synchronized (mLock) {
                     mFinished = true;
                     mListener.onCallFilteringComplete(mCall, result, false);
@@ -105,15 +105,15 @@
     public void performFiltering() {
         Log.addEvent(mCall, LogUtils.Events.FILTERING_INITIATED);
         CallFilter dummyStart = new CallFilter();
-        mDummyComplete = new CallFilter();
+        mCompletionSentinel = new CallFilter();
 
         for (CallFilter filter : mFiltersList) {
             addEdge(dummyStart, filter);
         }
         for (CallFilter filter : mFiltersList) {
-            addEdge(filter, mDummyComplete);
+            addEdge(filter, mCompletionSentinel);
         }
-        addEdge(dummyStart, mDummyComplete);
+        addEdge(dummyStart, mCompletionSentinel);
 
         scheduleFilter(dummyStart);
         mHandler.postDelayed(new Runnable("ICFG.pF", mLock) {
diff --git a/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java b/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
index c7b3a7e..68caf67 100644
--- a/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
@@ -93,6 +93,16 @@
             .setShouldShowNotification(true)
             .build();
 
+    private static final CallFilteringResult PASS_RESULT_WITH_NAME =
+            new CallFilteringResult.Builder()
+                    .setShouldAllowCall(true)
+                    .setShouldReject(false)
+                    .setShouldAddToCallLog(true)
+                    .setShouldShowNotification(true)
+                    .setCallScreeningAppName(APP_NAME)
+                    .setCallScreeningComponentName(COMPONENT_NAME.flattenToString())
+                    .build();
+
     @Override
     @Before
     public void setUp() throws Exception {
@@ -235,8 +245,14 @@
 
         serviceConnection.onServiceConnected(COMPONENT_NAME, mBinder);
         ICallScreeningAdapter csAdapter = getCallScreeningAdapter();
-        csAdapter.allowCall(CALL_ID);
-        assertEquals(PASS_RESULT,
+        CallScreeningService.CallResponse allowCallResponse =
+                new CallScreeningService.CallResponse.Builder()
+                .setDisallowCall(false)
+                .setRejectCall(false)
+                .setSilenceCall(false)
+                .build();
+        csAdapter.onScreeningResponse(CALL_ID, COMPONENT_NAME, allowCallResponse.toParcelable());
+        assertEquals(PASS_RESULT_WITH_NAME,
                 resultFuture.toCompletableFuture().get(
                         CallScreeningServiceFilter.CALL_SCREENING_FILTER_TIMEOUT,
                         TimeUnit.MILLISECONDS));
@@ -264,12 +280,16 @@
         ServiceConnection serviceConnection = verifyBindingIntent();
 
         serviceConnection.onServiceConnected(COMPONENT_NAME, mBinder);
+        CallScreeningService.CallResponse disallowCallResponse =
+                new CallScreeningService.CallResponse.Builder()
+                        .setDisallowCall(true)
+                        .setRejectCall(true)
+                        .setSkipCallLog(false)
+                        .setSkipNotification(false)
+                        .build();
         ICallScreeningAdapter csAdapter = getCallScreeningAdapter();
-        csAdapter.disallowCall(CALL_ID,
-                true, // shouldReject
-                true, //shouldAddToCallLog
-                true, // shouldShowNotification
-                COMPONENT_NAME);
+        csAdapter.onScreeningResponse(CALL_ID, COMPONENT_NAME, disallowCallResponse.toParcelable());
+
         assertEquals(expectedResult,
                 resultFuture.toCompletableFuture().get(
                         CallScreeningServiceFilter.CALL_SCREENING_FILTER_TIMEOUT,
@@ -286,6 +306,8 @@
                 .setShouldSilence(true)
                 .setShouldAddToCallLog(true)
                 .setShouldShowNotification(true)
+                .setCallScreeningAppName(APP_NAME)
+                .setCallScreeningComponentName(COMPONENT_NAME.flattenToString())
                 .build();
         CallScreeningServiceFilter filter = new CallScreeningServiceFilter(mCall, PKG_NAME,
                 CallScreeningServiceFilter.PACKAGE_TYPE_CARRIER, mContext, mCallsManager,
@@ -296,7 +318,13 @@
 
         serviceConnection.onServiceConnected(COMPONENT_NAME, mBinder);
         ICallScreeningAdapter csAdapter = getCallScreeningAdapter();
-        csAdapter.silenceCall(CALL_ID);
+        CallScreeningService.CallResponse silenceCallResponse =
+                new CallScreeningService.CallResponse.Builder()
+                        .setDisallowCall(false)
+                        .setRejectCall(false)
+                        .setSilenceCall(true)
+                        .build();
+        csAdapter.onScreeningResponse(CALL_ID, COMPONENT_NAME, silenceCallResponse.toParcelable());
         assertEquals(expectedResult,
                 resultFuture.toCompletableFuture().get(
                         CallScreeningServiceFilter.CALL_SCREENING_FILTER_TIMEOUT,
@@ -314,6 +342,7 @@
                 .setShouldSilence(false)
                 .setShouldScreenViaAudio(true)
                 .setCallScreeningAppName(APP_NAME)
+                .setCallScreeningComponentName(COMPONENT_NAME.flattenToString())
                 .build();
         CallScreeningServiceFilter filter = new CallScreeningServiceFilter(mCall, PKG_NAME,
                 CallScreeningServiceFilter.PACKAGE_TYPE_DEFAULT_DIALER, mContext, mCallsManager,
@@ -323,8 +352,17 @@
         ServiceConnection serviceConnection = verifyBindingIntent();
 
         serviceConnection.onServiceConnected(COMPONENT_NAME, mBinder);
+
+        CallScreeningService.CallResponse additionalScreeningResponse =
+                new CallScreeningService.CallResponse.Builder()
+                        .setDisallowCall(false)
+                        .setRejectCall(false)
+                        .setSilenceCall(false)
+                        .setShouldScreenCallViaAudioProcessing(true)
+                        .build();
         ICallScreeningAdapter csAdapter = getCallScreeningAdapter();
-        csAdapter.screenCallFurther(CALL_ID);
+        csAdapter.onScreeningResponse(CALL_ID, COMPONENT_NAME,
+                additionalScreeningResponse.toParcelable());
         assertEquals(expectedResult,
                 resultFuture.toCompletableFuture().get(
                         CallScreeningServiceFilter.CALL_SCREENING_FILTER_TIMEOUT,
diff --git a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
index efdb742..6736132 100755
--- a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
@@ -34,6 +34,7 @@
 import android.os.ParcelFileDescriptor;
 import android.os.RemoteException;
 import android.telecom.CallAudioState;
+import android.telecom.CallScreeningService;
 import android.telecom.Conference;
 import android.telecom.Connection;
 import android.telecom.ConnectionRequest;
@@ -440,7 +441,8 @@
 
         @Override
         public void onCallFilteringCompleted(String callId, boolean isBlocked, boolean isInContacts,
-                Session.Info sessionInfo) { }
+                CallScreeningService.ParcelableCallResponse callScreeningResponse,
+                boolean isResponseFromSystemDialer, Session.Info sessionInfo) { }
     }
 
     FakeConnectionServiceDelegate mConnectionServiceDelegate;