Remove dependency on android.telecom.Call in VideoCallImpl for testing.

VideoCallImpl had a depedency on android.telecom.Call, which was used
to get the current video state of a call when the user issues a
session modify request (we need to know what the video state was before
the request was sent).  This proved problematic for unit tests, as
android.telecom.Call is a final class and cannot be mocked.

These changes assume the VideoCallImpl will instead have a video state
property, which is updated by the Call whenever it changes.  This
removes the dependency on the Call, and makes it possible to unit test the
API.

Change-Id: Ie67255d68b23e32aa177b30ac6439632fad5cc27
This commit is contained in:
Tyler Gunn
2015-12-08 10:53:41 -08:00
parent 79aeb92f4d
commit 584ba6c1d1
3 changed files with 24 additions and 13 deletions

View File

@@ -48,7 +48,7 @@ public final class ParcelableCall implements Parcelable {
private final PhoneAccountHandle mAccountHandle;
private final boolean mIsVideoCallProviderChanged;
private final IVideoProvider mVideoCallProvider;
private InCallService.VideoCall mVideoCall;
private VideoCallImpl mVideoCall;
private final String mParentCallId;
private final List<String> mChildCallIds;
private final StatusHints mStatusHints;
@@ -179,12 +179,13 @@ public final class ParcelableCall implements Parcelable {
/**
* Returns an object for remotely communicating through the video call provider's binder.
* @return The video call.
*/
public InCallService.VideoCall getVideoCall(Call call) {
public VideoCallImpl getVideoCallImpl() {
if (mVideoCall == null && mVideoCallProvider != null) {
try {
mVideoCall = new VideoCallImpl(mVideoCallProvider, call);
mVideoCall = new VideoCallImpl(mVideoCallProvider);
} catch (RemoteException ignored) {
// Ignore RemoteException.
}