From 644ad995204d7fc06ff7a39621d45fa2dae82109 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 12 Jun 2020 07:56:59 +0200 Subject: [PATCH] create rtp end user state for connection lost. fixes #3769 --- .../eu/siacs/conversations/ui/RtpSessionActivity.java | 11 ++++++++++- .../xmpp/jingle/JingleRtpConnection.java | 4 ++-- .../conversations/xmpp/jingle/RtpEndUserState.java | 1 + src/main/res/values/strings.xml | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 9cfda2174..848c447a1 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -78,6 +78,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.CONNECTIVITY_ERROR, + RtpEndUserState.CONNECTIVITY_LOST_ERROR, RtpEndUserState.RETRACTED ); private static final String PROXIMITY_WAKE_LOCK_TAG = "conversations:in-rtp-session"; @@ -533,6 +534,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe case CONNECTIVITY_ERROR: setTitle(R.string.rtp_state_connectivity_error); break; + case CONNECTIVITY_LOST_ERROR: + setTitle(R.string.rtp_state_connectivity_lost_error); + break; case RETRACTED: setTitle(R.string.rtp_state_retracted); break; @@ -598,7 +602,12 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe this.binding.acceptCall.setOnClickListener(this::recordVoiceMail); this.binding.acceptCall.setImageResource(R.drawable.ic_voicemail_white_24dp); this.binding.acceptCall.setVisibility(View.VISIBLE); - } else if (asList(RtpEndUserState.CONNECTIVITY_ERROR, RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.RETRACTED).contains(state)) { + } else if (asList( + RtpEndUserState.CONNECTIVITY_ERROR, + RtpEndUserState.CONNECTIVITY_LOST_ERROR, + RtpEndUserState.APPLICATION_ERROR, + RtpEndUserState.RETRACTED + ).contains(state)) { this.binding.rejectCall.setOnClickListener(this::exit); this.binding.rejectCall.setImageResource(R.drawable.ic_clear_white_48dp); this.binding.rejectCall.setVisibility(View.VISIBLE); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index 2f8486faa..4dadb599d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -814,7 +814,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web } else if (state == PeerConnection.PeerConnectionState.CLOSED) { return RtpEndUserState.ENDING_CALL; } else { - return RtpEndUserState.CONNECTIVITY_ERROR; + return rtpConnectionStarted == 0 ? RtpEndUserState.CONNECTIVITY_ERROR : RtpEndUserState.CONNECTIVITY_LOST_ERROR; } case REJECTED: case TERMINATED_DECLINED_OR_BUSY: @@ -831,7 +831,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web case RETRACTED_RACED: return RtpEndUserState.RETRACTED; case TERMINATED_CONNECTIVITY_ERROR: - return RtpEndUserState.CONNECTIVITY_ERROR; + return rtpConnectionStarted == 0 ? RtpEndUserState.CONNECTIVITY_ERROR : RtpEndUserState.CONNECTIVITY_LOST_ERROR; case TERMINATED_APPLICATION_FAILURE: return RtpEndUserState.APPLICATION_ERROR; } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java index 398777cfe..3b97fcbc7 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java @@ -11,6 +11,7 @@ public enum RtpEndUserState { ENDED, //close UI DECLINED_OR_BUSY, //other party declined; no retry button CONNECTIVITY_ERROR, //network error; retry button + CONNECTIVITY_LOST_ERROR, //network error but for call duration > 0 RETRACTED, //user pressed home or power button during 'ringing' - shows retry button APPLICATION_ERROR //something rather bad happened; libwebrtc failed or we got in IQ-error } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 679e37006..a6d951b56 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -903,6 +903,7 @@ Ringing Busy Could not connect call + Connection lost Retracted call App failure Hang up