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/CallServiceFinder.java b/src/com/android/telecomm/CallServiceFinder.java
index 44ce75e..7fc187b 100644
--- a/src/com/android/telecomm/CallServiceFinder.java
+++ b/src/com/android/telecomm/CallServiceFinder.java
@@ -64,6 +64,8 @@
private final Switchboard mSwitchboard;
+ private final OutgoingCallsManager mOutgoingCallsManager;
+
/**
* Determines whether or not a lookup cycle is already running.
*/
@@ -118,10 +120,12 @@
/**
* Persists the specified parameters.
*
- * @param switchboard The switchboard for this finer to work against.
+ * @param switchboard The switchboard for this finder to work against.
+ * @param outgoingCallsManager Manager in charge of placing outgoing calls.
*/
- CallServiceFinder(Switchboard switchboard) {
+ CallServiceFinder(Switchboard switchboard, OutgoingCallsManager outgoingCallsManager) {
mSwitchboard = switchboard;
+ mOutgoingCallsManager = outgoingCallsManager;
}
/**
@@ -288,11 +292,20 @@
ThreadUtil.checkOnMainThread();
// TODO(santoscordon): When saving the call services into this class, also add code to
- // unregister (remove) the call services upon disconnect. Potentially use RemoteCallbackList.
+ // unregister (remove) the call services upon disconnect. Potentially use
+ // RemoteCallbackList.
if (mUnregisteredProviders.remove(providerName)) {
mProviderRegistry.add(provider);
- mCallServiceRegistry.addAll(callServices);
+ for (ICallService callService : callServices) {
+ try {
+ CallServiceAdapter adapter = new CallServiceAdapter(mOutgoingCallsManager);
+ callService.setCallServiceAdapter(adapter);
+ mCallServiceRegistry.add(callService);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to set call-service adapter.");
+ }
+ }
// TODO(gilad): Introduce a map to retain the association between call services
// and the corresponding provider such that mCallServiceRegistry can be updated