Perform clean up when a call-service dies.
Also add some test call service logic to make this logic
easily testable.
Bug: 13546896
Change-Id: I7e1518488b4cd2d7752c3fee32816cecf734e388
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 92c247e..36fbf77 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -350,6 +350,21 @@
}
/**
+ * Cleans up any calls currently associated with the specified call service when the
+ * call-service binder disconnects unexpectedly.
+ *
+ * @param callService The call service that disconnected.
+ */
+ void handleCallServiceDeath(CallServiceWrapper callService) {
+ Preconditions.checkNotNull(callService);
+ for (Call call : ImmutableList.copyOf(mCalls.values())) {
+ if (call.getCallService() == callService) {
+ markCallAsDisconnected(call.getId());
+ }
+ }
+ }
+
+ /**
* Adds the specified call to the main list of live calls.
*
* @param call The call to add.