Merge "Remove CallServiceProvider and CallServiceDescriptor do not merge" into lmp-dev
diff --git a/Android.mk b/Android.mk
index 96b2b17..a823ba0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -340,8 +340,6 @@
 	media/java/android/media/tv/ITvInputServiceCallback.aidl \
 	media/java/android/media/tv/ITvInputSession.aidl \
 	media/java/android/media/tv/ITvInputSessionCallback.aidl \
-	telecomm/java/com/android/internal/telecomm/ICallServiceLookupResponse.aidl \
-	telecomm/java/com/android/internal/telecomm/ICallServiceProvider.aidl \
 	telecomm/java/com/android/internal/telecomm/ICallVideoProvider.aidl \
 	telecomm/java/com/android/internal/telecomm/ICallVideoClient.aidl \
 	telecomm/java/com/android/internal/telecomm/IConnectionService.aidl \
@@ -362,10 +360,6 @@
 	telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
 	telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
 	telephony/java/com/android/internal/telephony/ITelephony.aidl \
-	telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl \
-	telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl \
-	telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl \
-	telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl \
 	telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
 	telephony/java/com/android/internal/telephony/ISms.aidl \
 	telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
diff --git a/api/current.txt b/api/current.txt
index c4675ed..39d2eb7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27959,35 +27959,6 @@
     field public static final int UNKNOWN = 2; // 0x2
   }
 
