Fix error case which session change request failed when pausing video
When a user clicks the pause video button, the camera close request and
the session modify request are executed at the same time. However, the
session modify request fails occasionally by a limitation of the Network
side. In that case, the video session is continued with the camera
closed state and a user cannot open the camera again due to pause video
button disabled.
Remove camera close request triggered by the pause video button clicked
because it is handled appropriately according to the result of the
session modify request. Also, enable the pause video button and show
error message to a user if receiving the error result of the session
modify request.
Test: manual
Bug: 69235524
Change-Id: I9a2dde755a6c28edfb0ce962b55ac8a6e907ca97
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 7d12d52..f49eb2b 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -42,6 +42,7 @@
import com.android.incallui.call.CallList;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCall.CameraDirection;
+import com.android.incallui.call.DialerCallListener;
import com.android.incallui.call.TelecomAdapter;
import com.android.incallui.call.state.DialerCallState;
import com.android.incallui.incall.protocol.InCallButtonIds;
@@ -58,7 +59,8 @@
InCallDetailsListener,
CanAddCallListener,
Listener,
- InCallButtonUiDelegate {
+ InCallButtonUiDelegate,
+ DialerCallListener {
private static final String KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL =
"incall_key_automatically_muted_by_add_call";
@@ -106,11 +108,18 @@
InCallPresenter.getInstance().getInCallCameraManager().removeCameraSelectionListener(this);
InCallPresenter.getInstance().removeCanAddCallListener(this);
isInCallButtonUiReady = false;
+
+ if (call != null) {
+ call.removeListener(this);
+ }
}
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
Trace.beginSection("CallButtonPresenter.onStateChange");
+ if (call != null) {
+ call.removeListener(this);
+ }
if (newState == InCallState.OUTGOING) {
call = callList.getOutgoingCall();
} else if (newState == InCallState.INCALL) {
@@ -133,6 +142,10 @@
} else {
call = null;
}
+
+ if (call != null) {
+ call.addListener(this);
+ }
updateUi(newState, call);
Trace.endSection();
}
@@ -393,7 +406,6 @@
call.getTimeAddedMs());
if (pause) {
- call.getVideoTech().setCamera(null);
call.getVideoTech().stopTransmission();
} else {
updateCamera(
@@ -584,6 +596,41 @@
}
@Override
+ public void onDialerCallSessionModificationStateChange() {
+ if (inCallButtonUi != null && call != null) {
+ inCallButtonUi.enableButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, true);
+ updateButtonsState(call);
+ }
+ }
+
+ @Override
+ public void onDialerCallDisconnect() {}
+
+ @Override
+ public void onDialerCallUpdate() {}
+
+ @Override
+ public void onDialerCallChildNumberChange() {}
+
+ @Override
+ public void onDialerCallLastForwardedNumberChange() {}
+
+ @Override
+ public void onDialerCallUpgradeToVideo() {}
+
+ @Override
+ public void onWiFiToLteHandover() {}
+
+ @Override
+ public void onHandoverToWifiFailure() {}
+
+ @Override
+ public void onInternationalCallOnWifi() {}
+
+ @Override
+ public void onEnrichedCallSessionUpdate() {}
+
+ @Override
public Context getContext() {
return context;
}