Dont clear serviceConnections on subsequent bind() calls.
Bind() gets invoked with each call that is added before the first bind()
is complete. We were clearing the service connection set each time which
effectively meant that we were dropping the previous bind requests on
the floor. The rest of the code already does the right checks to not
rebind to the same service so just remove the clear().
Bug:17735448
Change-Id: I614225b05fa29b143604fe4dfedaa1e417dc2d2d
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 2dc30da..6621c7c 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -261,8 +261,6 @@
private void bind() {
ThreadUtil.checkOnMainThread();
if (mInCallServices.isEmpty()) {
- mServiceConnections.clear();
-
PackageManager packageManager = mContext.getPackageManager();
Intent serviceIntent = new Intent(InCallService.SERVICE_INTERFACE);
@@ -289,11 +287,14 @@
continue;
}
- Log.i(this, "Attempting to bind to InCall " + serviceInfo.packageName);
InCallServiceConnection inCallServiceConnection = new InCallServiceConnection();
ComponentName componentName = new ComponentName(serviceInfo.packageName,
serviceInfo.name);
+ Log.i(this, "Attempting to bind to InCall %s, is dupe? %b ",
+ serviceInfo.packageName,
+ mServiceConnections.containsKey(componentName));
+
if (!mServiceConnections.containsKey(componentName)) {
Intent intent = new Intent(InCallService.SERVICE_INTERFACE);
intent.setComponent(componentName);