diff options
author | Eric Erfanian <erfanian@google.com> | 2017-06-30 15:26:17 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-01 03:17:31 +0000 |
commit | d538e0b42004524abe36ac17606d3915a14f5dae (patch) | |
tree | 04638b64ff49c88d13ca3471eea44c30681489dd /java/com/android/incallui/videotech | |
parent | 842a9777de13bebb1c82f9d57222c52f9ddec558 (diff) |
Update AOSP Dialer source from internal google3 repository at
cl/160679286.
Test: make, treehugger
This CL updates the AOSP Dialer source with all the changes that have
gone into the private google3 repository. This includes all the
changes from cl/159771812 (6/22/2017) to 160679286 (6/30/2017).
These changes track the dialer V11 release.
This goal of these drops is to keep the AOSP source in sync with the
internal google3 repository. Currently these sync are done by hand
with very minor modifications to the internal source code.
See the Android.mk file for list of modifications.
Change-Id: I7e7b41ce472b85a9d5a6728d5c8b3c045c09e095
Merged-In: Ie2eb735a92c577b5ae5a5e8b7efa2d699fc964bc
Diffstat (limited to 'java/com/android/incallui/videotech')
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java | 2 | ||||
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoTech.java | 68 |
2 files changed, 43 insertions, 27 deletions
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java index f4e0a01ea..b83929304 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java @@ -173,11 +173,9 @@ public class ImsVideoCallCallback extends VideoCall.Callback { switch (event) { case Connection.VideoProvider.SESSION_EVENT_RX_PAUSE: LogUtil.i("ImsVideoCallCallback.onCallSessionEvent", "rx_pause"); - videoTech.onPausedEvent(); break; case Connection.VideoProvider.SESSION_EVENT_RX_RESUME: LogUtil.i("ImsVideoCallCallback.onCallSessionEvent", "rx_resume"); - videoTech.onResumedEvent(); break; case Connection.VideoProvider.SESSION_EVENT_CAMERA_FAILURE: LogUtil.i("ImsVideoCallCallback.onCallSessionEvent", "camera_failure"); diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index 3d73e4e7d..8fa983ac6 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -19,7 +19,6 @@ package com.android.incallui.videotech.ims; import android.content.Context; import android.os.Build; import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; import android.telecom.Call; import android.telecom.Call.Details; import android.telecom.VideoProfile; @@ -27,6 +26,7 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.LoggingBindings; +import com.android.dialer.util.CallUtil; import com.android.incallui.video.protocol.VideoCallScreen; import com.android.incallui.video.protocol.VideoCallScreenDelegate; import com.android.incallui.videotech.VideoTech; @@ -41,8 +41,13 @@ public class ImsVideoTech implements VideoTech { private @SessionModificationState int sessionModificationState = SessionModificationState.NO_REQUEST; private int previousVideoState = VideoProfile.STATE_AUDIO_ONLY; + private boolean paused = false; - @VisibleForTesting boolean paused = false; + // Hold onto a flag of whether or not stopTransmission was called but resumeTransmission has not + // been. This is needed because there is time between calling stopTransmission and + // call.getDetails().getVideoState() reflecting the change. During that time, pause() and + // unpause() will send the incorrect VideoProfile. + private boolean transmissionStopped = false; public ImsVideoTech(LoggingBindings logger, VideoTechListener listener, Call call) { this.logger = logger; @@ -56,12 +61,31 @@ public class ImsVideoTech implements VideoTech { return false; } - boolean hasCapabilities = - call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX) - && call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX); + if (call.getVideoCall() == null) { + return false; + } + + // We are already in an IMS video call + if (VideoProfile.isVideo(call.getDetails().getVideoState())) { + return true; + } + + // The user has disabled IMS video calling in system settings + if (!CallUtil.isVideoEnabled(context)) { + return false; + } + + // The current call doesn't support transmitting video + if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX)) { + return false; + } - return call.getVideoCall() != null - && (hasCapabilities || VideoProfile.isVideo(call.getDetails().getVideoState())); + // The current call remote device doesn't support receiving video + if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX)) { + return false; + } + + return true; } @Override @@ -189,6 +213,8 @@ public class ImsVideoTech implements VideoTech { public void stopTransmission() { LogUtil.enterBlock("ImsVideoTech.stopTransmission"); + transmissionStopped = true; + int unpausedVideoState = getUnpausedVideoState(call.getDetails().getVideoState()); call.getVideoCall() .sendSessionModifyRequest( @@ -199,6 +225,8 @@ public class ImsVideoTech implements VideoTech { public void resumeTransmission() { LogUtil.enterBlock("ImsVideoTech.resumeTransmission"); + transmissionStopped = false; + int unpausedVideoState = getUnpausedVideoState(call.getDetails().getVideoState()); call.getVideoCall() .sendSessionModifyRequest( @@ -212,6 +240,10 @@ public class ImsVideoTech implements VideoTech { LogUtil.i("ImsVideoTech.pause", "sending pause request"); paused = true; int pausedVideoState = call.getDetails().getVideoState() | VideoProfile.STATE_PAUSED; + if (transmissionStopped && VideoProfile.isTransmissionEnabled(pausedVideoState)) { + LogUtil.i("ImsVideoTech.pause", "overriding TX to false due to user request"); + pausedVideoState &= ~VideoProfile.STATE_TX_ENABLED; + } call.getVideoCall().sendSessionModifyRequest(new VideoProfile(pausedVideoState)); } else { LogUtil.i( @@ -228,6 +260,10 @@ public class ImsVideoTech implements VideoTech { LogUtil.i("ImsVideoTech.unpause", "sending unpause request"); paused = false; int unpausedVideoState = getUnpausedVideoState(call.getDetails().getVideoState()); + if (transmissionStopped && VideoProfile.isTransmissionEnabled(unpausedVideoState)) { + LogUtil.i("ImsVideoTech.unpause", "overriding TX to false due to user request"); + unpausedVideoState &= ~VideoProfile.STATE_TX_ENABLED; + } call.getVideoCall().sendSessionModifyRequest(new VideoProfile(unpausedVideoState)); } else { LogUtil.i( @@ -249,24 +285,6 @@ public class ImsVideoTech implements VideoTech { call.getVideoCall().setDeviceOrientation(rotation); } - /** - * Called when we receive an rx_pause from the IMS stack. Update our state so we know we are - * currently paused. This is important in the cases where we swap calls since pause() and - * unpause() are not called. - */ - void onPausedEvent() { - paused = true; - } - - /** - * Called when we receive an rx_resume from the IMS stack. Update our state so we know we are - * currently not paused. This is important in the cases where we swap calls since pause() and - * unpause() are not called. - */ - void onResumedEvent() { - paused = false; - } - private boolean canPause() { return call.getDetails().can(Details.CAPABILITY_CAN_PAUSE_VIDEO) && call.getState() == Call.STATE_ACTIVE |