From 62e699d1b0b9a8606014ace43b84eccf614b6867 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) [DO NOT MERGE] 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(-) 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 b7d856558..74b13d944 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); @@ -123,6 +126,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 1828678f4..f1dd50b80 100644 --- a/InCallUI/src/com/android/incallui/TelecommAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java @@ -99,11 +99,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