a/v calls: seperate out SECURITY error from APP_FAILURE

until now problems with verifying the call (omemo or DTLS missing) would
just be another app failure. This commit displays verifications problems as
their own thing.
This commit is contained in:
Daniel Gultsch 2021-05-04 10:10:30 +02:00
parent 905489e237
commit 48156dd27f
5 changed files with 34 additions and 11 deletions

View File

@ -81,6 +81,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private static final List<RtpEndUserState> END_CARD = Arrays.asList( private static final List<RtpEndUserState> END_CARD = Arrays.asList(
RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.APPLICATION_ERROR,
RtpEndUserState.SECURITY_ERROR,
RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.DECLINED_OR_BUSY,
RtpEndUserState.CONNECTIVITY_ERROR, RtpEndUserState.CONNECTIVITY_ERROR,
RtpEndUserState.CONNECTIVITY_LOST_ERROR, RtpEndUserState.CONNECTIVITY_LOST_ERROR,
@ -88,7 +89,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
); );
private static final List<RtpEndUserState> STATES_SHOWING_HELP_BUTTON = Arrays.asList( private static final List<RtpEndUserState> STATES_SHOWING_HELP_BUTTON = Arrays.asList(
RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.APPLICATION_ERROR,
RtpEndUserState.CONNECTIVITY_ERROR RtpEndUserState.CONNECTIVITY_ERROR,
RtpEndUserState.SECURITY_ERROR
); );
private static final List<RtpEndUserState> STATES_SHOWING_SWITCH_TO_CHAT = Arrays.asList( private static final List<RtpEndUserState> STATES_SHOWING_SWITCH_TO_CHAT = Arrays.asList(
RtpEndUserState.CONNECTING, RtpEndUserState.CONNECTING,
@ -668,6 +670,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
case APPLICATION_ERROR: case APPLICATION_ERROR:
setTitle(R.string.rtp_state_application_failure); setTitle(R.string.rtp_state_application_failure);
break; break;
case SECURITY_ERROR:
setTitle(R.string.rtp_state_security_error);
break;
case ENDED: case ENDED:
throw new IllegalStateException("Activity should have called finishAndReleaseWakeLock();"); throw new IllegalStateException("Activity should have called finishAndReleaseWakeLock();");
default: default:
@ -743,7 +748,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
RtpEndUserState.CONNECTIVITY_ERROR, RtpEndUserState.CONNECTIVITY_ERROR,
RtpEndUserState.CONNECTIVITY_LOST_ERROR, RtpEndUserState.CONNECTIVITY_LOST_ERROR,
RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.APPLICATION_ERROR,
RtpEndUserState.RETRACTED RtpEndUserState.RETRACTED,
RtpEndUserState.SECURITY_ERROR
).contains(state)) { ).contains(state)) {
this.binding.rejectCall.setContentDescription(getString(R.string.exit)); this.binding.rejectCall.setContentDescription(getString(R.string.exit));
this.binding.rejectCall.setOnClickListener(this::exit); this.binding.rejectCall.setOnClickListener(this::exit);
@ -928,7 +934,11 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
if (isPictureInPicture()) { if (isPictureInPicture()) {
binding.appBarLayout.setVisibility(View.GONE); binding.appBarLayout.setVisibility(View.GONE);
binding.pipPlaceholder.setVisibility(View.VISIBLE); 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.pipWarning.setVisibility(View.VISIBLE);
binding.pipWaiting.setVisibility(View.GONE); binding.pipWaiting.setVisibility(View.GONE);
} else { } else {

View File

@ -136,6 +136,7 @@ public abstract class AbstractJingleConnection {
TERMINATED_DECLINED_OR_BUSY, //equal to 'ENDED' (after other party declined the call) 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_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_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
} }
} }

View File

