Creating connections for conference event package participants.

- Add "addExistingConnection" method to connection service which provides
a way for a connection service to notify telecom of a pre-existing
connection (connections are normally created through telecom).
- Modify TelephonyConferenceController to retrieve its state from a
multiparty connection in the conference (in the case of IMS calls, this
would be the ImsCall that manages the conference) instead of just taking
the first one.

Bug: 18057361
Change-Id: I26993aec54ecb0ce90ae6983fd3eed9d8d0a5773
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index c676172..e67af8c 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -344,4 +344,20 @@
             }
         }
     }
+
+    /**
+     * Informs telecom of an existing connection which was added by the {@link ConnectionService}.
+     *
+     * @param callId The unique ID of the call being added.
+     * @param connection The connection.
+     */
+    void addExistingConnection(String callId, ParcelableConnection connection) {
+        Log.v(this, "addExistingConnection: %s", callId);
+        for (IConnectionServiceAdapter adapter : mAdapters) {
+            try {
+                adapter.addExistingConnection(callId, connection);
+            } catch (RemoteException ignored) {
+            }
+        }
+    }
 }