resolved conflicts for merge of 10838c23 to master
Change-Id: I2c860eece81258c868ed8429aca5a4ebe2d62ba9
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 1d881a5..9a9e235 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -555,6 +555,29 @@
}
/**
+ * Checks to see if the specified call is the only high-level call and if so, enable the
+ * "Add-call" button. We allow you to add a second call but not a third or beyond.
+ *
+ * @param call The call to test for add-call.
+ * @return Whether the add-call feature should be enabled for the call.
+ */
+ protected boolean isAddCallCapable(Call call) {
+ if (call.getParentCall() != null) {
+ // Never true for child calls.
+ return false;
+ }
+
+ // Loop through all the other calls and there exists a top level (has no parent) call
+ // that is not the specified call, return false.
+ for (Call otherCall : mCalls) {
+ if (call != otherCall && otherCall.getParentCall() == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
* Returns the first call that it finds with the given states. The states are treated as having
* priority order so that any call with the first state will be returned before any call with
* states listed later in the parameter list.
diff --git a/src/com/android/telecomm/InCallController.java b/src/com/android/telecomm/InCallController.java
index bf2deb1..637e03e 100644
--- a/src/com/android/telecomm/InCallController.java
+++ b/src/com/android/telecomm/InCallController.java
@@ -259,6 +259,9 @@
if (call.getHandoffHandle() != null) {
capabilities |= CallCapabilities.CONNECTION_HANDOFF;
}
+ if (CallsManager.getInstance().isAddCallCapable(call)) {
+ capabilities |= CallCapabilities.ADD_CALL;
+ }
CallState state = call.getState();
if (state == CallState.ABORTED) {
state = CallState.DISCONNECTED;
@@ -271,4 +274,5 @@
capabilities, call.getConnectTimeMillis(), call.getHandle(), call.getGatewayInfo(),
descriptor, call.getHandoffCallServiceDescriptor());
}
+
}