diff --git a/src/cheogram/java/com/cheogram/android/ConnectionService.java b/src/cheogram/java/com/cheogram/android/ConnectionService.java index 08091e2d7..ef0e64788 100644 --- a/src/cheogram/java/com/cheogram/android/ConnectionService.java +++ b/src/cheogram/java/com/cheogram/android/ConnectionService.java @@ -136,7 +136,7 @@ public class ConnectionService extends android.telecom.ConnectionService { @Override public void onPermissionDenied(DeniedPermissions deniedPermissions) { - connection.close(new DisconnectCause(DisconnectCause.ERROR)); + connection.setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); } }); @@ -237,13 +237,13 @@ public class ConnectionService extends android.telecom.ConnectionService { postDial(); } else if (state == RtpEndUserState.DECLINED_OR_BUSY) { - close(new DisconnectCause(DisconnectCause.BUSY)); + setDisconnected(new DisconnectCause(DisconnectCause.BUSY)); } else if (state == RtpEndUserState.ENDED) { - close(new DisconnectCause(DisconnectCause.LOCAL)); + setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); } else if (state == RtpEndUserState.RETRACTED) { - close(new DisconnectCause(DisconnectCause.CANCELED)); + setDisconnected(new DisconnectCause(DisconnectCause.CANCELED)); } else if (RtpSessionActivity.END_CARD.contains(state)) { - close(new DisconnectCause(DisconnectCause.ERROR)); + setDisconnected(new DisconnectCause(DisconnectCause.ERROR)); } } @@ -274,31 +274,18 @@ public class ConnectionService extends android.telecom.ConnectionService { rtpConnection.get().acceptCall(); } - @Override - public void onReject() { - this.rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId); - rtpConnection.get().rejectCall(); - close(new DisconnectCause(DisconnectCause.LOCAL)); - } - - // Set the connection to the disconnected state and clean up the resources - // Note that we cannot do this from onStateChanged() because calling destroy - // there seems to trigger a deadlock somewhere in the telephony stack. - public void close(DisconnectCause reason) { - setDisconnected(reason); - destroy(); - xmppConnectionService.setDiallerIntegrationActive(false); - xmppConnectionService.removeRtpConnectionUpdateListener(this); - } - @Override public void onDisconnect() { if (rtpConnection == null || rtpConnection.get() == null) { xmppConnectionService.getJingleConnectionManager().retractSessionProposal(account, with.asBareJid()); - close(new DisconnectCause(DisconnectCause.LOCAL)); } else { rtpConnection.get().endCall(); } + destroy(); + xmppConnectionService.setDiallerIntegrationActive(false); + xmppConnectionService.removeRtpConnectionUpdateListener( + (XmppConnectionService.OnJingleRtpConnectionUpdate) this + ); } @Override diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index 7c4e31416..7a4c2d371 100644 --- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -276,7 +276,7 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected if (type != null && (type.equals("pstn") || type.equals("sms"))) { try { binding.jid.setText(PhoneNumberUtilWrapper.normalize(getActivity(), binding.jid.getText().toString())); - } catch (NumberParseException | IllegalArgumentException | NullPointerException e) { } + } catch (NumberParseException | NullPointerException e) { } } if (p == null) {