-  public final class CallServiceDescriptor implements android.os.Parcelable {
-    method public int describeContents();
-    method public java.lang.String getConnectionServiceId();
-    method public int getNetworkType();
-    method public android.content.ComponentName getServiceComponent();
-    method public static android.telecomm.CallServiceDescriptor.Builder newBuilder(android.content.Context);
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator CREATOR;
-    field public static final int FLAG_MOBILE = 4; // 0x4
-    field public static final int FLAG_PSTN = 2; // 0x2
-    field public static final int FLAG_WIFI = 1; // 0x1
-  }
-
-  public static class CallServiceDescriptor.Builder {
-    method public android.telecomm.CallServiceDescriptor build();
-    method public android.telecomm.CallServiceDescriptor.Builder setConnectionService(java.lang.Class<? extends android.telecomm.ConnectionService>);
-    method public android.telecomm.CallServiceDescriptor.Builder setNetworkType(int);
-  }
-
-  public final class CallServiceLookupResponse {
-    method public void setCallServiceDescriptors(java.util.List<android.telecomm.CallServiceDescriptor>);
-  }
-
-  public abstract class CallServiceProvider extends android.app.Service {
-    ctor protected CallServiceProvider();
-    method public abstract void lookupCallServices(android.telecomm.CallServiceLookupResponse);
-    method public android.os.IBinder onBind(android.content.Intent);
-  }
-
   public final class CallState extends java.lang.Enum {
     method public static android.telecomm.CallState valueOf(java.lang.String);
     method public static final android.telecomm.CallState[] values();
@@ -28157,7 +28128,6 @@
     method public java.util.List<java.lang.String> getCannedSmsResponses();
     method public int getCapabilities();
     method public long getConnectTimeMillis();
-    method public android.telecomm.CallServiceDescriptor getCurrentCallServiceDescriptor();
     method public int getDisconnectCauseCode();
     method public java.lang.String getDisconnectCauseMsg();
     method public android.telecomm.GatewayInfo getGatewayInfo();
@@ -28307,7 +28277,6 @@
 
   public final class TelecommConstants {
     ctor public TelecommConstants();
-    field public static final java.lang.String ACTION_CALL_SERVICE_PROVIDER;
     field public static final java.lang.String ACTION_CONNECTION_SERVICE;
     field public static final java.lang.String ACTION_CONNECTION_SERVICE_CONFIGURE = "android.intent.action.CONNECTION_SERVICE_CONFIGURE";
     field public static final java.lang.String ACTION_INCOMING_CALL = "android.intent.action.INCOMING_CALL";
@@ -28315,9 +28284,9 @@
     field public static final char DTMF_CHARACTER_WAIT = 59; // 0x003b ';'
     field public static final java.lang.String EXTRA_CALL_DISCONNECT_CAUSE = "android.telecomm.extra.CALL_DISCONNECT_CAUSE";
     field public static final java.lang.String EXTRA_CALL_DISCONNECT_MESSAGE = "android.telecomm.extra.CALL_DISCONNECT_MESSAGE";
-    field public static final java.lang.String EXTRA_CALL_SERVICE_DESCRIPTOR = "android.intent.extra.CALL_SERVICE_DESCRIPTOR";
     field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecomm.extra.CONNECTION_SERVICE";
     field public static final java.lang.String EXTRA_INCOMING_CALL_EXTRAS = "android.intent.extra.INCOMING_CALL_EXTRAS";
+    field public static final java.lang.String EXTRA_PHONE_ACCOUNT = "android.intent.extra.PHONE_ACCOUNT";
     field public static final java.lang.String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.intent.extra.START_CALL_WITH_SPEAKERPHONE";
     field public static final java.lang.String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.intent.extra.START_CALL_WITH_VIDEO_STATE";
   }
diff --git a/telecomm/java/android/telecomm/CallServiceDescriptor.aidl b/telecomm/java/android/telecomm/CallServiceDescriptor.aidl
deleted file mode 100644
index f517c73..0000000
--- a/telecomm/java/android/telecomm/CallServiceDescriptor.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2014, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecomm;
-
-parcelable CallServiceDescriptor;
diff --git a/telecomm/java/android/telecomm/CallServiceDescriptor.java b/telecomm/java/android/telecomm/CallServiceDescriptor.java
deleted file mode 100644
index 5ae07d3..0000000
--- a/telecomm/java/android/telecomm/CallServiceDescriptor.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright 2014, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecomm;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-
-import java.util.Locale;
-import java.util.UUID;
-
-/**
- * An immutable object containing information about a given {@link ConnectionService}. Instances are
- * created using the enclosed {@link Builder}.
- */
-public final class CallServiceDescriptor implements Parcelable {
-    private static final String TAG = CallServiceDescriptor.class.getSimpleName();
-
-    /**
-     * A placeholder value indicating an invalid network type.
-     * @hide
-     */
-    private static final int FLAG_INVALID = 0;
-
-    /**
-     * Indicates that the device must be connected to a Wi-Fi network in order for the backing
-     * {@link ConnectionService} to be used.
-     */
-    public static final int FLAG_WIFI = 0x01;
-
-    /**
-     * Indicates that the device must be connected to a cellular PSTN network in order for the
-     * backing {@link ConnectionService} to be used.
-     */
-    public static final int FLAG_PSTN = 0x02;
-
-    /**
-     * Indicates that the device must be connected to a cellular data network in order for the
-     * backing {@link ConnectionService} to be used.
-     */
-    public static final int FLAG_MOBILE = 0x04;
-
-    /**
-     * Represents all of the defined FLAG_ constants so validity can be easily checked.
-     * @hide
-     */
-    public static final int FLAG_ALL = FLAG_WIFI | FLAG_PSTN | FLAG_MOBILE;
-
-    /**
-     * A unique ID used to identify a given instance.
-     */
-    private final String mConnectionServiceId;
-
-    /**
-     * The {@link ComponentName} of the {@link ConnectionService} implementation which this is
-     * describing.
-     */
-    private final ComponentName mComponentName;
-
-    /**
-     * The type of connection that the {@link ConnectionService} requires; will be one of the FLAG_*
-     * constants defined in this class.
-     */
-    private final int mNetworkType;
-
-    private CallServiceDescriptor(
-            String connectionServiceId,
-            ComponentName componentName,
-            int networkType) {
-
-        mConnectionServiceId = connectionServiceId;
-        mComponentName = componentName;
-        mNetworkType = networkType;
-    }
-
-    /**
-     * @return The ID used to identify this {@link ConnectionService}.
-     */
-    public String getConnectionServiceId() {
-        return mConnectionServiceId;
-    }
-
-    /**
-     * @return The {@link ComponentName} of the {@link ConnectionService}.
-     */
-    public ComponentName getServiceComponent() {
-        return mComponentName;
-    }
-
-    /**
-     * @return The network type required by the {@link ConnectionService} to place a call.
-     */
-    public int getNetworkType() {
-        return mNetworkType;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof CallServiceDescriptor)) {
-            return false;
-        }
-        CallServiceDescriptor descriptor = (CallServiceDescriptor) obj;
-        return mConnectionServiceId.equals(descriptor.mConnectionServiceId) &&
-                mComponentName.equals(descriptor.mComponentName) &&
-                mNetworkType == descriptor.mNetworkType;
-    }
-
-    @Override
-    public String toString() {
-        return String.format(Locale.US, "[%s, component: %s]",
-                CallServiceDescriptor.class.getSimpleName(),
-                mComponentName == null ? "null" : mComponentName.flattenToShortString());
-    }
-
-    /**
-     * @param context {@link Context} to use for the construction of the {@link Builder}.
-     * @return A new {@link Builder} instance.
-     */
-    public static Builder newBuilder(Context context) {
-        return new Builder(context);
-    }
-
-    /**
-     * Creates {@link CallServiceDescriptor} instances. Builders should be created with the
-     * {@link CallServiceDescriptor#newBuilder(Context)} method.
-     */
-    public static class Builder {
-        /** The {@link Context} to use to verify {@link ComponentName} ownership. */
-        private Context mContext;
-
-        /** The {@link ComponentName} pointing to the backing {@link ConnectionService}. */
-        private ComponentName mComponentName;
-
-        /** The required network type that the {@link ConnectionService} needs. */
-        private int mNetworkType = FLAG_INVALID;
-
-        private Builder(Context context) {
-            mContext = context;
-        }
-
-        /**
-         * Set which {@link ConnectionService} this {@link CallServiceDescriptor} is describing.
-         *
-         * @param serviceClass The {@link ConnectionService} class
-         * @return This {@link Builder} for method chaining.
-         */
-        public Builder setConnectionService(Class<? extends ConnectionService> serviceClass) {
-            mComponentName = new ComponentName(mContext, serviceClass);
-            return this;
-        }
-
-        /**
-         * Which network type the backing {@link ConnectionService} requires. This must be one of
-         * the {@link CallServiceDescriptor}.TYPE_* fields.
-         *
-         * @param networkType Which network type the backing {@link ConnectionService} requires.
-         * @return This {@link Builder} for method chaining.
-         */
-        public Builder setNetworkType(int networkType) {
-            mNetworkType = networkType;
-            return this;
-        }
-
-        /**
-         * @return A constructed {@link CallServiceDescriptor} object.
-         */
-        public CallServiceDescriptor build() {
-            // STOPSHIP: Verify validity of ComponentName (permissions, intents, etc)
-
-            // Make sure that they passed in a valid network flag combination
-            if (mNetworkType == FLAG_INVALID || ((mNetworkType & FLAG_ALL) == 0)) {
-
-                Log.wtf(TAG, "Invalid network type for " + mComponentName);
-                // Revert them back to TYPE_INVALID so it won't be considered.
-                mNetworkType = FLAG_INVALID;
-            }
-
-            // TODO: Should we use a sha1 of the ComponentName? Would prevent duplicates.
-            return new CallServiceDescriptor(
-                UUID.randomUUID().toString(), mComponentName, mNetworkType);
-        }
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeString(mConnectionServiceId);
-        dest.writeParcelable(mComponentName, 0);
-        dest.writeInt(mNetworkType);
-    }
-
-    public static final Creator<CallServiceDescriptor> CREATOR =
-            new Creator<CallServiceDescriptor>() {
-        @Override
-        public CallServiceDescriptor createFromParcel(Parcel source) {
-            String id = source.readString();
-            ComponentName componentName = source.readParcelable(
-                    CallServiceDescriptor.class.getClassLoader());
-            int networkType = source.readInt();
-
-            return new CallServiceDescriptor(id, componentName, networkType);
-        }
-
-        @Override
-        public CallServiceDescriptor[] newArray(int size) {
-            return new CallServiceDescriptor[size];
-        }
-    };
-}
diff --git a/telecomm/java/android/telecomm/CallServiceLookupResponse.java b/telecomm/java/android/telecomm/CallServiceLookupResponse.java
deleted file mode 100644
index dd35a24..0000000
--- a/telecomm/java/android/telecomm/CallServiceLookupResponse.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecomm;
-
-import android.os.RemoteException;
-
-import com.android.internal.telecomm.ICallServiceLookupResponse;
-
-import java.util.List;
-
-/**
- * Used by {@link CallServiceProvider} to return a list of {@link CallServiceDescriptor}s.
- */
-public final class CallServiceLookupResponse {
-    private final ICallServiceLookupResponse mResponse;
-
-    /**
-     * {@hide}
-     */
-    public CallServiceLookupResponse(ICallServiceLookupResponse response) {
-        mResponse = response;
-    }
-
-    /**
-     * Passes the sorted list of preferred {@link CallServiceDescriptor}s back to Telecomm.  Used
-     * in the context of attempting to place a pending outgoing call.
-     *
-     * @param callServiceDescriptors The set of call-service descriptors from
-     * {@link CallServiceProvider}.
-     */
-    public void setCallServiceDescriptors(List<CallServiceDescriptor> callServiceDescriptors) {
-        try {
-            mResponse.setCallServiceDescriptors(callServiceDescriptors);
-        } catch (RemoteException e) {
-        }
-    }
-}
diff --git a/telecomm/java/android/telecomm/CallServiceProvider.java b/telecomm/java/android/telecomm/CallServiceProvider.java
deleted file mode 100644
index c50334a..0000000
--- a/telecomm/java/android/telecomm/CallServiceProvider.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecomm;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-
-import com.android.internal.telecomm.ICallServiceLookupResponse;
-import com.android.internal.telecomm.ICallServiceProvider;
-
-/**
- * Base implementation of a call service provider which extends {@link Service}. This class
- * should be extended by an app that wants to supply phone calls to be handled and managed by
- * the device's in-call interface. All method-calls from the framework to the call service provider
- * are passed through to the main thread for before executing the overriden methods of
- * CallServiceProvider.
- *
- * TODO(santoscordon): Improve paragraph above once the final design is in place. Needs more
- * about how this can be used.
- */
-public abstract class CallServiceProvider extends Service {
-
-    /**
-     * Default Handler used to consolidate binder method calls onto a single thread.
-     */
-    private final class CallServiceProviderMessageHandler extends Handler {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case MSG_LOOKUP_CALL_SERVICES:
-                    CallServiceLookupResponse response =
-                            new CallServiceLookupResponse((ICallServiceLookupResponse) msg.obj);
-                    lookupCallServices(response);
-                    break;
-            }
-        }
-    }
-
-    /**
-     * Default ICallServiceProvider implementation provided to CallsManager via {@link #onBind}.
-     */
-    private final class CallServiceProviderWrapper extends ICallServiceProvider.Stub {
-        /** {@inheritDoc} */
-        @Override
-        public void lookupCallServices(ICallServiceLookupResponse callServiceLookupResponse) {
-            Message message = mMessageHandler.obtainMessage(
-                    MSG_LOOKUP_CALL_SERVICES, callServiceLookupResponse);
-            message.sendToTarget();
-        }
-    }
-
-    // Only used internally by this class.
-    // Binder method calls on this service can occur on multiple threads. These messages are used
-    // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a
-    // single thread.  Keeping it on a single thread allows CallService implementations to avoid
-    // needing multi-threaded code in their own callback routines.
-    private static final int MSG_LOOKUP_CALL_SERVICES = 1;
-
-    /**
-     * Message handler for consolidating binder callbacks onto a single thread.
-     * See {@link CallServiceProviderMessageHandler}.
-     */
-    private final CallServiceProviderMessageHandler mMessageHandler;
-
-    /**
-     * Default binder implementation of {@link ICallServiceProvider} interface.
-     */
-    private final CallServiceProviderWrapper mBinder;
-
-    /**
-     * Protected constructor called only by subclasses creates the binder interface and
-     * single-threaded message handler.
-     */
-    protected CallServiceProvider() {
-        mMessageHandler = new CallServiceProviderMessageHandler();
-        mBinder = new CallServiceProviderWrapper();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mBinder;
-    }
-
-    /**
-     * Initiates the process to retrieve the list of {@link CallServiceDescriptor}s implemented by
-     * this provider.
-     *
-     * @param response The response object through which the list of call services is sent.
-     */
-    public abstract void lookupCallServices(CallServiceLookupResponse response);
-}
diff --git a/telecomm/java/android/telecomm/InCallCall.java b/telecomm/java/android/telecomm/InCallCall.java
index 7c35020..355c260 100644
--- a/telecomm/java/android/telecomm/InCallCall.java
+++ b/telecomm/java/android/telecomm/InCallCall.java
@@ -45,7 +45,6 @@
     private final int mCallerDisplayNamePresentation;
     private final GatewayInfo mGatewayInfo;
     private final PhoneAccount mAccount;
