Work in preparation for wiring up the remaining de-allocation and
abort bits.
1) limit to one attempt per call service upon multiple selectors
returning the same call service
2) record the failing/incompatible ones such that these are avoided
when switching
3) addressing some related todos etc.

Change-Id: I62204e9947bb8557888df33ca70f4352d3e6decf
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index d54072d..6660dc3 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -20,10 +20,12 @@
 import android.telecomm.CallState;
 
 import com.android.internal.telecomm.ICallServiceSelector;
+import com.google.android.collect.Sets;
 import com.google.common.base.Preconditions;
 
 import java.util.Date;
 import java.util.Locale;
+import java.util.Set;
 import java.util.UUID;
 
 /**
@@ -67,6 +69,12 @@
     private CallInfo mCallInfo;
 
     /**
+     * The set of call services that were attempted in the process of placing/switching this call
+     * but turned out unsuitable.  Only used in the context of call switching.
+     */
+    private Set<CallServiceWrapper> mIncompatibleCallServices;
+
+    /**
      * Creates an empty call object with a unique call ID.
      */
     Call() {
@@ -177,6 +185,32 @@
     }
 
     /**
+     * Adds the specified call service to the list of incompatible services.  The set is used when
+     * attempting to switch a phone call between call services such that incompatible services can
+     * be avoided.
+     *
+     * @param callService The incompatible call service.
+     */
+    void addIncompatibleCallService(CallServiceWrapper callService) {
+        if (mIncompatibleCallServices == null) {
+            mIncompatibleCallServices = Sets.newHashSet();
+        }
+        mIncompatibleCallServices.add(callService);
+    }
+
+    /**
+     * Checks whether or not the specified callService was identified as incompatible in the
+     * context of this call.
+     *
+     * @param callService The call service to evaluate.
+     * @return True upon incompatible call services and false otherwise.
+     */
+    boolean isIncompatibleCallService(CallServiceWrapper callService) {
+        return mIncompatibleCallServices != null &&
+                mIncompatibleCallServices.contains(callService);
+    }
+
+    /**
      * Aborts ongoing attempts to connect this call. Only applicable to {@link CallState#NEW}
      * outgoing calls.  See {@link #disconnect} for already-connected calls.
      */