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/IncomingCallsManager.java b/src/com/android/telecomm/IncomingCallsManager.java
index 41b98f2..13ffb64 100644
--- a/src/com/android/telecomm/IncomingCallsManager.java
+++ b/src/com/android/telecomm/IncomingCallsManager.java
@@ -31,19 +31,9 @@
*/
final class IncomingCallsManager {
- private final Switchboard mSwitchboard;
private final Set<Call> mPendingIncomingCalls = Sets.newLinkedHashSet();
/**
- * Persists the specified parameters.
- *
- * @param switchboard The switchboard.
- */
- IncomingCallsManager(Switchboard switchboard) {
- mSwitchboard = switchboard;
- }
-
- /**
* Retrieves details of an incoming call through its associated call service.
*
* @param call The call object.
@@ -69,7 +59,7 @@
}
/**
- * Notifies the switchboard of a successful incoming call after removing it from the pending
+ * Notifies the incoming call of success after removing it from the pending
* list.
*
* @param callInfo The details of the call.
@@ -80,12 +70,12 @@
if (mPendingIncomingCalls.contains(call)) {
Log.d(this, "Incoming call %s found.", call);
mPendingIncomingCalls.remove(call);
- mSwitchboard.handleSuccessfulIncomingCall(call, callInfo);
+ call.handleSuccessfulIncoming(callInfo);
}
}
/**
- * Notifies switchboard of the failed incoming call after removing it from the pending list.
+ * Notifies incoming call of failure after removing it from the pending list.
*/
void handleFailedIncomingCall(Call call) {
ThreadUtil.checkOnMainThread();
@@ -94,7 +84,7 @@
Log.i(this, "Failed to get details for incoming call %s", call);
mPendingIncomingCalls.remove(call);
// The call was found still waiting for details. Consider it failed.
- mSwitchboard.handleFailedIncomingCall(call);
+ call.handleFailedIncoming();
}
}
}