-    private final CallServiceDescriptor mCurrentCallServiceDescriptor;
     private final ICallVideoProvider mCallVideoProvider;
     private RemoteCallVideoProvider mRemoteCallVideoProvider;
     private final String mParentCallId;
@@ -67,7 +66,6 @@
             int callerDisplayNamePresentation,
             GatewayInfo gatewayInfo,
             PhoneAccount account,
-            CallServiceDescriptor descriptor,
             ICallVideoProvider callVideoProvider,
             String parentCallId,
             List<String> childCallIds,
@@ -85,7 +83,6 @@
         mCallerDisplayNamePresentation = callerDisplayNamePresentation;
         mGatewayInfo = gatewayInfo;
         mAccount = account;
-        mCurrentCallServiceDescriptor = descriptor;
         mCallVideoProvider = callVideoProvider;
         mParentCallId = parentCallId;
         mChildCallIds = childCallIds;
@@ -165,11 +162,6 @@
         return mAccount;
     }
 
-    /** The descriptor for the call service currently routing this call. */
-    public CallServiceDescriptor getCurrentCallServiceDescriptor() {
-        return mCurrentCallServiceDescriptor;
-    }
-
     /**
      * Returns an object for remotely communicating through the call video provider's binder.
      * @return The call video provider.
@@ -232,7 +224,6 @@
             int callerDisplayNamePresentation = source.readInt();
             GatewayInfo gatewayInfo = source.readParcelable(classLoader);
             PhoneAccount account = source.readParcelable(classLoader);
-            CallServiceDescriptor descriptor = source.readParcelable(classLoader);
             ICallVideoProvider callVideoProvider =
                     ICallVideoProvider.Stub.asInterface(source.readStrongBinder());
             String parentCallId = source.readString();
@@ -242,8 +233,7 @@
             return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg,
                     cannedSmsResponses, capabilities, connectTimeMillis, handle, handlePresentation,
                     callerDisplayName, callerDisplayNamePresentation, gatewayInfo,
-                    account, descriptor, callVideoProvider, parentCallId, childCallIds,
-                    statusHints);
+                    account, callVideoProvider, parentCallId, childCallIds, statusHints);
         }
 
         @Override
@@ -274,7 +264,6 @@
         destination.writeInt(mCallerDisplayNamePresentation);
         destination.writeParcelable(mGatewayInfo, 0);
         destination.writeParcelable(mAccount, 0);
-        destination.writeParcelable(mCurrentCallServiceDescriptor, 0);
         destination.writeStrongBinder(
                 mCallVideoProvider != null ? mCallVideoProvider.asBinder() : null);
         destination.writeString(mParentCallId);
diff --git a/telecomm/java/android/telecomm/TelecommConstants.java b/telecomm/java/android/telecomm/TelecommConstants.java
index b21ea60..a94841f 100644
--- a/telecomm/java/android/telecomm/TelecommConstants.java
+++ b/telecomm/java/android/telecomm/TelecommConstants.java
@@ -16,6 +16,7 @@
 
 package android.telecomm;
 
+import android.content.ComponentName;
 import android.content.Intent;
 import android.os.Bundle;
 import android.telephony.TelephonyManager;
@@ -31,9 +32,9 @@
      * to find and bind to the appropriate {@link android.telecomm.ConnectionService} which
      * Telecomm will ultimately use to control and get information about the call.</p>
      *
-     * <p>Input: get*Extra field {@link #EXTRA_CALL_SERVICE_DESCRIPTOR} contains the component name
-     * of the {@link android.telecomm.ConnectionService} that Telecomm should bind to. Telecomm
-     * will then ask the call service for more information about the call prior to showing any UI.
+     * <p>Input: get*Extra field {@link #EXTRA_PHONE_ACCOUNT} contains the component name of the
+     * {@link android.telecomm.ConnectionService} that Telecomm should bind to. Telecomm will then
+     * ask the connection service for more information about the call prior to showing any UI.
      *
      * TODO(santoscordon): Needs permissions.
      * TODO(santoscordon): Consider moving this into a simple method call on a system service.
@@ -41,11 +42,6 @@
     public static final String ACTION_INCOMING_CALL = "android.intent.action.INCOMING_CALL";
 
     /**
-     * The service action used to bind to {@link CallServiceProvider} implementations.
-     */
-    public static final String ACTION_CALL_SERVICE_PROVIDER = CallServiceProvider.class.getName();
-
-    /**
      * The service action used to bind to {@link ConnectionService} implementations.
      */
     public static final String ACTION_CONNECTION_SERVICE = ConnectionService.class.getName();
