Change sendSessionModifyRequest VideoProvider API signature.

Including a fromProfile in addition to the requestedProfile.

- Changed VideoCallImpl to generate the fromVideoProfile based on the
call's current videoState.  This ensures the InCall UI only needs to
pass in the new video profile; the VideoCall Impl already has enough
knowledge to generate the fromProfile.
  - Changed VideoCallImpl to track the current videoQuality, which forms
a part of the fromVideoProfile.

Bug: 20704229
Change-Id: I89f293f03a2b13fc8c1dcfd8a07ab8640d3950e0
This commit is contained in:
Tyler Gunn
2015-05-01 09:46:44 -07:00
parent 0353e1ca06
commit f18217248d
9 changed files with 50 additions and 20 deletions

View File

@@ -47,6 +47,8 @@ public class VideoCallImpl extends VideoCall {
private final IVideoProvider mVideoProvider;
private final VideoCallListenerBinder mBinder;
private VideoCall.Callback mCallback;
private int mVideoQuality = VideoProfile.QUALITY_UNKNOWN;
private Call mCall;
private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() {
@Override
@@ -152,6 +154,7 @@ public class VideoCallImpl extends VideoCall {
(CameraCapabilities) msg.obj);
break;
case MSG_CHANGE_VIDEO_QUALITY:
mVideoQuality = msg.arg1;
mCallback.onVideoQualityChanged(msg.arg1);
break;
default:
@@ -161,12 +164,13 @@ public class VideoCallImpl extends VideoCall {
};
/** {@hide} */
VideoCallImpl(IVideoProvider videoProvider) throws RemoteException {
VideoCallImpl(IVideoProvider videoProvider, Call call) throws RemoteException {
mVideoProvider = videoProvider;
mVideoProvider.asBinder().linkToDeath(mDeathRecipient, 0);
mBinder = new VideoCallListenerBinder();
mVideoProvider.addVideoCallback(mBinder);
mCall = call;
}
/** {@inheritDoc} */
@@ -223,10 +227,24 @@ public class VideoCallImpl extends VideoCall {
}
}
/** {@inheritDoc} */
/**
* Sends a session modification request to the video provider.
* <p>
* The {@link InCallService} will create the {@code requestProfile} based on the current
* video state (i.e. {@link Call.Details#getVideoState()}). It is, however, possible that the
* video state maintained by the {@link InCallService} could get out of sync with what is known
* by the {@link android.telecom.Connection.VideoProvider}. To remove ambiguity, the
* {@link VideoCallImpl} passes along the pre-modify video profile to the {@code VideoProvider}
* to ensure it has full context of the requested change.
*
* @param requestProfile The requested video profile.
*/
public void sendSessionModifyRequest(VideoProfile requestProfile) {
try {
mVideoProvider.sendSessionModifyRequest(requestProfile);
VideoProfile originalProfile = new VideoProfile(mCall.getDetails().getVideoState(),
mVideoQuality);
mVideoProvider.sendSessionModifyRequest(originalProfile, requestProfile);
} catch (RemoteException e) {
}
}