OutgoingCalls(1/6) - Filling in lifecycle of outgoing call.
This CL adds the following:
1. CallServiceAdapter implementation
2. Setting call-service adapters when the finder receives call services.
3. CallServiceAdapter notifies OutgoingCallManager/OCP about a successful
outgoing call
4. Switchboard notifies CallsManager of the successful outgoing call
5. CallsManager adds the call to it's call repository.
What remains after this CL:
CallsManager sending the call to the InCall app and listening to
commands from in-call.
depends on: I086443e3f17ae0233b7b0fd5629119e989d06a40
Change-Id: I86f3e7ab02a47485eb2a5fb3557819418f3c4adf
diff --git a/src/com/android/telecomm/Switchboard.java b/src/com/android/telecomm/Switchboard.java
index 68ffc73..466f97f 100644
--- a/src/com/android/telecomm/Switchboard.java
+++ b/src/com/android/telecomm/Switchboard.java
@@ -45,9 +45,14 @@
*/
private final static int TICK_FREQUENCY = 250;
- private final CallServiceFinder mCallServiceFinder = new CallServiceFinder(this);
+ private final CallsManager mCallsManager;
- private final CallServiceSelectorFinder mSelectorFinder = new CallServiceSelectorFinder(this);
+ /** Used to place outgoing calls. */
+ private final OutgoingCallsManager mOutgoingCallsManager;
+
+ private CallServiceFinder mCallServiceFinder;
+
+ private CallServiceSelectorFinder mSelectorFinder;
/** Used to schedule tasks on the main (UI) thread. */
private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -84,7 +89,15 @@
*/
private Set<ICallServiceSelector> mSelectors;
- private Map<Call, OutgoingCallProcessor> outgoingCallProcessors = Maps.newHashMap();
+ /**
+ * Persists the specified parameters and initializes Switchboard.
+ */
+ Switchboard() {
+ mCallsManager = CallsManager.getInstance();
+ mOutgoingCallsManager = new OutgoingCallsManager(this);
+ mCallServiceFinder = new CallServiceFinder(this, mOutgoingCallsManager);
+ mSelectorFinder = new CallServiceSelectorFinder(this);
+ }
/**
* Attempts to place an outgoing call to the specified handle.
@@ -157,7 +170,7 @@
* see {@link OutgoingCallProcessor}.
*/
void handleSuccessfulOutgoingCall(Call call) {
- // TODO(gilad): More here.
+ mCallsManager.handleSuccessfulOutgoingCall(call);
// Process additional (new) calls, if any.
processNewOutgoingCalls();
@@ -236,14 +249,7 @@
List<ICallServiceSelector> selectors = Lists.newArrayList();
selectors.addAll(mSelectors);
- // Create the processor for this (outgoing) call and store it in a map such that call
- // attempts can be aborted etc.
- // TODO(gilad): Consider passing mSelector as an immutable set.
- OutgoingCallProcessor processor =
- new OutgoingCallProcessor(call, mCallServices, selectors, this);
-
- outgoingCallProcessors.put(call, processor);
- processor.process();
+ mOutgoingCallsManager.placeCall(call, mCallServices, selectors);
}
/**