Handoff: Implement handoff in Telecomm

See the following CLs for more info on how handoff is enabled and
triggered: changeid - I94c28b10c0e0a253450f14d31ecdc416d5b44ca4

Once a Call is handoff enabled it will have a non-null mHandoffHandle.

When handoff is triggered we create a new Call object and set
mOriginalCall.

At this point we have two call objects.
  1st call: Call1
        - mHandoffHandle: non-null
        - mOriginalCall: null
  2nd (invisible) call: Call2
        - mHandoffHandle: null
        - mOriginalCall: non-null

Once the new call's state changes to active we do the following:
      call1.disconnect() // hangup on the old call
      removeCall(call2) // stop tracking the new call
      // merge into call1
      call1.setCallService(call2.getCallService());
      call1.setState(call2.State());

At this point call2 is deleted and call1 has been fully handed off.

Bug: 13643568
Change-Id: I94c28b10c0e0a253450f14d31ecdc416d5b44ca4
diff --git a/src/com/android/telecomm/Switchboard.java b/src/com/android/telecomm/Switchboard.java
index ccb6b80..c2df63e 100644
--- a/src/com/android/telecomm/Switchboard.java
+++ b/src/com/android/telecomm/Switchboard.java
@@ -293,7 +293,14 @@
      * @param call The call to place.
      */
     private void processNewOutgoingCall(Call call) {
-        Collection<CallServiceSelectorWrapper> selectors = mSelectors;
+        Collection<CallServiceSelectorWrapper> selectors;
+
+        // Use the call's selector if it's already tied to one. This is the case for handoff calls.
+        if (call.getCallServiceSelector() != null) {
+            selectors = ImmutableList.of(call.getCallServiceSelector());
+        } else {
+            selectors = mSelectors;
+        }
 
         boolean useEmergencySelector =
                 EmergencyCallServiceSelector.shouldUseSelector(call.getHandle());
@@ -315,7 +322,7 @@
                             mOutgoingCallsManager);
 
             selectorsBuilder.add(emergencySelector);
-            selectorsBuilder.addAll(mSelectors);
+            selectorsBuilder.addAll(selectors);
             selectors = selectorsBuilder.build();
         }