diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 496244300..e9e12d7e3 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -81,6 +81,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe private static final List END_CARD = Arrays.asList( RtpEndUserState.APPLICATION_ERROR, + RtpEndUserState.SECURITY_ERROR, RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.CONNECTIVITY_ERROR, RtpEndUserState.CONNECTIVITY_LOST_ERROR, @@ -88,7 +89,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe ); private static final List STATES_SHOWING_HELP_BUTTON = Arrays.asList( RtpEndUserState.APPLICATION_ERROR, - RtpEndUserState.CONNECTIVITY_ERROR + RtpEndUserState.CONNECTIVITY_ERROR, + RtpEndUserState.SECURITY_ERROR ); private static final List STATES_SHOWING_SWITCH_TO_CHAT = Arrays.asList( RtpEndUserState.CONNECTING, @@ -668,6 +670,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe case APPLICATION_ERROR: setTitle(R.string.rtp_state_application_failure); break; + case SECURITY_ERROR: + setTitle(R.string.rtp_state_security_error); + break; case ENDED: throw new IllegalStateException("Activity should have called finishAndReleaseWakeLock();"); default: @@ -743,7 +748,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe RtpEndUserState.CONNECTIVITY_ERROR, RtpEndUserState.CONNECTIVITY_LOST_ERROR, RtpEndUserState.APPLICATION_ERROR, - RtpEndUserState.RETRACTED + RtpEndUserState.RETRACTED, + RtpEndUserState.SECURITY_ERROR ).contains(state)) { this.binding.rejectCall.setContentDescription(getString(R.string.exit)); this.binding.rejectCall.setOnClickListener(this::exit); @@ -928,7 +934,11 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe if (isPictureInPicture()) { binding.appBarLayout.setVisibility(View.GONE); binding.pipPlaceholder.setVisibility(View.VISIBLE); - if (state == RtpEndUserState.APPLICATION_ERROR || state == RtpEndUserState.CONNECTIVITY_ERROR) { + if (Arrays.asList( + RtpEndUserState.APPLICATION_ERROR, + RtpEndUserState.CONNECTIVITY_ERROR, + RtpEndUserState.SECURITY_ERROR) + .contains(state)) { binding.pipWarning.setVisibility(View.VISIBLE); binding.pipWaiting.setVisibility(View.GONE); } else { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java index fcacd35d2..90f06fe26 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java @@ -136,6 +136,7 @@ public abstract class AbstractJingleConnection { TERMINATED_DECLINED_OR_BUSY, //equal to 'ENDED' (after other party declined the call) TERMINATED_CONNECTIVITY_ERROR, //equal to 'ENDED' (but after network failures; ui will display retry button) TERMINATED_CANCEL_OR_TIMEOUT, //more or less the same as retracted; caller pressed end call before session was accepted - TERMINATED_APPLICATION_FAILURE + TERMINATED_APPLICATION_FAILURE, + TERMINATED_SECURITY_ERROR } } 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 1f9eeb3c4..80133268e 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -71,7 +71,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_CONNECTIVITY_ERROR, State.TERMINATED_CANCEL_OR_TIMEOUT, - State.TERMINATED_APPLICATION_FAILURE + State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR ); private static final Map> VALID_TRANSITIONS; @@ -81,7 +82,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web transitionBuilder.put(State.NULL, ImmutableList.of( State.PROPOSED, State.SESSION_INITIALIZED, - State.TERMINATED_APPLICATION_FAILURE + State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR )); transitionBuilder.put(State.PROPOSED, ImmutableList.of( State.ACCEPTED, @@ -89,6 +91,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web State.REJECTED, State.RETRACTED, State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR, State.TERMINATED_CONNECTIVITY_ERROR //only used when the xmpp connection rebinds )); transitionBuilder.put(State.PROCEED, ImmutableList.of( @@ -97,6 +100,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web State.SESSION_INITIALIZED_PRE_APPROVED, State.TERMINATED_SUCCESS, State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR, State.TERMINATED_CONNECTIVITY_ERROR //at this state used for error bounces of the proceed message )); transitionBuilder.put(State.SESSION_INITIALIZED, ImmutableList.of( @@ -105,7 +109,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_CONNECTIVITY_ERROR, //at this state used for IQ errors and IQ timeouts State.TERMINATED_CANCEL_OR_TIMEOUT, - State.TERMINATED_APPLICATION_FAILURE + State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR )); transitionBuilder.put(State.SESSION_INITIALIZED_PRE_APPROVED, ImmutableList.of( State.SESSION_ACCEPTED, @@ -113,14 +118,16 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_CONNECTIVITY_ERROR, //at this state used for IQ errors and IQ timeouts State.TERMINATED_CANCEL_OR_TIMEOUT, - State.TERMINATED_APPLICATION_FAILURE + State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR )); transitionBuilder.put(State.SESSION_ACCEPTED, ImmutableList.of( State.TERMINATED_SUCCESS, State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_CONNECTIVITY_ERROR, State.TERMINATED_CANCEL_OR_TIMEOUT, - State.TERMINATED_APPLICATION_FAILURE + State.TERMINATED_APPLICATION_FAILURE, + State.TERMINATED_SECURITY_ERROR )); VALID_TRANSITIONS = transitionBuilder.build(); } @@ -164,8 +171,9 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web case CANCEL: case TIMEOUT: return State.TERMINATED_CANCEL_OR_TIMEOUT; - case FAILED_APPLICATION: case SECURITY_ERROR: + return State.TERMINATED_SECURITY_ERROR; + case FAILED_APPLICATION: case UNSUPPORTED_TRANSPORTS: case UNSUPPORTED_APPLICATIONS: return State.TERMINATED_APPLICATION_FAILURE; @@ -959,6 +967,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web return rtpConnectionStarted == 0 ? RtpEndUserState.CONNECTIVITY_ERROR : RtpEndUserState.CONNECTIVITY_LOST_ERROR; case TERMINATED_APPLICATION_FAILURE: return RtpEndUserState.APPLICATION_ERROR; + case TERMINATED_SECURITY_ERROR: + return RtpEndUserState.SECURITY_ERROR; } throw new IllegalStateException(String.format("%s has no equivalent EndUserState", this.state)); } 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 3b97fcbc7..61536bb7c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java @@ -13,5 +13,6 @@ public enum RtpEndUserState { 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 + APPLICATION_ERROR, //something rather bad happened; libwebrtc failed or we got in IQ-error + SECURITY_ERROR //problem with DTLS (missing) or verification } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 2db8b1da3..c9ad3d891 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -912,6 +912,7 @@ Connection lost Retracted call App failure + Verification problem Hang up Ongoing call Ongoing video call