Fix pause / unpause in the scenario where calls are swapped
The previous fix (cl/159623587) has a regression in this scenario:
Device A: video call Device B
Device B: accept video call
Device B: go into background (press Home)
Device A: go into background (press Home)
Device B: return to foreground (return to call)
Unexpected result: A is transmitting video even though it has not returned to the foreground as well
Bug: 62784036,38359325
Test: manual
PiperOrigin-RevId: 160013824
Change-Id: I6e9c89c8fa52882c49d32e061032b93b1e8552f0
diff --git a/java/com/android/incallui/VideoPauseController.java b/java/com/android/incallui/VideoPauseController.java
index 2595e2f..36c9ef3 100644
--- a/java/com/android/incallui/VideoPauseController.java
+++ b/java/com/android/incallui/VideoPauseController.java
@@ -66,11 +66,6 @@
return sVideoPauseController;
}
- private boolean wasIncomingCall() {
- return (mPrevCallState == DialerCall.State.CALL_WAITING
- || mPrevCallState == DialerCall.State.INCOMING);
- }
-
/**
* Determines if a call is in incoming/waiting state.
*
@@ -198,7 +193,7 @@
}
final boolean canVideoPause = videoCanPause(call);
- if ((wasIncomingCall() || wasDialing()) && canVideoPause && !mIsInBackground) {
+ if (canVideoPause && !mIsInBackground) {
// Send resume request for the active call, if user rejects incoming call, ends dialing
// call, or the call was previously in a paused state and UI is in the foreground.
sendRequest(call, true);
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
index f4e0a01..b839293 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
@@ -173,11 +173,9 @@
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 4e74439..99d812a 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java
@@ -269,24 +269,6 @@
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