Telecom API updates (4/6)
Bug: 18292176
Change-Id: I28e6aa4fec20aadd77f9a861b0bb8e1e9828cffb
diff --git a/src/com/android/server/telecom/BluetoothPhoneService.java b/src/com/android/server/telecom/BluetoothPhoneService.java
index e9a00ff..bf28699 100644
--- a/src/com/android/server/telecom/BluetoothPhoneService.java
+++ b/src/com/android/server/telecom/BluetoothPhoneService.java
@@ -31,8 +31,8 @@
import android.os.Message;
import android.os.RemoteException;
import android.telecom.CallState;
+import android.telecom.Connection;
import android.telecom.PhoneAccount;
-import android.telecom.PhoneCapabilities;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -498,7 +498,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();
return true;
} else if (ringingCall != null) {
@@ -509,13 +509,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 {
@@ -587,8 +587,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.
@@ -597,8 +597,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) {
@@ -698,11 +698,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 47b4aa6f..19b7fdb 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -31,7 +31,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
@@ -277,7 +276,7 @@
/** Whether direct-to-voicemail query is pending. */
private boolean mDirectToVoicemailQueryPending;
- private int mCallCapabilities;
+ private int mConnectionCapabilities;
private boolean mIsConference = false;
@@ -370,7 +369,7 @@
getVideoState(),
getChildCalls().size(),
getParentCall() != null,
- PhoneCapabilities.toString(getCallCapabilities()));
+ Connection.capabilitiesToString(getConnectionCapabilities()));
}
int getState() {
@@ -607,20 +606,21 @@
return mConnectTimeMillis;
}
- 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);
}
}
}
@@ -727,7 +727,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());
@@ -993,7 +993,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;
}
@@ -1002,7 +1002,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:
@@ -1060,7 +1060,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 af4a3fa..b7d1b19 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -68,7 +68,8 @@
if (hasFocus() && getForegroundCall() == call) {
if (!call.isIncoming()) {
// Unmute new outgoing call.
- setSystemAudioState(false, mAudioState.route, mAudioState.supportedRouteMask);
+ setSystemAudioState(false, mAudioState.getRoute(),
+ mAudioState.getSupportedRouteMask());
}
}
}
@@ -93,7 +94,7 @@
@Override
public void onIncomingCallAnswered(Call call) {
- int route = mAudioState.route;
+ int route = mAudioState.getRoute();
// We do two things:
// (1) If this is the first call, then we can to turn on bluetooth if available.
@@ -104,7 +105,7 @@
route = AudioState.ROUTE_BLUETOOTH;
}
- setSystemAudioState(false /* isMute */, route, mAudioState.supportedRouteMask);
+ setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask());
}
@Override
@@ -140,11 +141,11 @@
newRoute = AudioState.ROUTE_SPEAKER;
}
}
- setSystemAudioState(mAudioState.isMuted, newRoute, calculateSupportedRoutes());
+ setSystemAudioState(mAudioState.isMuted(), newRoute, calculateSupportedRoutes());
}
void toggleMute() {
- mute(!mAudioState.isMuted);
+ mute(!mAudioState.isMuted());
}
void mute(boolean shouldMute) {
@@ -160,8 +161,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());
}
}
@@ -179,19 +181,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());
}
}
@@ -230,16 +233,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() {
@@ -252,8 +255,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) {
@@ -284,20 +287,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);
}
@@ -467,7 +470,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 7bbe031..1697d38 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -17,9 +17,6 @@
package com.android.server.telecom;
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;
@@ -27,13 +24,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.telecom.VideoProfile;
import android.telephony.TelephonyManager;
@@ -592,7 +589,8 @@
if (mForegroundCall != null && mForegroundCall != call &&
(mForegroundCall.isActive() ||
mForegroundCall.getState() == CallState.DIALING)) {
- if (0 == (mForegroundCall.getCallCapabilities() & PhoneCapabilities.HOLD)) {
+ if (0 == (mForegroundCall.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.
@@ -994,7 +992,7 @@
true /* isConference */);
setCallState(call, Call.getStateFromConnectionState(parcelableConference.getState()));
- call.setCallCapabilities(parcelableConference.getCapabilities());
+ call.setConnectionCapabilities(parcelableConference.getConnectionCapabilities());
// TODO: Move this to be a part of addCall()
call.addListener(this);
@@ -1307,7 +1305,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;
}
@@ -1337,7 +1335,7 @@
false /* isConference */);
setCallState(call, Call.getStateFromConnectionState(connection.getState()));
- 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 b57d86f..6d044f5 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;
@@ -156,13 +156,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;
}
@@ -445,10 +445,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 d3cc232..7bf2076 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -33,9 +33,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;
@@ -78,7 +78,7 @@
private final Call.Listener mCallListener = new Call.ListenerBase() {
@Override
- public void onCallCapabilitiesChanged(Call call) {
+ public void onConnectionCapabilitiesChanged(Call call) {
updateCall(call);
}
@@ -450,24 +450,29 @@
String callId = mCallIdMapper.getCallId(call);
int state = call.getState();
- 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;
}
if (call.isEmergencyCall()) {
- capabilities = PhoneCapabilities.remove(capabilities, PhoneCapabilities.MUTE);
+ capabilities = removeCapability(
+ capabilities, android.telecom.Call.Details.CAPABILITY_MUTE);
}
if (state == CallState.DIALING) {
- capabilities =
- PhoneCapabilities.remove(capabilities, PhoneCapabilities.SUPPORTS_VT_LOCAL);
- capabilities =
- PhoneCapabilities.remove(capabilities, PhoneCapabilities.SUPPORTS_VT_REMOTE);
+ capabilities = removeCapability(
+ capabilities, android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL);
+ capabilities = removeCapability(
+ capabilities, android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE);
}
if (state == CallState.ABORTED) {
@@ -535,6 +540,60 @@
call.getExtras());
}
+ 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.
@@ -547,6 +606,13 @@
}
/**
+ * 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;
+ }
+
+ /**
* Dumps the state of the {@link InCallController}.
*
* @param pw The {@code IndentingPrintWriter} to write the state to.
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index ac02a88..dc92129 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -913,8 +913,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 66b8749..a27be39 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
@@ -246,8 +246,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 50b77ed..649d0c0 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 58f093a..494eacc 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");
int dataUsageKb = (10 *1024) + random.nextInt(50 * 1024);
changeCallDataUsage(dataUsageKb);
}