Ensure video provider is set on ImsConference from host connection.
We were not previously setting the conference host on the conference from
the conference host connection. This prevented control of a video
conference call.
Change-Id: I5cbaf70c17bbe38de90bda823148b736481c92f1
Test: Manual live carrier testing with custom build by build team.
Bug: 162470056
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 06f3bf0..76cdd53 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -438,6 +438,7 @@
mTelephonyConnectionService = telephonyConnectionService;
setConferenceHost(conferenceHost);
+ setVideoProvider(conferenceHost, conferenceHost.getVideoProvider());
int capabilities = Connection.CAPABILITY_MUTE |
Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
diff --git a/src/com/android/services/telephony/ImsConferenceController.java b/src/com/android/services/telephony/ImsConferenceController.java
index 6d3d4c2..7cf9415 100644
--- a/src/com/android/services/telephony/ImsConferenceController.java
+++ b/src/com/android/services/telephony/ImsConferenceController.java
@@ -403,6 +403,20 @@
conferenceHostConnection.setVideoPauseSupported(connection.getVideoPauseSupported());
conferenceHostConnection.setManageImsConferenceCallSupported(
connection.isManageImsConferenceCallSupported());
+ // WARNING: do not try to copy the video provider from connection to
+ // conferenceHostConnection here. In connection.cloneConnection, part of the clone
+ // process is to set the original connection so it's already set:
+ // conferenceHostConnection.setVideoProvider(connection.getVideoProvider());
+ // There is a subtle concurrency issue here where at the time of merge, the
+ // TelephonyConnection potentially has the WRONG video provider set on it (compared to
+ // the ImsPhoneConnection (ie original connection) which has the correct one.
+ // If you follow the logic in ImsPhoneCallTracker#onCallMerged through, what happens is the
+ // new post-merge video provider is set on the ImsPhoneConnection. That informs it's
+ // listeners (e.g. TelephonyConnection) via a handler. We immediately change the multiparty
+ // start of the host connection and ImsPhoneCallTracker starts the setup we are
+ // performing here. When cloning TelephonyConnection, we get the right VideoProvider
+ // because it is copied from the originalConnection, not using the potentially stale value
+ // in the TelephonyConnection.
PhoneAccountHandle phoneAccountHandle = null;