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/CallIdMapper.java b/src/com/android/telecomm/CallIdMapper.java
index aec3b5e..a5d70bf 100644
--- a/src/com/android/telecomm/CallIdMapper.java
+++ b/src/com/android/telecomm/CallIdMapper.java
@@ -30,6 +30,14 @@
mCallIdPrefix = callIdPrefix + "@";
}
+ void replaceCall(Call newCall, Call callToReplace) {
+ ThreadUtil.checkOnMainThread();
+
+ // Use the old call's ID for the new call.
+ String callId = getCallId(callToReplace);
+ mCalls.put(callId, newCall);
+ }
+
void addCall(Call call) {
ThreadUtil.checkOnMainThread();
Preconditions.checkNotNull(call);