summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorroldenburg <roldenburg@google.com>2017-06-26 16:14:45 -0700
committerBrandon Maxwell <maxwelb@google.com>2017-06-30 14:34:39 -0700
commitdef8100bfce62eaa16d150430c6f99e6a3d8afa1 (patch)
treedb9499d917a5a773f5d7fabe4292be726e96d5df /java
parent2fc6b457f20cc91566097ef33ea067c068cb18ba (diff)
downloadandroid_packages_apps_Dialer-def8100bfce62eaa16d150430c6f99e6a3d8afa1.tar.gz
android_packages_apps_Dialer-def8100bfce62eaa16d150430c6f99e6a3d8afa1.tar.bz2
android_packages_apps_Dialer-def8100bfce62eaa16d150430c6f99e6a3d8afa1.zip
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')
-rw-r--r--java/com/android/incallui/videotech/ims/ImsVideoTech.java20
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(