Merge "Remove references to CallService from Telephony"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4feb644..83f9f20 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -555,7 +555,7 @@
                 android:name="com.android.services.telephony.PstnConnectionService"
                 android:label="@string/pstn_connection_service_label">
             <intent-filter>
-                <action android:name="android.telecomm.CallService" />
+                <action android:name="android.telecomm.ConnectionService" />
             </intent-filter>
         </service>
         <service
@@ -563,7 +563,7 @@
                 android:name="com.android.services.telephony.SipConnectionService"
                 android:label="@string/sip_connection_service_label">
             <intent-filter>
-                <action android:name="android.telecomm.CallService" />
+                <action android:name="android.telecomm.ConnectionService" />
             </intent-filter>
         </service>
         <provider
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index a961968..cec266d 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -2250,7 +2250,7 @@
     }
 
     private void loadConnectionServiceEntries() {
-        Intent intent = new Intent(TelecommConstants.ACTION_CALL_SERVICE);
+        Intent intent = new Intent(TelecommConstants.ACTION_CONNECTION_SERVICE);
         for (ResolveInfo entry : getPackageManager().queryIntentServices(intent, 0)) {
             ServiceInfo serviceInfo = entry.serviceInfo;
             if (serviceInfo != null) {
diff --git a/src/com/android/services/telephony/ConferenceConnection.java b/src/com/android/services/telephony/ConferenceConnection.java
index 43095b1..3d62f6a 100644
--- a/src/com/android/services/telephony/ConferenceConnection.java
+++ b/src/com/android/services/telephony/ConferenceConnection.java
@@ -48,7 +48,7 @@
                 if (origConnection != null && origConnection.getCall() != null) {
                     try {
                         // getCall() returns what is the parent call of all conferenced conections
-                        // so we only need ot call hangup on the main call object. Break once we've
+                        // so we only need to call hangup on the main call object. Break once we've
                         // done that.
                         origConnection.getCall().hangup();
                         break;
@@ -63,11 +63,12 @@
     /** ${inheritDoc} */
     @Override
     protected void onHold() {
-        List<Connection> children = getChildConnections();
-        if (!children.isEmpty()) {
-            // Hold only needs to be called on one of the children.
-            children.get(0).hold();
+        for (Connection connection : getChildConnections()) {
+            if (connection instanceof TelephonyConnection) {
+                ((TelephonyConnection) connection).onHold();
+                // Hold only needs to be called on one of the children.
+                break;
+            }
         }
     }
-
 }
diff --git a/src/com/android/services/telephony/GsmConferenceController.java b/src/com/android/services/telephony/GsmConferenceController.java
index 35b81d2..138aa8e 100644
--- a/src/com/android/services/telephony/GsmConferenceController.java
+++ b/src/com/android/services/telephony/GsmConferenceController.java
@@ -74,7 +74,9 @@
             mGsmConferenceConnection = new ConferenceConnection();
             Log.d(this, "creating the conference connection: %s", mGsmConferenceConnection);
         }
-        rootConnection.conference();
+        if (rootConnection instanceof GsmConnection) {
+            ((GsmConnection) rootConnection).performConference();
+        }
         return mGsmConferenceConnection;
     }
 
diff --git a/src/com/android/services/telephony/GsmConnection.java b/src/com/android/services/telephony/GsmConnection.java
index 34ef27e..7019068 100644
--- a/src/com/android/services/telephony/GsmConnection.java
+++ b/src/com/android/services/telephony/GsmConnection.java
@@ -43,9 +43,7 @@
         super.onStopDtmfTone();
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public void onConference() {
+    public void performConference() {
         try {
             Log.d(this, "conference - %s", this);
             getPhone().conference();
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 9dffe50..0d29ed9 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -24,7 +24,6 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.UserHandle;
-import android.telecomm.CallService;
 import android.telecomm.CallServiceDescriptor;
 import android.telecomm.TelecommConstants;
 
@@ -156,7 +155,7 @@
         Context context = mPhoneProxy.getContext();
 
         CallServiceDescriptor.Builder builder = CallServiceDescriptor.newBuilder(context);
-        builder.setCallService(PstnConnectionService.class);
+        builder.setConnectionService(PstnConnectionService.class);
         builder.setNetworkType(CallServiceDescriptor.FLAG_PSTN);
 
         Intent intent = new Intent(TelecommConstants.ACTION_INCOMING_CALL);
diff --git a/src/com/android/services/telephony/SipConnection.java b/src/com/android/services/telephony/SipConnection.java
index 34d734a..133a42d 100644
--- a/src/com/android/services/telephony/SipConnection.java
+++ b/src/com/android/services/telephony/SipConnection.java
@@ -55,7 +55,7 @@
 
     /** {@inheritDoc} */
     @Override
-    protected void onHold() {
+    public void onHold() {
         super.onHold();
     }
 
diff --git a/src/com/android/services/telephony/SipConnectionService.java b/src/com/android/services/telephony/SipConnectionService.java
index 465dba1..ea364bd 100644
--- a/src/com/android/services/telephony/SipConnectionService.java
+++ b/src/com/android/services/telephony/SipConnectionService.java
@@ -39,7 +39,7 @@
 import java.util.HashMap;
 
 /**
- * Call service that uses the SIP phone.
+ * Connection service that uses the SIP phone.
  */
 public class SipConnectionService extends TelephonyConnectionService {
     private static HashMap<String, SipPhone> sSipPhones = new HashMap<String, SipPhone>();
diff --git a/src/com/android/services/telephony/TelephonyCallServiceProvider.java b/src/com/android/services/telephony/TelephonyCallServiceProvider.java
index cc89c0e..12bb2af 100644
--- a/src/com/android/services/telephony/TelephonyCallServiceProvider.java
+++ b/src/com/android/services/telephony/TelephonyCallServiceProvider.java
@@ -31,11 +31,11 @@
     public void lookupCallServices(CallServiceLookupResponse response) {
         ArrayList<CallServiceDescriptor> descriptors = new ArrayList<CallServiceDescriptor>();
         descriptors.add(CallServiceDescriptor.newBuilder(this)
-                   .setCallService(PstnConnectionService.class)
+                   .setConnectionService(PstnConnectionService.class)
                    .setNetworkType(CallServiceDescriptor.FLAG_PSTN)
                    .build());
         descriptors.add(CallServiceDescriptor.newBuilder(this)
-                .setCallService(SipConnectionService.class)
+                .setConnectionService(SipConnectionService.class)
                 .setNetworkType(CallServiceDescriptor.FLAG_WIFI |
                         CallServiceDescriptor.FLAG_MOBILE)
                 .build());
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index f379347..1cfabbb 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -73,7 +73,7 @@
     }
 
     @Override
-    protected void onHold() {
+    public void onHold() {
         Log.d(this, "Attempting to put call on hold");
         // TODO(santoscordon): Can dialing calls be put on hold as well since they take up the
         // foreground call slot?
@@ -112,7 +112,7 @@
         Log.d(this, "Attempting to release call from hold");
         if (Call.State.HOLDING == mState) {
             try {
-                // TODO: This doesn't handle multiple calls across call services yet
+                // TODO: This doesn't handle multiple calls across connection services yet
                 mOriginalConnection.getCall().getPhone().switchHoldingAndActive();
             } catch (CallStateException e) {
                 Log.e(this, e, "Exception occurred while trying to release call from hold.");
diff --git a/src/com/android/services/telephony/TelephonyGlobals.java b/src/com/android/services/telephony/TelephonyGlobals.java
index 22346b7..59e0dd5 100644
--- a/src/com/android/services/telephony/TelephonyGlobals.java
+++ b/src/com/android/services/telephony/TelephonyGlobals.java
@@ -51,7 +51,7 @@
     }
 
     /**
-     * Sets up incoming call notifiers for all the call services.
+     * Sets up incoming call notifiers for all the connection services.
      */
     private void setupIncomingCallNotifiers() {
         PhoneProxy defaultPhone = (PhoneProxy) PhoneFactory.getDefaultPhone();