diff options
author | roldenburg <roldenburg@google.com> | 2017-06-20 15:27:45 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-06-21 13:46:53 -0700 |
commit | be6b69a2ec388bbcff2f129dcf0c7c1476315664 (patch) | |
tree | c32c3cced5c70f6f7087e8fc52c703805e82ec95 /java/com/android | |
parent | 64be21e529fd84b839a7872d63afb8f1cec56037 (diff) |
Update our paused flag based on call session events
This fixes a bug where we would remember being paused after receiving a second
call incorrectly after we swap back to it.
@tgunn, adding you here to double-check I am interpreting those call session events correctly.
PiperOrigin-RevId: 159623587
Change-Id: Ic52e3e9046f767321a48e22274b8a1c27b4dfa86
Diffstat (limited to 'java/com/android')
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java | 9 | ||||
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoTech.java | 22 |
2 files changed, 30 insertions, 1 deletions
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java index 17c2e6518..f4e0a01ea 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java @@ -161,14 +161,23 @@ public class ImsVideoCallCallback extends VideoCall.Callback { } } + // In the vendor code rx_pause and rx_resume get triggered when the video player starts or stops + // playing the incoming video stream. For the case where you're resuming a held call, its + // definitely a good signal to use to know that the video is resuming (though the video state + // should change to indicate its not paused in this case as well). However, keep in mind you'll + // get these signals as well on carriers that don't support the video pause signalling (like TMO) + // so you want to ensure you don't send sessionModifyRequests with pause/resume based on these + // signals. Also, its technically possible to have a pause/resume if the video signal degrades. @Override public void onCallSessionEvent(int event) { 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 a6cef7b81..3d73e4e7d 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -19,6 +19,7 @@ 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; @@ -40,7 +41,8 @@ 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; public ImsVideoTech(LoggingBindings logger, VideoTechListener listener, Call call) { this.logger = logger; @@ -247,6 +249,24 @@ 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 |