Implement performConference() in TelephonyConnection.

Move the implementation from Gsm to TelephonyConnection so that it
can be invoked by a CdmaConnection if it is an IMS connection.

Bug: 18240234
Change-Id: Ie31f9f671a1f0df81cfb65299dc587d164c0d053
diff --git a/src/com/android/services/telephony/CdmaConnection.java b/src/com/android/services/telephony/CdmaConnection.java
index 779cb70..d2988da 100644
--- a/src/com/android/services/telephony/CdmaConnection.java
+++ b/src/com/android/services/telephony/CdmaConnection.java
@@ -166,6 +166,15 @@
         return capabilities;
     }
 
+    @Override
+    public void performConference(TelephonyConnection otherConnection) {
+        if (isImsConnection()) {
+            super.performConference(otherConnection);
+        } else {
+            Log.w(this, "Non-IMS CDMA Connection attempted to call performConference.");
+        }
+    }
+
     void forceAsDialing(boolean isDialing) {
         if (isDialing) {
             setDialing();
diff --git a/src/com/android/services/telephony/GsmConnection.java b/src/com/android/services/telephony/GsmConnection.java
index 1632457..4482d36 100644
--- a/src/com/android/services/telephony/GsmConnection.java
+++ b/src/com/android/services/telephony/GsmConnection.java
@@ -46,23 +46,6 @@
     }
 
     @Override
-    public void performConference(TelephonyConnection otherConnection) {
-        Log.d(this, "performConference - %s", this);
-        if (getPhone() != null) {
-            try {
-                // We dont use the "other" connection because there is no concept of that in the
-                // implementation of calls inside telephony. Basically, you can "conference" and it
-                // will conference with the background call.  We know that otherConnection is the
-                // background call because it would never have called setConferenceableConnections()
-                // otherwise.
-                getPhone().conference();
-            } catch (CallStateException e) {
-                Log.e(this, e, "Failed to conference call.");
-            }
-        }
-    }
-
-    @Override
     protected int buildCallCapabilities() {
         int capabilities = super.buildCallCapabilities();
         capabilities |= PhoneCapabilities.ADD_CALL;
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index e478d11..c8f26f8 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -373,7 +373,21 @@
         }
     }
 
-    public void performConference(TelephonyConnection otherConnection) {}
+    public void performConference(TelephonyConnection otherConnection) {
+        Log.d(this, "performConference - %s", this);
+        if (getPhone() != null) {
+            try {
+                // We dont use the "other" connection because there is no concept of that in the
+                // implementation of calls inside telephony. Basically, you can "conference" and it
+                // will conference with the background call.  We know that otherConnection is the
+                // background call because it would never have called setConferenceableConnections()
+                // otherwise.
+                getPhone().conference();
+            } catch (CallStateException e) {
+                Log.e(this, e, "Failed to conference call.");
+            }
+        }
+    }
 
     /**
      * Builds call capabilities common to all TelephonyConnections. Namely, apply IMS-based