diff options
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 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<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 c66ca8ed9..f98d7f1df 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; @@ -61,9 +63,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 { @@ -79,9 +82,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); @@ -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() { |