Support for multiple VideoCall.Listeners for a VideoCall.
The current code assumes that only a single instance of VideoCall will be
provided to the default system InCall UI. Ideally multiple
InCallService implementations should be able to use the VideoCall APIs.
Note: it only really makes sense for a single InCallService to get/set
the video surfaces.
- Fixed bug in ParcelableCall which would cause a new instance of
VideoCallImpl to be created every time a call is updated from Telecom.
Added a flag to ParcelableCall to indicate whether the parcel includes a
change to the video provider information, which is used when unparceling
to determine whether to set/create the video call impl.
- Renamed "setVideoCallback" to "addVideocallback".
- Modified Connection.VideoProvider code to keep a list of Video callbacks
and fire off all of them when Video Provider changes occur.
Bug: 20092420
Change-Id: Ic16b6afe1b7532cc64d006c133adbae57946d97d
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index adc648f..bf6c318 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -46,6 +46,7 @@
private final int mCallerDisplayNamePresentation;
private final GatewayInfo mGatewayInfo;
private final PhoneAccountHandle mAccountHandle;
+ private final boolean mIsVideoCallProviderChanged;
private final IVideoProvider mVideoCallProvider;
private InCallService.VideoCall mVideoCall;
private final String mParentCallId;
@@ -70,6 +71,7 @@
int callerDisplayNamePresentation,
GatewayInfo gatewayInfo,
PhoneAccountHandle accountHandle,
+ boolean isVideoCallProviderChanged,
IVideoProvider videoCallProvider,
String parentCallId,
List<String> childCallIds,
@@ -91,6 +93,7 @@
mCallerDisplayNamePresentation = callerDisplayNamePresentation;
mGatewayInfo = gatewayInfo;
mAccountHandle = accountHandle;
+ mIsVideoCallProviderChanged = isVideoCallProviderChanged;
mVideoCallProvider = videoCallProvider;
mParentCallId = parentCallId;
mChildCallIds = childCallIds;
@@ -243,6 +246,18 @@
return mCallSubstate;
}
+ /**
+ * Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the
+ * {@link android.telecom.InCallService.VideoCall} associated with this call. Since
+ * {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether
+ * the provider has changed (which can influence whether it is accessed).
+ *
+ * @return {@code true} if the video call changed, {@code false} otherwise.
+ */
+ public boolean isVideoCallProviderChanged() {
+ return mIsVideoCallProviderChanged;
+ }
+
/** Responsible for creating ParcelableCall objects for deserialized Parcels. */
public static final Parcelable.Creator<ParcelableCall> CREATOR =
new Parcelable.Creator<ParcelableCall> () {
@@ -263,6 +278,7 @@
int callerDisplayNamePresentation = source.readInt();
GatewayInfo gatewayInfo = source.readParcelable(classLoader);
PhoneAccountHandle accountHandle = source.readParcelable(classLoader);
+ boolean isVideoCallProviderChanged = source.readByte() == 1;
IVideoProvider videoCallProvider =
IVideoProvider.Stub.asInterface(source.readStrongBinder());
String parentCallId = source.readString();
@@ -288,6 +304,7 @@
callerDisplayNamePresentation,
gatewayInfo,
accountHandle,
+ isVideoCallProviderChanged,
videoCallProvider,
parentCallId,
childCallIds,
@@ -326,6 +343,7 @@
destination.writeInt(mCallerDisplayNamePresentation);
destination.writeParcelable(mGatewayInfo, 0);
destination.writeParcelable(mAccountHandle, 0);
+ destination.writeByte((byte) (mIsVideoCallProviderChanged ? 1 : 0));
destination.writeStrongBinder(
mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null);
destination.writeString(mParentCallId);