Telecom API updates (3/6)

Bug: 18292176

Change-Id: I28e6aa4fec20aadd77f9a861b0bb8e1e9828cffb

Conflicts:
	src/com/android/server/telecom/BluetoothPhoneService.java
	src/com/android/server/telecom/Call.java
	src/com/android/server/telecom/CallAudioManager.java
	src/com/android/server/telecom/CallsManager.java
	src/com/android/server/telecom/InCallController.java
	tests/src/com/android/server/telecom/testapps/TestVideoProvider.java

Conflicts:
	src/com/android/server/telecom/InCallController.java
diff --git a/src/com/android/server/telecom/BluetoothPhoneService.java b/src/com/android/server/telecom/BluetoothPhoneService.java
index cb95396..5c2e891 100644
--- a/src/com/android/server/telecom/BluetoothPhoneService.java
+++ b/src/com/android/server/telecom/BluetoothPhoneService.java
@@ -31,9 +31,9 @@
 import android.os.Message;
 import android.os.RemoteException;
 import android.telecom.CallState;
+import android.telecom.Connection;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
-import android.telecom.PhoneCapabilities;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -526,7 +526,7 @@
                 return true;
             }
         } else if (chld == CHLD_TYPE_HOLDACTIVE_ACCEPTHELD) {
-            if (activeCall != null && activeCall.can(PhoneCapabilities.SWAP_CONFERENCE)) {
+            if (activeCall != null && activeCall.can(Connection.CAPABILITY_SWAP_CONFERENCE)) {
                 activeCall.swapConference();
                 Log.i(TAG, "CDMA calls in conference swapped, updating headset");
                 updateHeadsetWithCallState(true /* force */);
@@ -539,13 +539,13 @@
                 // currently-held call.
                 callsManager.unholdCall(heldCall);
                 return true;
-            } else if (activeCall != null && activeCall.can(PhoneCapabilities.HOLD)) {
+            } else if (activeCall != null && activeCall.can(Connection.CAPABILITY_HOLD)) {
                 callsManager.holdCall(activeCall);
                 return true;
             }
         } else if (chld == CHLD_TYPE_ADDHELDTOCONF) {
             if (activeCall != null) {
-                if (activeCall.can(PhoneCapabilities.MERGE_CONFERENCE)) {
+                if (activeCall.can(Connection.CAPABILITY_MERGE_CONFERENCE)) {
                     activeCall.mergeConference();
                     return true;
                 } else {
@@ -617,8 +617,8 @@
 
             // Run some alternative states for Conference-level merge/swap support.
             // Basically, if call supports swapping or merging at the conference-level, then we need
-            // to expose the calls as having distinct states (ACTIVE vs HOLD) or the functionality
-            // won't show up on the bluetooth device.
+            // to expose the calls as having distinct states (ACTIVE vs CAPABILITY_HOLD) or the
+            // functionality won't show up on the bluetooth device.
 
             // Before doing any special logic, ensure that we are dealing with an ACTIVE call and
             // that the conference itself has a notion of the current "active" child call.
@@ -627,8 +627,8 @@
                 // Reevaluate state if we can MERGE or if we can SWAP without previously having
                 // MERGED.
                 boolean shouldReevaluateState =
-                        conferenceCall.can(PhoneCapabilities.MERGE_CONFERENCE) ||
-                        (conferenceCall.can(PhoneCapabilities.SWAP_CONFERENCE) &&
+                        conferenceCall.can(Connection.CAPABILITY_MERGE_CONFERENCE) ||
+                        (conferenceCall.can(Connection.CAPABILITY_SWAP_CONFERENCE) &&
                          !conferenceCall.wasConferencePreviouslyMerged());
 
                 if (shouldReevaluateState) {
@@ -728,11 +728,11 @@
         // to show "swap" and "merge" functionality.
         boolean ignoreHeldCallChange = false;
         if (activeCall != null && activeCall.isConference()) {
-            if (activeCall.can(PhoneCapabilities.SWAP_CONFERENCE)) {
+            if (activeCall.can(Connection.CAPABILITY_SWAP_CONFERENCE)) {
                 // Indicate that BT device should show SWAP command by indicating that there is a
                 // call on hold, but only if the conference wasn't previously merged.
                 numHeldCalls = activeCall.wasConferencePreviouslyMerged() ? 0 : 1;
-            } else if (activeCall.can(PhoneCapabilities.MERGE_CONFERENCE)) {
+            } else if (activeCall.can(Connection.CAPABILITY_MERGE_CONFERENCE)) {
                 numHeldCalls = 1;  // Merge is available, so expose via numHeldCalls.
             }
 
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 24c7048..c1bf6c7 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -30,7 +30,6 @@
 import android.telecom.ParcelableConnection;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
-import android.telecom.PhoneCapabilities;
 import android.telecom.Response;
 import android.telecom.StatusHints;
 import android.telecom.TelecomManager;
@@ -74,7 +73,7 @@
         void onFailedUnknownCall(Call call);
         void onRingbackRequested(Call call, boolean ringbackRequested);
         void onPostDialWait(Call call, String remaining);
-        void onCallCapabilitiesChanged(Call call);
+        void onConnectionCapabilitiesChanged(Call call);
         void onParentChanged(Call call);
         void onChildrenChanged(Call call);
         void onCannedSmsResponsesLoaded(Call call);
@@ -110,7 +109,7 @@
         @Override
         public void onPostDialWait(Call call, String remaining) {}
         @Override
-        public void onCallCapabilitiesChanged(Call call) {}
+        public void onConnectionCapabilitiesChanged(Call call) {}
         @Override
         public void onParentChanged(Call call) {}
         @Override
@@ -276,7 +275,7 @@
     /** Whether direct-to-voicemail query is pending. */
     private boolean mDirectToVoicemailQueryPending;
 
-    private int mCallCapabilities;
+    private int mConnectionCapabilities;
 
     private boolean mIsConference = false;
 
@@ -373,7 +372,7 @@
                 getVideoState(),
                 getChildCalls().size(),
                 getParentCall() != null,
-                PhoneCapabilities.toString(getCallCapabilities()),
+                Connection.capabilitiesToString(getConnectionCapabilities()),
                 mIsActiveSub,
                 mTargetPhoneAccountHandle,
                 getCallSubstate());
@@ -611,20 +610,21 @@
         mConnectTimeMillis = connectTimeMillis;
     }
 
-    int getCallCapabilities() {
-        return mCallCapabilities;
+    int getConnectionCapabilities() {
+        return mConnectionCapabilities;
     }
 
-    void setCallCapabilities(int callCapabilities) {
-        setCallCapabilities(callCapabilities, false /* forceUpdate */);
+    void setConnectionCapabilities(int connectionCapabilities) {
+        setConnectionCapabilities(connectionCapabilities, false /* forceUpdate */);
     }
 
-    void setCallCapabilities(int callCapabilities, boolean forceUpdate) {
-        Log.v(this, "setCallCapabilities: %s", PhoneCapabilities.toString(callCapabilities));
-        if (forceUpdate || mCallCapabilities != callCapabilities) {
-           mCallCapabilities = callCapabilities;
+    void setConnectionCapabilities(int connectionCapabilities, boolean forceUpdate) {
+        Log.v(this, "setConnectionCapabilities: %s", Connection.capabilitiesToString(
+                connectionCapabilities));
+        if (forceUpdate || mConnectionCapabilities != connectionCapabilities) {
+           mConnectionCapabilities = connectionCapabilities;
             for (Listener l : mListeners) {
-                l.onCallCapabilitiesChanged(this);
+                l.onConnectionCapabilitiesChanged(this);
             }
         }
     }
@@ -732,7 +732,7 @@
         setHandle(connection.getHandle(), connection.getHandlePresentation());
         setCallerDisplayName(
                 connection.getCallerDisplayName(), connection.getCallerDisplayNamePresentation());
-        setCallCapabilities(connection.getCapabilities());
+        setConnectionCapabilities(connection.getConnectionCapabilities());
         setVideoProvider(connection.getVideoProvider());
         setVideoState(connection.getVideoState());
         setRingbackRequested(connection.isRingbackRequested());
@@ -1015,7 +1015,7 @@
     void mergeConference() {
         if (mConnectionService == null) {
             Log.w(this, "merging conference calls without a connection service.");
-        } else if (can(PhoneCapabilities.MERGE_CONFERENCE)) {
+        } else if (can(Connection.CAPABILITY_MERGE_CONFERENCE)) {
             mConnectionService.mergeConference(this);
             mWasConferencePreviouslyMerged = true;
         }
@@ -1024,7 +1024,7 @@
     void swapConference() {
         if (mConnectionService == null) {
             Log.w(this, "swapping conference calls without a connection service.");
-        } else if (can(PhoneCapabilities.SWAP_CONFERENCE)) {
+        } else if (can(Connection.CAPABILITY_SWAP_CONFERENCE)) {
             mConnectionService.swapConference(this);
             switch (mChildCalls.size()) {
                 case 1:
@@ -1082,7 +1082,7 @@
     }
 
     boolean can(int capability) {
-        return (mCallCapabilities & capability) == capability;
+        return (mConnectionCapabilities & capability) == capability;
     }
 
     private void addChildCall(Call call) {
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index 19e6149..3a61d97 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -71,7 +71,8 @@
         if (hasFocus() && getForegroundCall() == call) {
             if (!call.isIncoming()) {
                 // Unmute new outgoing call.
-                setSystemAudioState(false, mAudioState.route, mAudioState.supportedRouteMask);
+                setSystemAudioState(false, mAudioState.getRoute(),
+                        mAudioState.getSupportedRouteMask());
             }
         }
     }
@@ -96,12 +97,12 @@
 
     @Override
     public void onIncomingCallAnswered(Call call) {
-        int route = mAudioState.route;
+        int route = mAudioState.getRoute();
 
         // BT stack will connect audio upon receiving active call state.
         // We unmute the audio for the new incoming call.
 
-        setSystemAudioState(false /* isMute */, route, mAudioState.supportedRouteMask);
+        setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask());
 
         if (mContext == null) {
             Log.d(this, "Speedup Audio Path enhancement: Context is null");
@@ -159,11 +160,11 @@
         } else {
             newRoute = AudioState.ROUTE_BLUETOOTH;
         }
-        setSystemAudioState(mAudioState.isMuted, newRoute, calculateSupportedRoutes());
+        setSystemAudioState(mAudioState.isMuted(), newRoute, calculateSupportedRoutes());
     }
 
     void toggleMute() {
-        mute(!mAudioState.isMuted);
+        mute(!mAudioState.isMuted());
     }
 
     void mute(boolean shouldMute) {
@@ -179,8 +180,9 @@
             Log.v(this, "ignoring mute for emergency call");
         }
 
-        if (mAudioState.isMuted != shouldMute) {
-            setSystemAudioState(shouldMute, mAudioState.route, mAudioState.supportedRouteMask);
+        if (mAudioState.isMuted() != shouldMute) {
+            setSystemAudioState(shouldMute, mAudioState.getRoute(),
+                    mAudioState.getSupportedRouteMask());
         }
     }
 
@@ -198,19 +200,20 @@
         Log.v(this, "setAudioRoute, route: %s", AudioState.audioRouteToString(route));
 
         // Change ROUTE_WIRED_OR_EARPIECE to a single entry.
-        int newRoute = selectWiredOrEarpiece(route, mAudioState.supportedRouteMask);
+        int newRoute = selectWiredOrEarpiece(route, mAudioState.getSupportedRouteMask());
 
         // If route is unsupported, do nothing.
-        if ((mAudioState.supportedRouteMask | newRoute) == 0) {
+        if ((mAudioState.getSupportedRouteMask() | newRoute) == 0) {
             Log.wtf(this, "Asking to set to a route that is unsupported: %d", newRoute);
             return;
         }
 
-        if (mAudioState.route != newRoute) {
+        if (mAudioState.getRoute() != newRoute) {
             // Remember the new speaker state so it can be restored when the user plugs and unplugs
             // a headset.
             mWasSpeakerOn = newRoute == AudioState.ROUTE_SPEAKER;
-            setSystemAudioState(mAudioState.isMuted, newRoute, mAudioState.supportedRouteMask);
+            setSystemAudioState(mAudioState.isMuted(), newRoute,
+                    mAudioState.getSupportedRouteMask());
         }
     }
 
@@ -249,16 +252,16 @@
         }
 
         int supportedRoutes = calculateSupportedRoutes();
-        int newRoute = mAudioState.route;
+        int newRoute = mAudioState.getRoute();
         if (bluetoothManager.isBluetoothAudioConnectedOrPending()) {
             newRoute = AudioState.ROUTE_BLUETOOTH;
-        } else if (mAudioState.route == AudioState.ROUTE_BLUETOOTH) {
+        } else if (mAudioState.getRoute() == AudioState.ROUTE_BLUETOOTH) {
             newRoute = selectWiredOrEarpiece(AudioState.ROUTE_WIRED_OR_EARPIECE, supportedRoutes);
             // Do not switch to speaker when bluetooth disconnects.
             mWasSpeakerOn = false;
         }
 
-        setSystemAudioState(mAudioState.isMuted, newRoute, supportedRoutes);
+        setSystemAudioState(mAudioState.isMuted(), newRoute, supportedRoutes);
     }
 
     boolean isBluetoothAudioOn() {
@@ -271,8 +274,8 @@
 
     private void saveAudioState(AudioState audioState) {
         mAudioState = audioState;
-        mStatusBarNotifier.notifyMute(mAudioState.isMuted);
-        mStatusBarNotifier.notifySpeakerphone(mAudioState.route == AudioState.ROUTE_SPEAKER);
+        mStatusBarNotifier.notifyMute(mAudioState.isMuted());
+        mStatusBarNotifier.notifySpeakerphone(mAudioState.getRoute() == AudioState.ROUTE_SPEAKER);
     }
 
     private void onCallUpdated(Call call) {
@@ -308,20 +311,20 @@
         Log.i(this, "changing audio state from %s to %s", oldAudioState, mAudioState);
 
         // Mute.
-        if (mAudioState.isMuted != mAudioManager.isMicrophoneMute()) {
-            Log.i(this, "changing microphone mute state to: %b", mAudioState.isMuted);
-            mAudioManager.setMicrophoneMute(mAudioState.isMuted);
+        if (mAudioState.isMuted() != mAudioManager.isMicrophoneMute()) {
+            Log.i(this, "changing microphone mute state to: %b", mAudioState.isMuted());
+            mAudioManager.setMicrophoneMute(mAudioState.isMuted());
         }
 
         // Audio route.
-        if (mAudioState.route == AudioState.ROUTE_BLUETOOTH) {
+        if (mAudioState.getRoute() == AudioState.ROUTE_BLUETOOTH) {
             turnOnSpeaker(false);
             turnOnBluetooth(true);
-        } else if (mAudioState.route == AudioState.ROUTE_SPEAKER) {
+        } else if (mAudioState.getRoute() == AudioState.ROUTE_SPEAKER) {
             turnOnBluetooth(false);
             turnOnSpeaker(true);
-        } else if (mAudioState.route == AudioState.ROUTE_EARPIECE ||
-                mAudioState.route == AudioState.ROUTE_WIRED_HEADSET) {
+        } else if (mAudioState.getRoute() == AudioState.ROUTE_EARPIECE ||
+                mAudioState.getRoute() == AudioState.ROUTE_WIRED_HEADSET) {
             turnOnBluetooth(false);
             turnOnSpeaker(false);
         }
@@ -494,7 +497,8 @@
         AudioState audioState = getInitialAudioState(call);
         Log.v(this, "setInitialAudioState %s, %s", audioState, call);
         setSystemAudioState(
-                force, audioState.isMuted, audioState.route, audioState.supportedRouteMask);
+                force, audioState.isMuted(), audioState.getRoute(),
+                audioState.getSupportedRouteMask());
     }
 
     private void updateAudioForForegroundCall() {
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index fe793a3..6b80bf4 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -18,8 +18,6 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -29,13 +27,13 @@
 import android.provider.CallLog.Calls;
 import android.telecom.AudioState;
 import android.telecom.CallState;
+import android.telecom.Connection;
 import android.telecom.DisconnectCause;
 import android.telecom.GatewayInfo;
 import android.telecom.ParcelableConference;
 import android.telecom.ParcelableConnection;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
-import android.telecom.PhoneCapabilities;
 import android.telecom.TelecomManager;
 import android.telephony.TelephonyManager;
 
@@ -652,7 +650,7 @@
             if (activeCall != null && activeCall != call &&
                     (activeCall.isActive() ||
                      activeCall.getState() == CallState.DIALING)) {
-                if (0 == (activeCall.getCallCapabilities() & PhoneCapabilities.HOLD)) {
+                if (0 == (activeCall.getConnectionCapabilities() & Connection.CAPABILITY_HOLD)) {
                     // This call does not support hold.  If it is from a different connection
                     // service, then disconnect it, otherwise allow the connection service to
                     // figure out the right states.
@@ -1251,7 +1249,7 @@
         if (call.getState() == CallState.ACTIVE) {
             call.setConnectTimeMillis(System.currentTimeMillis());
         }
-        call.setCallCapabilities(parcelableConference.getCapabilities());
+        call.setConnectionCapabilities(parcelableConference.getConnectionCapabilities());
         call.setVideoState(parcelableConference.getVideoState());
         call.setVideoProvider(parcelableConference.getVideoProvider());
 
@@ -1618,7 +1616,7 @@
             }
 
             // Try to hold the live call before attempting the new outgoing call.
-            if (liveCall.can(PhoneCapabilities.HOLD)) {
+            if (liveCall.can(Connection.CAPABILITY_HOLD)) {
                 liveCall.hold();
                 return true;
             }
@@ -1656,7 +1654,7 @@
                 return true;
             }
             // Try to hold the live call before attempting the new outgoing call.
-            if (liveCall.can(PhoneCapabilities.HOLD)) {
+            if (liveCall.can(Connection.CAPABILITY_HOLD)) {
                 liveCall.hold();
                 return true;
             }
@@ -1699,7 +1697,7 @@
         } else {
             call.setConnectTimeMillis(System.currentTimeMillis());
         }
-        call.setCallCapabilities(connection.getCapabilities());
+        call.setConnectionCapabilities(connection.getConnectionCapabilities());
         call.setCallerDisplayName(connection.getCallerDisplayName(),
                 connection.getCallerDisplayNamePresentation());
 
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index a1f7b37..8e29d63 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -67,7 +67,7 @@
     private static final int MSG_SET_DISCONNECTED = 5;
     private static final int MSG_SET_ON_HOLD = 6;
     private static final int MSG_SET_RINGBACK_REQUESTED = 7;
-    private static final int MSG_SET_CALL_CAPABILITIES = 8;
+    private static final int MSG_SET_CONNECTION_CAPABILITIES = 8;
     private static final int MSG_SET_IS_CONFERENCED = 9;
     private static final int MSG_ADD_CONFERENCE_CALL = 10;
     private static final int MSG_REMOVE_CALL = 11;
@@ -196,13 +196,13 @@
                     }
                     break;
                 }
-                case MSG_SET_CALL_CAPABILITIES: {
+                case MSG_SET_CONNECTION_CAPABILITIES: {
                     call = mCallIdMapper.getCall(msg.obj);
                     if (call != null) {
-                        call.setCallCapabilities(msg.arg1);
+                        call.setConnectionCapabilities(msg.arg1);
                     } else {
                         //Log.w(ConnectionServiceWrapper.this,
-                        //      "setCallCapabilities, unknown call id: %s", msg.obj);
+                        //      "setConnectionCapabilities, unknown call id: %s", msg.obj);
                     }
                     break;
                 }
@@ -540,10 +540,10 @@
         }
 
         @Override
-        public void setCallCapabilities(String callId, int callCapabilities) {
-            logIncoming("setCallCapabilities %s %d", callId, callCapabilities);
+        public void setConnectionCapabilities(String callId, int connectionCapabilities) {
+            logIncoming("setConnectionCapabilities %s %d", callId, connectionCapabilities);
             if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) {
-                mHandler.obtainMessage(MSG_SET_CALL_CAPABILITIES, callCapabilities, 0, callId)
+                mHandler.obtainMessage(MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, callId)
                         .sendToTarget();
             } else {
                 Log.w(this, "ID not valid for setCallCapabilities");
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 08e359f..9daa75c 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -32,9 +32,9 @@
 import android.telecom.AudioState;
 import android.telecom.CallProperties;
 import android.telecom.CallState;
+import android.telecom.Connection;
 import android.telecom.InCallService;
 import android.telecom.ParcelableCall;
-import android.telecom.PhoneCapabilities;
 import android.telecom.TelecomManager;
 import android.util.ArrayMap;
 
@@ -74,7 +74,7 @@
 
     private final Call.Listener mCallListener = new Call.ListenerBase() {
         @Override
-        public void onCallCapabilitiesChanged(Call call) {
+        public void onConnectionCapabilitiesChanged(Call call) {
             updateCall(call);
         }
 
@@ -453,18 +453,23 @@
     private ParcelableCall toParcelableCall(Call call, boolean includeVideoProvider) {
         String callId = mCallIdMapper.getCallId(call);
 
-        int capabilities = call.getCallCapabilities();
+        int capabilities = convertConnectionToCallCapabilities(call.getConnectionCapabilities());
 
         boolean isDefaultSmsAccount =
                 CallsManager.getInstance().getPhoneAccountRegistrar().isUserSelectedSmsPhoneAccount(
                         call.getTargetPhoneAccount());
         if (call.isRespondViaSmsCapable() && isDefaultSmsAccount) {
-            capabilities |= PhoneCapabilities.RESPOND_VIA_TEXT;
+            capabilities |= android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT;
+        }
+
+        if (call.isRespondViaSmsCapable()) {
+            capabilities |= android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT;
         }
 
         // Disable mute and add call for emergency calls.
         if (call.isEmergencyCall()) {
-            capabilities &= ~PhoneCapabilities.MUTE;
+            capabilities = removeCapability(
+                    capabilities, android.telecom.Call.Details.CAPABILITY_MUTE);
         }
 
         int properties = call.isConference() ? CallProperties.CONFERENCE : 0;
@@ -498,7 +503,7 @@
         }
 
         if (call.isRespondViaSmsCapable()) {
-            capabilities |= PhoneCapabilities.RESPOND_VIA_TEXT;
+            capabilities |= android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT;
         }
 
         Uri handle = call.getHandlePresentation() == TelecomManager.PRESENTATION_ALLOWED ?
@@ -542,6 +547,60 @@
                 call.getCallSubstate());
     }
 
+    private static final int[] CONNECTION_TO_CALL_CAPABILITY = new int[] {
+        Connection.CAPABILITY_HOLD,
+        android.telecom.Call.Details.CAPABILITY_HOLD,
+
+        Connection.CAPABILITY_SUPPORT_HOLD,
+        android.telecom.Call.Details.CAPABILITY_SUPPORT_HOLD,
+
+        Connection.CAPABILITY_MERGE_CONFERENCE,
+        android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE,
+
+        Connection.CAPABILITY_SWAP_CONFERENCE,
+        android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE,
+
+        Connection.CAPABILITY_UNUSED,
+        android.telecom.Call.Details.CAPABILITY_UNUSED,
+
+        Connection.CAPABILITY_RESPOND_VIA_TEXT,
+        android.telecom.Call.Details.CAPABILITY_RESPOND_VIA_TEXT,
+
+        Connection.CAPABILITY_MUTE,
+        android.telecom.Call.Details.CAPABILITY_MUTE,
+
+        Connection.CAPABILITY_MANAGE_CONFERENCE,
+        android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE,
+
+        Connection.CAPABILITY_SUPPORTS_VT_LOCAL,
+        android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL,
+
+        Connection.CAPABILITY_SUPPORTS_VT_REMOTE,
+        android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE,
+
+        Connection.CAPABILITY_VoLTE,
+        android.telecom.Call.Details.CAPABILITY_VoLTE,
+
+        Connection.CAPABILITY_VoWIFI,
+        android.telecom.Call.Details.CAPABILITY_VoWIFI,
+
+        Connection.CAPABILITY_SEPARATE_FROM_CONFERENCE,
+        android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE,
+
+        Connection.CAPABILITY_DISCONNECT_FROM_CONFERENCE,
+        android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE,
+    };
+
+    private static int convertConnectionToCallCapabilities(int connectionCapabilities) {
+        int callCapabilities = 0;
+        for (int i = 0; i < CONNECTION_TO_CALL_CAPABILITY.length; i += 2) {
+            if ((CONNECTION_TO_CALL_CAPABILITY[i] & connectionCapabilities) != 0) {
+                callCapabilities &= CONNECTION_TO_CALL_CAPABILITY[i + 1];
+            }
+        }
+        return callCapabilities;
+    }
+
     /**
      * Adds the call to the list of calls tracked by the {@link InCallController}.
      * @param call The call to add.
@@ -556,4 +615,11 @@
     boolean isServiceConnected() {
         return !mInCallServices.isEmpty();
     }
+
+    /**
+     * Removes the specified capability from the set of capabilities bits and returns the new set.
+     */
+    private static int removeCapability(int capabilities, int capability) {
+        return capabilities & ~capability;
+    }
 }
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index f596c66..2168551 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -965,8 +965,8 @@
                 int iconResId = PhoneAccount.NO_RESOURCE_ID;
                 String iconPackageName = null;
                 Bitmap iconBitmap = null;
-                int iconTint = PhoneAccount.NO_COLOR;
-                int highlightColor = PhoneAccount.NO_COLOR;
+                int iconTint = PhoneAccount.NO_ICON_TINT;
+                int highlightColor = PhoneAccount.NO_HIGHLIGHT_COLOR;
                 String label = null;
                 String shortDescription = null;
                 List<String> supportedUriSchemes = null;
diff --git a/tests/src/com/android/server/telecom/testapps/TestConnectionManager.java b/tests/src/com/android/server/telecom/testapps/TestConnectionManager.java
index 0040c57..b99ee13 100644
--- a/tests/src/com/android/server/telecom/testapps/TestConnectionManager.java
+++ b/tests/src/com/android/server/telecom/testapps/TestConnectionManager.java
@@ -60,9 +60,9 @@
             }
 
             @Override
-            public void onCallCapabilitiesChanged(RemoteConnection connection,
-                    int callCapabilities) {
-                setCallCapabilities(callCapabilities);
+            public void onConnectionCapabilitiesChanged(RemoteConnection connection,
+                    int connectionCapabilities) {
+                setConnectionCapabilities(connectionCapabilities);
             }
 
             @Override
@@ -251,8 +251,9 @@
             }
 
             @Override
-            public void onCapabilitiesChanged(RemoteConference conference, int capabilities) {
-                setCapabilities(capabilities);
+            public void onConnectionCapabilitiesChanged(RemoteConference conference,
+                    int connectionCapabilities) {
+                setConnectionCapabilities(connectionCapabilities);
             }
 
             @Override
diff --git a/tests/src/com/android/server/telecom/testapps/TestConnectionService.java b/tests/src/com/android/server/telecom/testapps/TestConnectionService.java
index 8a97106..2e01276 100644
--- a/tests/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/tests/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -27,12 +27,9 @@
 import android.telecom.Connection;
 import android.telecom.DisconnectCause;
 import android.telecom.PhoneAccount;
-import android.telecom.PhoneCapabilities;
 import android.telecom.ConnectionRequest;
 import android.telecom.ConnectionService;
 import android.telecom.PhoneAccountHandle;
-import android.telecom.RemoteConnection;
-import android.telecom.StatusHints;
 import android.telecom.TelecomManager;
 import android.telecom.VideoProfile;
 import android.util.Log;
@@ -77,11 +74,11 @@
 
         public TestConference(Connection a, Connection b) {
             super(null);
-            setCapabilities(
-                    PhoneCapabilities.SUPPORT_HOLD |
-                    PhoneCapabilities.HOLD |
-                    PhoneCapabilities.MUTE |
-                    PhoneCapabilities.MANAGE_CONFERENCE);
+            setConnectionCapabilities(
+                    Connection.CAPABILITY_SUPPORT_HOLD |
+                    Connection.CAPABILITY_HOLD |
+                    Connection.CAPABILITY_MUTE |
+                    Connection.CAPABILITY_MANAGE_CONFERENCE);
             addConnection(a);
             addConnection(b);
 
@@ -137,12 +134,12 @@
         TestConnection(boolean isIncoming) {
             mIsIncoming = isIncoming;
             // Assume all calls are video capable.
-            int capabilities = getCallCapabilities();
-            capabilities |= PhoneCapabilities.SUPPORTS_VT_LOCAL;
-            capabilities |= PhoneCapabilities.MUTE;
-            capabilities |= PhoneCapabilities.SUPPORT_HOLD;
-            capabilities |= PhoneCapabilities.HOLD;
-            setCallCapabilities(capabilities);
+            int capabilities = getConnectionCapabilities();
+            capabilities |= CAPABILITY_SUPPORTS_VT_LOCAL;
+            capabilities |= CAPABILITY_MUTE;
+            capabilities |= CAPABILITY_SUPPORT_HOLD;
+            capabilities |= CAPABILITY_HOLD;
+            setConnectionCapabilities(capabilities);
         }
 
         void startOutgoing() {
diff --git a/tests/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java b/tests/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java
index e79fb78..68206e4 100644
--- a/tests/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java
+++ b/tests/src/com/android/server/telecom/testapps/TestManagedVideoProvider.java
@@ -111,7 +111,7 @@
     }
 
     @Override
-    public void onRequestCallDataUsage() {
+    public void onRequestConnectionDataUsage() {
         mRemoteVideoProvider.requestCallDataUsage();
     }
 
diff --git a/tests/src/com/android/server/telecom/testapps/TestVideoProvider.java b/tests/src/com/android/server/telecom/testapps/TestVideoProvider.java
index b9420ea..2440665 100644
--- a/tests/src/com/android/server/telecom/testapps/TestVideoProvider.java
+++ b/tests/src/com/android/server/telecom/testapps/TestVideoProvider.java
@@ -169,8 +169,8 @@
      * Randomly reports data usage of value ranging from 10MB to 60MB.
      */
     @Override
-    public void onRequestCallDataUsage() {
-        log("Requested call data usage");
+    public void onRequestConnectionDataUsage() {
+        log("Requested connection data usage")
         long dataUsageKb = (10 *1024) + random.nextInt(50 * 1024);
         changeCallDataUsage(dataUsageKb);
     }