Merge "Add ability to add sim-initiated MO call to UI (3/4)" into lmp-dev
diff --git a/src/com/android/server/telecom/CallActivity.java b/src/com/android/server/telecom/CallActivity.java
index 69da7e4..07f66e4 100644
--- a/src/com/android/server/telecom/CallActivity.java
+++ b/src/com/android/server/telecom/CallActivity.java
@@ -156,8 +156,7 @@
      */
     private boolean sendBroadcastToReceiver(Intent intent, boolean incoming) {
         intent.putExtra(CallReceiver.KEY_IS_INCOMING_CALL, incoming);
-        // Clear out any flags set previously since we don't need it for the broadcast.
-        intent.setFlags(0);
+        intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
         intent.setClass(this, CallReceiver.class);
         Log.d(this, "Sending broadcast as user to CallReceiver- isIncoming: %s", incoming);
         sendBroadcastAsUser(intent, UserHandle.OWNER);
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);