@@ -75,11 +71,15 @@
             "android.intent.extra.START_CALL_WITH_VIDEO_STATE";
 
     /**
-     * Extra for {@link #ACTION_INCOMING_CALL} containing the {@link CallServiceDescriptor} that
-     * describes the call service to use for the incoming call.
+     * The extra used with an {@link android.content.Intent#ACTION_CALL},
+     * {@link #ACTION_INCOMING_CALL}, {@link android.content.Intent#ACTION_DIAL} {@code Intent} to
+     * specify a {@link PhoneAccount} to use when making the call.
+     *
+     * <p class="note">
+     * Retrieve with
+     * {@link android.content.Intent#getParcelableExtra(String)}.
      */
-    public static final String EXTRA_CALL_SERVICE_DESCRIPTOR =
-            "android.intent.extra.CALL_SERVICE_DESCRIPTOR";
+    public static final String EXTRA_PHONE_ACCOUNT = "android.intent.extra.PHONE_ACCOUNT";
 
     /**
      * Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains
diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceLookupResponse.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceLookupResponse.aidl
deleted file mode 100644
index 10d73be..0000000
--- a/telecomm/java/com/android/internal/telecomm/ICallServiceLookupResponse.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telecomm;
-
-import android.os.IBinder;
-import android.telecomm.CallServiceDescriptor;
-import java.util.List;
-
-/**
- * Internal remote interface for call service lookup response.
- *
- * @see android.telecomm.CallServiceLookupResponse
- *
- * @hide
- */
-oneway interface ICallServiceLookupResponse {
-    void setCallServiceDescriptors(in List<CallServiceDescriptor> callServiceDescriptors);
-}
diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceProvider.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceProvider.aidl
deleted file mode 100644
index 96daeed..0000000
--- a/telecomm/java/com/android/internal/telecomm/ICallServiceProvider.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telecomm;
-
-import android.telecomm.CallServiceDescriptor;
-
-import com.android.internal.telecomm.ICallServiceLookupResponse;
-
-/**
- * Internal remote interface for call service providers.
- *
- * @see android.telecomm.CallServiceProvider
- *
- * @hide
- */
-oneway interface ICallServiceProvider {
-    void lookupCallServices(in ICallServiceLookupResponse response);
-}
diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl
deleted file mode 100644
index bcf2d81..0000000
--- a/telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import com.android.internal.telephony.IThirdPartyCallProvider;
-
-/**
- * Interface provided to ThirdPartyCallService. The service can use this to notify the listener of
- * changes to the call state.
- */
-oneway interface IThirdPartyCallListener {
-    /**
-     * Called by the service when a call provider is available to perform the outgoing or incoming
-     * call.
-     */
-    void onCallProviderAttached(IThirdPartyCallProvider callProvider);
-
-    /**
-     * Notifies the listener that ringing has started for this call.
-     */
-    void onRingingStarted();
-
-    /**
-     * Notifies the listener that the call has been successfully established.
-     */
-    void onCallEstablished();
-
-    /**
-     * Notifies the listener that the call has ended.
-     */
-    void onCallEnded(int reason);
-}
diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl
deleted file mode 100644
index 9d595b0..0000000
--- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import com.android.internal.telephony.IThirdPartyCallListener;
-import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback;
-
-/**
- * Interface sent to ThirdPartyCallListener.onCallProviderAttached. This is used to control an
- * outgoing or incoming call.
- */
-oneway interface IThirdPartyCallProvider {
-    /**
-     * Mutes or unmutes the call.
-     */
-    void mute(boolean shouldMute);
-
-    /**
-     * Ends the current call. If this is an unanswered incoming call then the call is rejected (for
-     * example, a notification is sent to a server that the user declined the call).
-     */
-    void hangup();
-
-    /**
-     * Accepts the incoming call.
-     */
-    void incomingCallAccept();
-
-    /**
-     * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'.
-     */
-    void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback);
-}
diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl
deleted file mode 100644
index 3a02b06..0000000
--- a/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-/**
- * Callback interface for when DTMF has been sent.
- */
-oneway interface IThirdPartyCallSendDtmfCallback {
-    /**
-     * Called when the DTMF code has been sent.
-     */
-    void onSendDtmfCompleted();
-}
diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl
deleted file mode 100644
index 597567a..0000000
--- a/telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import com.android.internal.telephony.IThirdPartyCallListener;
-
-/**
- * Interface provided by a service to start outgoing calls and attach to incoming calls.
- */
-oneway interface IThirdPartyCallService {
-    /**
-     * Call to start a new outgoing call.
-     */
-    void outgoingCallInitiate(IThirdPartyCallListener listener, String number);
-
-    /**
-     * Call to attach to an incoming call. This is in response to a call to
-     * TelephonyManager.newIncomingThirdPartyCall.
-     */
-    void incomingCallAttach(IThirdPartyCallListener listener, String callId);
-}