a/v calls: seperate out SECURITY error from APP_FAILURE

This commit is contained in:
arnebv 2021-06-27 03:32:03 +02:00
parent de2a3d1746
commit c242755bdc
5 changed files with 35 additions and 12 deletions

View file

@ -82,6 +82,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private static final List<RtpEndUserState> END_CARD = Arrays.asList(
RtpEndUserState.APPLICATION_ERROR,
RtpEndUserState.SECURITY_ERROR,
RtpEndUserState.DECLINED_OR_BUSY,
RtpEndUserState.CONNECTIVITY_ERROR,
RtpEndUserState.CONNECTIVITY_LOST_ERROR,
@ -89,7 +90,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
);
private static final List<RtpEndUserState> STATES_SHOWING_HELP_BUTTON = Arrays.asList(
RtpEndUserState.APPLICATION_ERROR,
RtpEndUserState.CONNECTIVITY_ERROR
RtpEndUserState.CONNECTIVITY_ERROR,
RtpEndUserState.SECURITY_ERROR
);
private static final List<RtpEndUserState> STATES_SHOWING_SWITCH_TO_CHAT = Arrays.asList(
RtpEndUserState.CONNECTING,
@ -681,6 +683,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
shouldAllowBack = true;
setTitle(R.string.rtp_state_application_failure);
break;
case SECURITY_ERROR:
setTitle(R.string.rtp_state_security_error);
break;
case ENDED:
shouldAllowBack = true;
throw new IllegalStateException("Activity should have called finishAndReleaseWakeLock();");
@ -757,7 +762,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);
@ -940,9 +946,13 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
binding.remoteVideo.release();
binding.pipLocalMicOffIndicator.setVisibility(View.GONE);
if (isPictureInPicture()) {
if (Arrays.asList(
RtpEndUserState.APPLICATION_ERROR,
RtpEndUserState.CONNECTIVITY_ERROR,
RtpEndUserState.SECURITY_ERROR)
.contains(state)) {
binding.appBarLayout.setVisibility(View.GONE);
binding.pipPlaceholder.setVisibility(View.VISIBLE);
if (state == RtpEndUserState.APPLICATION_ERROR || state == RtpEndUserState.CONNECTIVITY_ERROR) {
binding.pipWarning.setVisibility(View.VISIBLE);
binding.pipWaiting.setVisibility(View.GONE);
} 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_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
}
}

View file

@ -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<State, Collection<State>> 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;
@ -961,6 +969,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));
}

View file

@ -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
}

View file

@ -1044,6 +1044,7 @@
<string name="rtp_state_connectivity_lost_error">Connection lost</string>
<string name="rtp_state_retracted">Retracted call</string>
<string name="rtp_state_application_failure">Application failure</string>
<string name="rtp_state_security_error">Verification problem</string>
<string name="incoming_call_duration">%s · Incoming call · %s</string>
<string name="incoming_call_time">%s · Incoming call</string>
<string name="incoming_call">Incoming call</string>