diff options
author | Santos Cordon <santoscordon@google.com> | 2014-06-06 09:08:46 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-06-09 10:58:21 -0700 |
commit | 62e699d1b0b9a8606014ace43b84eccf614b6867 (patch) | |
tree | 8cebd613d64181e5aa3bc7bc99add3b6d3ebd595 | |
parent | 561374c01312e1d2daa526a38f66f28c822573e5 (diff) |
Support conference calling. (4/4) [DO NOT MERGE]
Bug: 15006702
Change-Id: I2764ea242f783ba478c9eae86618dd33e9fc792a
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<String> 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<Integer> 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<String> callIds) { + mChildCallIds = callIds; + } + + public List<String> 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<CallButtonPresenter.CallButto } public void mergeClicked() { - TelecommAdapter.getInstance().merge(); + TelecommAdapter.getInstance().merge(mCall.getCallId()); } public void addCallClicked() { diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 14c2a8020..922c29819 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -501,7 +501,7 @@ public class InCallPresenter implements CallList.Listener { // (2) Attempt actions on Generic conference calls if (activeCall.isConferenceCall() && isGeneric) { if (canMerge) { - TelecommAdapter.getInstance().merge(); + TelecommAdapter.getInstance().merge(activeCall.getCallId()); return true; } else if (canSwap) { TelecommAdapter.getInstance().swap(); diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java index e6085702b..1829e9306 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -17,11 +17,13 @@ package com.android.incallui; import android.telecomm.CallAudioState; +import android.telecomm.CallCapabilities; import android.telecomm.CallState; -import android.telecomm.ConnectionRequest; +import android.telecomm.GatewayInfo; import android.telecomm.InCallAdapter; import android.telecomm.InCallCall; import android.telecomm.InCallService; +import android.telephony.DisconnectCause; import com.google.common.collect.ImmutableList; @@ -59,9 +61,10 @@ public class InCallServiceImpl extends InCallService { /** {@inheritDoc} */ @Override protected void addCall(InCallCall telecommCall) { - Log.v(this, "addCall, state: " + telecommCall.getState()); Call call = new Call(telecommCall.getId()); updateCall(call, telecommCall); + Log.i(this, "addCall: " + call); + if (call.getState() == Call.State.INCOMING) { CallList.getInstance().onIncoming(call, EMPTY_RESPONSE_TEXTS); } else { @@ -77,9 +80,9 @@ public class InCallServiceImpl extends InCallService { return; } - Log.v(this, "updateCall: " + call); int oldState = call.getState(); updateCall(call, telecommCall); + Log.i(this, "updateCall: " + telecommCall + " => " + 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() { |