diff options
author | roldenburg <roldenburg@google.com> | 2017-06-26 16:14:45 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2017-06-30 14:34:39 -0700 |
commit | def8100bfce62eaa16d150430c6f99e6a3d8afa1 (patch) | |
tree | db9499d917a5a773f5d7fabe4292be726e96d5df /java/com/android/incallui/videotech | |
parent | 2fc6b457f20cc91566097ef33ea067c068cb18ba (diff) |
Fix pause & unpause requests if stopTransmission has not completed
The request to stop transmission can be in-flight at the time Dialer goes into the background so the pause request will still include Rx. This happens because pausing previously just gets the current video state and adds pause.
Bug: 62990728
Test: ImsVideoTechTest
PiperOrigin-RevId: 160210111
Change-Id: Ie9134c285a73d4348036f6bbb847abae53a1d373
Diffstat (limited to 'java/com/android/incallui/videotech')
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoTech.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index 99d812a91..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; @@ -42,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; @@ -209,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( @@ -219,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( @@ -232,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( @@ -248,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( |