Set "has no children" capability on IMS conferences.

- By default setting "has no childen" capability on ims conferences.
- Handling case where conference event package data arrives (setting on
the conference capabilities).
- Fixed a bug where a change in the conference capabilities due to arrival
of a conference event package were not actually being communicated to
Telecom.  Previously the addCapability and removeCapability methods were
used; those do not call the callback to notify listeners of the change.
Calling setConnectionCapabilities does, however, notify
listeners.

Bug: 21085329
Change-Id: Id4a65a048cea81c836868d948e2aa1ce2639439e
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 38cb4a3..6c4f48e 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -234,7 +234,7 @@
         setConferenceHost(conferenceHost);
 
         int capabilities = Connection.CAPABILITY_SUPPORT_HOLD | Connection.CAPABILITY_HOLD |
-                Connection.CAPABILITY_MUTE;
+                Connection.CAPABILITY_MUTE | Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
 
         capabilities = applyVideoCapabilities(capabilities, mConferenceHost.getConnectionCapabilities());
         setConnectionCapabilities(capabilities);
@@ -451,21 +451,28 @@
      * Updates the manage conference capability of the conference.  Where there are one or more
      * conference event package participants, the conference management is permitted.  Where there
      * are no conference event package participants, conference management is not permitted.
+     * <p>
+     * Note: We add and remove {@link Connection#CAPABILITY_CONFERENCE_HAS_NO_CHILDREN} to ensure
+     * that the conference is represented appropriately on Bluetooth devices.
      */
     private void updateManageConference() {
         boolean couldManageConference = can(Connection.CAPABILITY_MANAGE_CONFERENCE);
         boolean canManageConference = !mConferenceParticipantConnections.isEmpty();
-        Log.v(this, "updateManageConference was:%s is:%s", couldManageConference ? "Y" : "N",
+        Log.v(this, "updateManageConference was :%s is:%s", couldManageConference ? "Y" : "N",
                 canManageConference ? "Y" : "N");
 
         if (couldManageConference != canManageConference) {
-            int newCapabilities = getConnectionCapabilities();
+            int capabilities = getConnectionCapabilities();
 
             if (canManageConference) {
-                addCapability(Connection.CAPABILITY_MANAGE_CONFERENCE);
+                capabilities |= Connection.CAPABILITY_MANAGE_CONFERENCE;
+                capabilities &= ~Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
             } else {
-                removeCapability(Connection.CAPABILITY_MANAGE_CONFERENCE);
+                capabilities &= ~Connection.CAPABILITY_MANAGE_CONFERENCE;
+                capabilities |= Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
             }
+
+            setConnectionCapabilities(capabilities);
         }
     }