Update CallId for handoff call
After handoff we were updating the call's CallService but not the callId.
This lead to the call being unable to communicate with the call service.
For example:
Call1(id_A) - CallService1, place Call1 using CallService1
start handoff
Call2(id_B) - CallService2, place Call2 using CallService2
complete handoff
Call1(id_C) - CallService2, update Call1's CallService
Call2(null) - null, clear Call2's call service
At this point CallService2 only knows about an ongoing Call with ID id_B.
When Call1 attempts to communicate with CallService2 nothing happens.
To fix this we need to use id_B as the ID for Call1. So:
Call1(id_B) - CallService2, update Call1's CallService
Bug: 13800552
Change-Id: I5dfadc21cb11668395bea50a1123523d4150d401
diff --git a/src/com/android/telecomm/CallServiceWrapper.java b/src/com/android/telecomm/CallServiceWrapper.java
index 007d35a..70f0ec2 100644
--- a/src/com/android/telecomm/CallServiceWrapper.java
+++ b/src/com/android/telecomm/CallServiceWrapper.java
@@ -28,6 +28,7 @@
import com.android.internal.telecomm.ICallService;
import com.android.internal.telecomm.ICallServiceAdapter;
import com.android.internal.telecomm.ICallServiceProvider;
+import com.google.common.base.Preconditions;
/**
* Wrapper for {@link ICallService}s, handles binding to {@link ICallService} and keeps track of
@@ -253,6 +254,14 @@
mCallIdMapper.addCall(call);
}
+ /**
+ * Associates newCall with this call service by replacing callToReplace.
+ */
+ void replaceCall(Call newCall, Call callToReplace) {
+ Preconditions.checkState(callToReplace.getCallService() == this);
+ mCallIdMapper.replaceCall(newCall, callToReplace);
+ }
+
void removeCall(Call call) {
mAdapter.removePendingCall(call);
mCallIdMapper.removeCall(call);