From 9ce7c408548d5240d124b5b4960233b13d17a635 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Fri, 6 Jun 2014 09:08:46 -0700 Subject: Support conference calling. (4/4) Bug: 15006702 Change-Id: I2764ea242f783ba478c9eae86618dd33e9fc792a --- InCallUI/src/com/android/incallui/Call.java | 40 +++++++++++++++++----- .../com/android/incallui/CallButtonPresenter.java | 2 +- .../src/com/android/incallui/InCallPresenter.java | 2 +- .../com/android/incallui/InCallServiceImpl.java | 11 ++++-- .../src/com/android/incallui/TelecommAdapter.java | 14 ++++++-- 5 files changed, 53 insertions(+), 16 deletions(-) (limited to 'InCallUI/src/com/android') diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 6a36657ad..bb079b5ea 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -26,6 +26,7 @@ import android.telephony.DisconnectCause; import com.google.common.collect.ImmutableSortedSet; import com.google.common.primitives.Ints; +import java.util.List; import java.util.Locale; /** @@ -105,6 +106,8 @@ public final class Call { private GatewayInfo mGatewayInfo; private CallServiceDescriptor mCurrentCallServiceDescriptor; private CallServiceDescriptor mHandoffCallServiceDescriptor; + private String mParentCallId; + private List mChildCallIds; public Call(String callId) { mCallId = callId; @@ -118,7 +121,7 @@ public final class Call { if (mGatewayInfo != null) { return mGatewayInfo.getOriginalHandle().getSchemeSpecificPart(); } - return getHandle().getSchemeSpecificPart(); + return mHandle == null ? null : mHandle.getSchemeSpecificPart(); } public Uri getHandle() { @@ -130,7 +133,11 @@ public final class Call { } public int getState() { - return mState; + if (mParentCallId != null) { + return State.CONFERENCED; + } else { + return mState; + } } public void setState(int state) { @@ -183,12 +190,8 @@ public final class Call { return mConnectTimeMillis; } - public ImmutableSortedSet getChildCallIds() { - return ImmutableSortedSet.of(); - } - public boolean isConferenceCall() { - return false; + return mChildCallIds != null && !mChildCallIds.isEmpty(); } public GatewayInfo getGatewayInfo() { @@ -220,8 +223,29 @@ public final class Call { mHandoffCallServiceDescriptor = descriptor; } + public void setChildCallIds(List callIds) { + mChildCallIds = callIds; + } + + public List getChildCallIds() { + return mChildCallIds; + } + + public void setParentId(String callId) { + mParentCallId = callId; + } + + public String getParentId() { + return mParentCallId; + } + @Override public String toString() { - return String.format(Locale.US, "[%s, %s]", mCallId, State.toString(mState)); + return String.format(Locale.US, "[%s, %s, %s, children:%s, parent:%s]", + mCallId, + State.toString(mState), + CallCapabilities.toString(mCapabilities), + mChildCallIds, + mParentCallId); } } diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index e899bf64e..bcb4a5541 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -211,7 +211,7 @@ public class CallButtonPresenter extends Presenter " + call); if (oldState != call.getState() && call.getState() == Call.State.DISCONNECTED) { CallList.getInstance().onDisconnect(call); @@ -125,6 +128,8 @@ public class InCallServiceImpl extends InCallService { call.setCurrentCallServiceDescriptor(telecommCall.getCurrentCallServiceDescriptor()); call.setHandoffCallServiceDescriptor(telecommCall.getHandoffCallServiceDescriptor()); call.setState(translateState(telecommCall.getState())); + call.setParentId(telecommCall.getParentCallId()); + call.setChildCallIds(telecommCall.getChildCallIds()); } private static int translateState(CallState state) { diff --git a/InCallUI/src/com/android/incallui/TelecommAdapter.java b/InCallUI/src/com/android/incallui/TelecommAdapter.java index 90b9d96b0..4b0aff3cb 100644 --- a/InCallUI/src/com/android/incallui/TelecommAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java @@ -109,11 +109,19 @@ final class TelecommAdapter { } void separateCall(String callId) { - Log.wtf(this, "separateCall not implemented"); + if (mAdapter != null) { + mAdapter.splitFromConference(callId); + } else { + Log.e(this, "error separateCall, mAdapter is null."); + } } - void merge() { - Log.wtf(this, "merge not implemented"); + void merge(String callId) { + if (mAdapter != null) { + mAdapter.conference(callId); + } else { + Log.e(this, "error merge, mAdapter is null."); + } } void swap() { -- cgit v1.2.3