From d375262dd8f224d849e06cd144a31e24e9cf5bed Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 23 Feb 2022 23:02:47 -0500 Subject: [PATCH] Passing through initializing -> inititalized -> dialling more stable Rather than starting right at dialling, which seemed to cause sometimes delays in the in call screen appearing and also a different behaviour when a post dial string was present, passing through all the states with some time in between seems to result in a more stable and consistent UX with no change to functionality. --- .../cheogram/android/ConnectionService.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/cheogram/java/com/cheogram/android/ConnectionService.java b/src/cheogram/java/com/cheogram/android/ConnectionService.java index a8208be048f0c0c7259e18608902f8ebab950c8f..82ad0f4c2cd48bb8019dd7a2ff9383dd3b4f272b 100644 --- a/src/cheogram/java/com/cheogram/android/ConnectionService.java +++ b/src/cheogram/java/com/cheogram/android/ConnectionService.java @@ -126,20 +126,11 @@ public class ConnectionService extends android.telecom.ConnectionService { } }); + connection.setInitializing(); connection.setAddress( Uri.fromParts("tel", tel, null), // Normalized tel as tel: URI TelecomManager.PRESENTATION_ALLOWED ); - connection.setCallerDisplayName( - account.getDisplayName(), - TelecomManager.PRESENTATION_ALLOWED - ); - connection.setAudioModeIsVoip(true); - connection.setRingbackRequested(true); - connection.setDialing(); - connection.setConnectionCapabilities( - Connection.CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION - ); xmppConnectionService.setOnRtpConnectionUpdateListener( (XmppConnectionService.OnJingleRtpConnectionUpdate) connection @@ -172,6 +163,15 @@ public class ConnectionService extends android.telecom.ConnectionService { postDial.push("" + postDialString.charAt(i)); } } + + setCallerDisplayName( + account.getDisplayName(), + TelecomManager.PRESENTATION_ALLOWED + ); + setAudioModeIsVoip(true); + setConnectionCapabilities( + Connection.CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION + ); } public void setSessionId(final String sessionId) { @@ -188,7 +188,11 @@ public class ConnectionService extends android.telecom.ConnectionService { setStatusHints(new StatusHints(null, gatewayIcon, null)); - if (state == RtpEndUserState.CONNECTED) { + if (state == RtpEndUserState.FINDING_DEVICE) { + setInitialized(); + } else if (state == RtpEndUserState.RINGING) { + setDialing(); + } else if (state == RtpEndUserState.CONNECTED) { xmppConnectionService.setDiallerIntegrationActive(true); setActive();