Add CDMA conference call capabilities
Bug:17316859
Change-Id: I9cade45df541ec3e2e2e39a02a1ba989019a0e93
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index b8e2e19..c1331cd 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -190,7 +190,7 @@
private PhoneAccountHandle mPhoneAccountHandle;
- private long mConnectTimeMillis;
+ private long mConnectTimeMillis = System.currentTimeMillis();
/** The state of the call. */
private int mState;
@@ -857,6 +857,22 @@
}
}
+ void mergeConference() {
+ if (mConnectionService == null) {
+ Log.w(this, "merging conference calls without a connection service.");
+ } else if (can(PhoneCapabilities.MERGE_CONFERENCE)) {
+ mConnectionService.mergeConference(this);
+ }
+ }
+
+ void swapConference() {
+ if (mConnectionService == null) {
+ Log.w(this, "swapping conference calls without a connection service.");
+ } else if (can(PhoneCapabilities.SWAP_CONFERENCE)) {
+ mConnectionService.swapConference(this);
+ }
+ }
+
void setParentCall(Call parentCall) {
if (parentCall == this) {
Log.e(this, new Exception(), "setting the parent to self");
@@ -891,6 +907,10 @@
return mConferenceableCalls;
}
+ private boolean can(int capability) {
+ return (mCallCapabilities & capability) == capability;
+ }
+
private void addChildCall(Call call) {
if (!mChildCalls.contains(call)) {
mChildCalls.add(call);
diff --git a/src/com/android/telecomm/ConnectionServiceWrapper.java b/src/com/android/telecomm/ConnectionServiceWrapper.java
index 787fbd0..22586ab 100644
--- a/src/com/android/telecomm/ConnectionServiceWrapper.java
+++ b/src/com/android/telecomm/ConnectionServiceWrapper.java
@@ -437,9 +437,11 @@
@Override
public void setCallCapabilities(String callId, int callCapabilities) {
logIncoming("setCallCapabilities %s %d", callId, callCapabilities);
- if (mCallIdMapper.isValidCallId(callId)) {
+ if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) {
mHandler.obtainMessage(MSG_SET_CALL_CAPABILITIES, callCapabilities, 0, callId)
.sendToTarget();
+ } else {
+ Log.w(this, "ID not valid for setCallCapabilities");
}
}
@@ -844,6 +846,28 @@
}
}
+ void mergeConference(Call call) {
+ final String callId = mCallIdMapper.getCallId(call);
+ if (callId != null && isServiceValid("mergeConference")) {
+ try {
+ logOutgoing("mergeConference %s", callId);
+ mServiceInterface.mergeConference(callId);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
+
+ void swapConference(Call call) {
+ final String callId = mCallIdMapper.getCallId(call);
+ if (callId != null && isServiceValid("swapConference")) {
+ try {
+ logOutgoing("swapConference %s", callId);
+ mServiceInterface.swapConference(callId);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
+
/** {@inheritDoc} */
@Override
protected void setServiceInterface(IBinder binder) {
diff --git a/src/com/android/telecomm/InCallAdapter.java b/src/com/android/telecomm/InCallAdapter.java
index 9f3fd0f..60b574d 100644
--- a/src/com/android/telecomm/InCallAdapter.java
+++ b/src/com/android/telecomm/InCallAdapter.java
@@ -46,6 +46,8 @@
private static final int MSG_PHONE_ACCOUNT_SELECTED = 14;
private static final int MSG_TURN_ON_PROXIMITY_SENSOR = 15;
private static final int MSG_TURN_OFF_PROXIMITY_SENSOR = 16;
+ private static final int MSG_MERGE_CONFERENCE = 17;
+ private static final int MSG_SWAP_CONFERENCE = 18;
private final class InCallAdapterHandler extends Handler {
@Override
@@ -190,6 +192,22 @@
case MSG_TURN_OFF_PROXIMITY_SENSOR:
mCallsManager.turnOffProximitySensor((boolean) msg.obj);
break;
+ case MSG_MERGE_CONFERENCE:
+ call = mCallIdMapper.getCall(msg.obj);
+ if (call != null) {
+ call.mergeConference();
+ } else {
+ Log.w(this, "mergeConference, unknown call id: %s", msg.obj);
+ }
+ break;
+ case MSG_SWAP_CONFERENCE:
+ call = mCallIdMapper.getCall(msg.obj);
+ if (call != null) {
+ call.swapConference();
+ } else {
+ Log.w(this, "swapConference, unknown call id: %s", msg.obj);
+ }
+ break;
}
}
}
@@ -320,6 +338,20 @@
}
@Override
+ public void mergeConference(String callId) {
+ if (mCallIdMapper.isValidCallId(callId)) {
+ mHandler.obtainMessage(MSG_MERGE_CONFERENCE, callId).sendToTarget();
+ }
+ }
+
+ @Override
+ public void swapConference(String callId) {
+ if (mCallIdMapper.isValidCallId(callId)) {
+ mHandler.obtainMessage(MSG_SWAP_CONFERENCE, callId).sendToTarget();
+ }
+ }
+
+ @Override
public void turnOnProximitySensor() {
mHandler.obtainMessage(MSG_TURN_ON_PROXIMITY_SENSOR).sendToTarget();
}
diff --git a/tests/src/com/android/telecomm/testapps/TestConnectionService.java b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
index e5d54e9..2f8df3d 100644
--- a/tests/src/com/android/telecomm/testapps/TestConnectionService.java
+++ b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
@@ -141,7 +141,6 @@
// Assume all calls are video capable.
int capabilities = getCallCapabilities();
capabilities |= PhoneCapabilities.SUPPORTS_VT_LOCAL;
- capabilities |= PhoneCapabilities.MERGE_CALLS;
capabilities |= PhoneCapabilities.ADD_CALL;
capabilities |= PhoneCapabilities.MUTE;
capabilities |= PhoneCapabilities.SUPPORT_HOLD;