Create default InCallService with Context.BIND_IMPORTANT
Docs suggest that this is good to do when starting a service from an
activity.
Performance is too affected by b/18338152 to get accurate measurements
right now, but this change doesn't seem to hurt (~50ms faster across
9 runs, 3 runs per reboot).
Bug: 18373617
Change-Id: I235120f23ab972157653c9863f99511adbac747b
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 46fdcdb..60c51e4 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -314,8 +314,11 @@
Intent intent = new Intent(InCallService.SERVICE_INTERFACE);
intent.setComponent(componentName);
- if (mContext.bindServiceAsUser(intent, inCallServiceConnection,
- Context.BIND_AUTO_CREATE, UserHandle.CURRENT)) {
+ final int bindFlags = mInCallComponentName.equals(componentName)
+ ? Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT
+ : Context.BIND_AUTO_CREATE;
+ if (mContext.bindServiceAsUser(intent, inCallServiceConnection, bindFlags,
+ UserHandle.CURRENT)) {
mServiceConnections.put(componentName, inCallServiceConnection);
}
}