Simplify Respositories, Switchboard and Switchboard-indirection.
This is a step into separating Call into Call + Connection.
Changes:
1. Update Repositories to:
A. Share code via the new BaseRepository
B. Perform a lookup per call instead of attempting to have 1 lookup
work for concurrent calls. This allowed removal of extra state
out of the repositories (mIsLookupInProgress) and out of
Switchboard (mNewOutgoingCalls, mPendingOutgoingCalls, etc).
2. Add a OutgoingCallEntry class to Switchboard to support 1 service
lookup per outgoing call. The new class maintains the necessary
state (CS collection & selector collection).
3. Outgoing/IncomingCallsManager now reports success/failure directly
to the Call class instead of indirecting through the switchboard.
4. Switchboard, for the time being, kept the outgoing call timeout and
triggers it through OutgoingCallEntry.
Change-Id: I01196dd5384ad256cf09035018a76abaadb2c04d
diff --git a/src/com/android/telecomm/OutgoingCallProcessor.java b/src/com/android/telecomm/OutgoingCallProcessor.java
index 5c8d5f5..3874bd5 100644
--- a/src/com/android/telecomm/OutgoingCallProcessor.java
+++ b/src/com/android/telecomm/OutgoingCallProcessor.java
@@ -33,10 +33,9 @@
* Iterates through the selectors and gets a sorted list of supported call-service descriptors
* for each selector. Upon receiving each sorted list (one list per selector), each of the
* corresponding call services is then attempted until either the outgoing call is placed, the
- * attempted call is aborted (by the switchboard), or the list is exhausted -- whichever occurs
- * first.
+ * attempted call is aborted, or the list is exhausted -- whichever occurs first.
*
- * Except for the abort case, all other scenarios should terminate with the switchboard notified
+ * Except for the abort case, all other scenarios should terminate with the call notified
* of the result.
*
* NOTE(gilad): Currently operating under the assumption that we'll have one timeout per (outgoing)
@@ -79,8 +78,6 @@
/** Manages all outgoing call processors. */
private final OutgoingCallsManager mOutgoingCallsManager;
- private final Switchboard mSwitchboard;
-
private final Runnable mNextCallServiceCallback = new Runnable() {
@Override public void run() {
attemptNextCallService();
@@ -113,21 +110,18 @@
* @param callServices The available call-service implementations.
* @param selectors The available call-service selector implementations.
* @param outgoingCallsManager Manager of all outgoing call processors.
- * @param switchboard The switchboard.
*/
OutgoingCallProcessor(
Call call,
- Set<CallServiceWrapper> callServices,
+ Collection<CallServiceWrapper> callServices,
Collection<CallServiceSelectorWrapper> selectors,
- OutgoingCallsManager outgoingCallsManager,
- Switchboard switchboard) {
+ OutgoingCallsManager outgoingCallsManager) {
ThreadUtil.checkOnMainThread();
mCall = call;
mSelectors = selectors;
mOutgoingCallsManager = outgoingCallsManager;
- mSwitchboard = switchboard;
// Populate the list and map of call-service descriptors. The list is needed since
// it's being passed down to selectors.
@@ -214,7 +208,7 @@
for (CallServiceWrapper callService : mIncompatibleCallServices) {
mCall.addIncompatibleCallService(callService);
}
- mSwitchboard.handleSuccessfulOutgoingCall(mCall);
+ mCall.handleSuccessfulOutgoing();
}
/**