Update the SpeakEasy component.

Test: unit tests
PiperOrigin-RevId: 184352489
Change-Id: If3f2414dd9769dc54035c7fcf5afe925af3006db
diff --git a/java/com/android/incallui/InCallServiceImpl.java b/java/com/android/incallui/InCallServiceImpl.java
index 1cb6c47..c4d6d06 100644
--- a/java/com/android/incallui/InCallServiceImpl.java
+++ b/java/com/android/incallui/InCallServiceImpl.java
@@ -29,6 +29,8 @@
 import com.android.incallui.call.CallList;
 import com.android.incallui.call.ExternalCallList;
 import com.android.incallui.call.TelecomAdapter;
+import com.android.incallui.speakeasy.SpeakEasyCallManager;
+import com.android.incallui.speakeasy.SpeakEasyComponent;
 
 /**
  * Used to receive updates about calls from the Telecom component. This service is bound to Telecom
@@ -41,6 +43,11 @@
   private ReturnToCallController returnToCallController;
   private NewReturnToCallController newReturnToCallController;
   private CallList.Listener feedbackListener;
+  // We only expect there to be one speakEasyCallManager to be instantiated at a time.
+  // We did not use a singleton SpeakEasyCallManager to avoid holding on to state beyond the
+  // lifecycle of this service, because the singleton is associated with the state of the
+  // Application, not this service.
+  private SpeakEasyCallManager speakEasyCallManager;
 
   @Override
   public void onCallAudioStateChanged(CallAudioState audioState) {
@@ -66,6 +73,8 @@
   @Override
   public void onCallRemoved(Call call) {
     Trace.beginSection("InCallServiceImpl.onCallRemoved");
+    speakEasyCallManager.onCallRemoved(CallList.getInstance().getDialerCallFromTelecomCall(call));
+
     InCallPresenter.getInstance().onCallRemoved(call);
     Trace.endSection();
   }
@@ -78,6 +87,12 @@
   }
 
   @Override
+  public void onCreate() {
+    super.onCreate();
+    this.speakEasyCallManager = SpeakEasyComponent.get(this).speakEasyCallManager();
+  }
+
+  @Override
   public IBinder onBind(Intent intent) {
     Trace.beginSection("InCallServiceImpl.onBind");
     final Context context = getApplicationContext();