Make call screening service bind like a top app

Call screening is part of the flow to get an incoming call
thus latency is crucially important. It was being bound with
default priority so this patch boosts it to schedule like a
top app as it will eventually end up in dialer app as a top
priority anyway and it is fully visible latency sensitive CUJ.

Bug: 242075837
Test: Trace analysis
Test: atest CallScreeningServiceFilterTest
Change-Id: Ia73981ee4a35e9d52a88e13375aa88d983cdd6a9
Merged-In: Ia73981ee4a35e9d52a88e13375aa88d983cdd6a9
diff --git a/src/com/android/server/telecom/CallScreeningServiceHelper.java b/src/com/android/server/telecom/CallScreeningServiceHelper.java
index 167bd1b..c1aff3d 100644
--- a/src/com/android/server/telecom/CallScreeningServiceHelper.java
+++ b/src/com/android/server/telecom/CallScreeningServiceHelper.java
@@ -210,7 +210,8 @@
         if (context.bindServiceAsUser(
                 intent,
                 serviceConnection,
-                Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,
+                Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
+                | Context.BIND_SCHEDULE_LIKE_TOP_APP,
                 UserHandle.CURRENT)) {
             Log.d(TAG, "bindService, found service, waiting for it to connect");
             return true;
diff --git a/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java b/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
index 9ff9986..09ba47e 100644
--- a/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
@@ -395,7 +395,8 @@
                 .forClass(ServiceConnection.class);
         verify(mContext, timeout(CallScreeningServiceFilter.CALL_SCREENING_FILTER_TIMEOUT))
                 .bindServiceAsUser(intentCaptor.capture(), serviceCaptor.capture(),
-                eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE),
+                eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
+                        | Context.BIND_SCHEDULE_LIKE_TOP_APP),
                 eq(UserHandle.CURRENT));
 
         Intent capturedIntent = intentCaptor.getValue();