diff options
author | Santos Cordon <santoscordon@google.com> | 2014-07-29 16:01:02 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-08-06 00:54:04 -0700 |
commit | f0f4fe8d4643e7a77dcbabb67b743a571f1b38c1 (patch) | |
tree | 92c6ed369dbbb88d2dd2315cdaa2b00575e1ef0a | |
parent | 48e327289142ac038e078b2dfb17c87695f3e4d7 (diff) |
Add setConferenceable() API from ConnectionService to incall. (3/4)
Change-Id: I64fdca08d35f893d755e3b154543a261b1418343
4 files changed, 27 insertions, 2 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index ec79a0a09..9b983220a 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -300,6 +300,13 @@ public final class Call { /** Checks if the call supports the given set of capabilities supplied as a bit mask. */ public boolean can(int capabilities) { + if (CallCapabilities.MERGE_CALLS == (capabilities & CallCapabilities.MERGE_CALLS)) { + if (mTelecommCall.getConferenceableCalls().isEmpty()) { + // Cannot merge calls if there are no calls to merge with. + return false; + } + capabilities &= ~CallCapabilities.MERGE_CALLS; + } return (capabilities == (capabilities & mTelecommCall.getDetails().getCallCapabilities())); } diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index e07086879..66a384126 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -285,6 +285,7 @@ public class CallButtonFragment @Override public void showAddCallButton(boolean show) { + Log.d(this, "show Add call button: " + show); mAddCallButton.setVisibility(show ? View.VISIBLE : View.GONE); } diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 05a3f03af..6d7e5b810 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -29,10 +29,11 @@ import android.view.Surface; import android.view.View; import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import java.util.ArrayList; +import java.util.List; import java.util.Locale; import java.util.Set; @@ -110,6 +111,16 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { Log.e(this, "onStartActivity, exception", e); } } + + @Override + public void onConferenceableCallsChanged( + android.telecomm.Call call, List<android.telecomm.Call> conferenceableCalls) { + Log.i(this, "onConferenceableCallsChanged: " + call); + for (InCallDetailsListener listener : mDetailsListeners) { + listener.onDetailsChanged(CallList.getInstance().getCallByTelecommCall(call), + call.getDetails()); + } + } }; /** diff --git a/InCallUI/src/com/android/incallui/TelecommAdapter.java b/InCallUI/src/com/android/incallui/TelecommAdapter.java index 3d6c2c534..324fda568 100644 --- a/InCallUI/src/com/android/incallui/TelecommAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java @@ -26,6 +26,8 @@ import android.telecomm.PhoneAccountHandle; import com.google.common.base.Preconditions; +import java.util.List; + /** Wrapper around {@link InCallAdapter} that only forwards calls to the adapter when it's valid. */ final class TelecommAdapter implements InCallPhoneListener { private static final String ADD_CALL_MODE_KEY = "add_call_mode"; @@ -145,7 +147,11 @@ final class TelecommAdapter implements InCallPhoneListener { void merge(String callId) { if (mPhone != null) { - getTelecommCallById(callId).conference(); + android.telecomm.Call call = getTelecommCallById(callId); + List<android.telecomm.Call> conferenceable = call.getConferenceableCalls(); + if (!conferenceable.isEmpty()) { + call.conference(conferenceable.get(0)); + } } else { Log.e(this, "error merge, mPhone is null."); } |