@ -71,7 +71,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_DECLINED_OR_BUSY,
State.TERMINATED_CONNECTIVITY_ERROR, State.TERMINATED_CONNECTIVITY_ERROR,
State.TERMINATED_CANCEL_OR_TIMEOUT, State.TERMINATED_CANCEL_OR_TIMEOUT,
State.TERMINATED_APPLICATION_FAILURE State.TERMINATED_APPLICATION_FAILURE,
State.TERMINATED_SECURITY_ERROR
); );
private static final Map<State, Collection<State>> VALID_TRANSITIONS; private static final Map<State, Collection<State>> VALID_TRANSITIONS;
@ -81,7 +82,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
transitionBuilder.put(State.NULL, ImmutableList.of( transitionBuilder.put(State.NULL, ImmutableList.of(
State.PROPOSED, State.PROPOSED,
State.SESSION_INITIALIZED, State.SESSION_INITIALIZED,
State.TERMINATED_APPLICATION_FAILURE State.TERMINATED_APPLICATION_FAILURE,
State.TERMINATED_SECURITY_ERROR
)); ));
transitionBuilder.put(State.PROPOSED, ImmutableList.of( transitionBuilder.put(State.PROPOSED, ImmutableList.of(
State.ACCEPTED, State.ACCEPTED,
@ -89,6 +91,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
State.REJECTED, State.REJECTED,
State.RETRACTED, State.RETRACTED,
State.TERMINATED_APPLICATION_FAILURE, State.TERMINATED_APPLICATION_FAILURE,
State.TERMINATED_SECURITY_ERROR,
State.TERMINATED_CONNECTIVITY_ERROR //only used when the xmpp connection rebinds State.TERMINATED_CONNECTIVITY_ERROR //only used when the xmpp connection rebinds
)); ));
transitionBuilder.put(State.PROCEED, ImmutableList.of( transitionBuilder.put(State.PROCEED, ImmutableList.of(
@ -97,6 +100,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
State.SESSION_INITIALIZED_PRE_APPROVED, State.SESSION_INITIALIZED_PRE_APPROVED,
State.TERMINATED_SUCCESS, State.TERMINATED_SUCCESS,
State.TERMINATED_APPLICATION_FAILURE, State.TERMINATED_APPLICATION_FAILURE,
State.TERMINATED_SECURITY_ERROR,
State.TERMINATED_CONNECTIVITY_ERROR //at this state used for error bounces of the proceed message State.TERMINATED_CONNECTIVITY_ERROR //at this state used for error bounces of the proceed message
)); ));
transitionBuilder.put(State.SESSION_INITIALIZED, ImmutableList.of( 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_DECLINED_OR_BUSY,
State.TERMINATED_CONNECTIVITY_ERROR, //at this state used for IQ errors and IQ timeouts State.TERMINATED_CONNECTIVITY_ERROR, //at this state used for IQ errors and IQ timeouts
State.TERMINATED_CANCEL_OR_TIMEOUT, 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( transitionBuilder.put(State.SESSION_INITIALIZED_PRE_APPROVED, ImmutableList.of(
State.SESSION_ACCEPTED, State.SESSION_ACCEPTED,
@ -113,14 +118,16 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_DECLINED_OR_BUSY,
State.TERMINATED_CONNECTIVITY_ERROR, //at this state used for IQ errors and IQ timeouts State.TERMINATED_CONNECTIVITY_ERROR, //at this state used for IQ errors and IQ timeouts
State.TERMINATED_CANCEL_OR_TIMEOUT, State.TERMINATED_CANCEL_OR_TIMEOUT,
State.TERMINATED_APPLICATION_FAILURE State.TERMINATED_APPLICATION_FAILURE,
State.TERMINATED_SECURITY_ERROR
)); ));
transitionBuilder.put(State.SESSION_ACCEPTED, ImmutableList.of( transitionBuilder.put(State.SESSION_ACCEPTED, ImmutableList.of(
State.TERMINATED_SUCCESS, State.TERMINATED_SUCCESS,
State.TERMINATED_DECLINED_OR_BUSY, State.TERMINATED_DECLINED_OR_BUSY,
State.TERMINATED_CONNECTIVITY_ERROR, State.TERMINATED_CONNECTIVITY_ERROR,
State.TERMINATED_CANCEL_OR_TIMEOUT, State.TERMINATED_CANCEL_OR_TIMEOUT,
State.TERMINATED_APPLICATION_FAILURE State.TERMINATED_APPLICATION_FAILURE,
State.TERMINATED_SECURITY_ERROR
)); ));
VALID_TRANSITIONS = transitionBuilder.build(); VALID_TRANSITIONS = transitionBuilder.build();
} }
@ -164,8 +171,9 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
case CANCEL: case CANCEL:
case TIMEOUT: case TIMEOUT:
return State.TERMINATED_CANCEL_OR_TIMEOUT; return State.TERMINATED_CANCEL_OR_TIMEOUT;
case FAILED_APPLICATION:
case SECURITY_ERROR: case SECURITY_ERROR:
return State.TERMINATED_SECURITY_ERROR;
case FAILED_APPLICATION:
case UNSUPPORTED_TRANSPORTS: case UNSUPPORTED_TRANSPORTS:
case UNSUPPORTED_APPLICATIONS: case UNSUPPORTED_APPLICATIONS:
return State.TERMINATED_APPLICATION_FAILURE; 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; return rtpConnectionStarted == 0 ? RtpEndUserState.CONNECTIVITY_ERROR : RtpEndUserState.CONNECTIVITY_LOST_ERROR;
case TERMINATED_APPLICATION_FAILURE: case TERMINATED_APPLICATION_FAILURE:
return RtpEndUserState.APPLICATION_ERROR; return RtpEndUserState.APPLICATION_ERROR;
case TERMINATED_SECURITY_ERROR:
return RtpEndUserState.SECURITY_ERROR;
} }
throw new IllegalStateException(String.format("%s has no equivalent EndUserState", this.state)); throw new IllegalStateException(String.format("%s has no equivalent EndUserState", this.state));
} }

View File

@ -13,5 +13,6 @@ public enum RtpEndUserState {
CONNECTIVITY_ERROR, //network error; retry button CONNECTIVITY_ERROR, //network error; retry button
CONNECTIVITY_LOST_ERROR, //network error but for call duration > 0 CONNECTIVITY_LOST_ERROR, //network error but for call duration > 0
RETRACTED, //user pressed home or power button during 'ringing' - shows retry button 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
} }

View File

@ -912,6 +912,7 @@
<string name="rtp_state_connectivity_lost_error">Connection lost</string> <string name="rtp_state_connectivity_lost_error">Connection lost</string>
<string name="rtp_state_retracted">Retracted call</string> <string name="rtp_state_retracted">Retracted call</string>
<string name="rtp_state_application_failure">App failure</string> <string name="rtp_state_application_failure">App failure</string>
<string name="rtp_state_security_error">Verification problem</string>
<string name="hang_up">Hang up</string> <string name="hang_up">Hang up</string>
<string name="ongoing_call">Ongoing call</string> <string name="ongoing_call">Ongoing call</string>
<string name="ongoing_video_call">Ongoing video call</string> <string name="ongoing_video_call">Ongoing video call</string>