From 31c627135c4c74ede71c1bd180eb886993046c46 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 21 Apr 2022 21:23:14 -0400 Subject: [PATCH 1/3] Use StatusHint label to signal connecting state --- .../java/com/cheogram/android/ConnectionService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cheogram/java/com/cheogram/android/ConnectionService.java b/src/cheogram/java/com/cheogram/android/ConnectionService.java index 8a68aadd2..71d619aeb 100644 --- a/src/cheogram/java/com/cheogram/android/ConnectionService.java +++ b/src/cheogram/java/com/cheogram/android/ConnectionService.java @@ -235,7 +235,7 @@ public class ConnectionService extends android.telecom.ConnectionService { findRtpConnection(); } - setStatusHints(new StatusHints(null, gatewayIcon, null)); + String statusLabel = null; if (state == RtpEndUserState.FINDING_DEVICE) { setInitialized(); @@ -246,6 +246,7 @@ public class ConnectionService extends android.telecom.ConnectionService { } else if (state == RtpEndUserState.CONNECTING) { xmppConnectionService.setDiallerIntegrationActive(true); setActive(); + statusLabel = getString(R.string.rtp_state_connecting); } else if (state == RtpEndUserState.CONNECTED) { postDial(); } else if (state == RtpEndUserState.DECLINED_OR_BUSY) { @@ -257,6 +258,8 @@ public class ConnectionService extends android.telecom.ConnectionService { } else if (RtpSessionActivity.END_CARD.contains(state)) { close(new DisconnectCause(DisconnectCause.ERROR)); } + + setStatusHints(new StatusHints(statusLabel, gatewayIcon, null)); } @Override From 9945e4bf093bf7faa3551a9449797eedaab480c7 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 21 Apr 2022 21:24:27 -0400 Subject: [PATCH 2/3] Add @RequiresApi annotation for dialer integration to stop the linter complaining every second line of code --- src/cheogram/java/com/cheogram/android/ConnectionService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cheogram/java/com/cheogram/android/ConnectionService.java b/src/cheogram/java/com/cheogram/android/ConnectionService.java index 71d619aeb..8bc429dcf 100644 --- a/src/cheogram/java/com/cheogram/android/ConnectionService.java +++ b/src/cheogram/java/com/cheogram/android/ConnectionService.java @@ -22,6 +22,8 @@ import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.Manifest; + +import androidx.annotation.RequiresApi; import androidx.core.content.ContextCompat; import android.content.ComponentName; import android.content.Context; @@ -53,6 +55,7 @@ import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; +@RequiresApi(Build.VERSION_CODES.M) public class ConnectionService extends android.telecom.ConnectionService { public XmppConnectionService xmppConnectionService = null; protected ServiceConnection mConnection = new ServiceConnection() { From 3096f859ac15703e8106f6e09ecb47fc8127e4ad Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 21 Apr 2022 21:28:38 -0400 Subject: [PATCH 3/3] Call setActive anyway in CONNECTED state There is no code that guarantees the state must go through CONNECTING before being CONNECTED. To avoid potential bugs, call setActive anyway here. --- src/cheogram/java/com/cheogram/android/ConnectionService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cheogram/java/com/cheogram/android/ConnectionService.java b/src/cheogram/java/com/cheogram/android/ConnectionService.java index 8bc429dcf..0f5dfa172 100644 --- a/src/cheogram/java/com/cheogram/android/ConnectionService.java +++ b/src/cheogram/java/com/cheogram/android/ConnectionService.java @@ -251,6 +251,8 @@ public class ConnectionService extends android.telecom.ConnectionService { setActive(); statusLabel = getString(R.string.rtp_state_connecting); } else if (state == RtpEndUserState.CONNECTED) { + xmppConnectionService.setDiallerIntegrationActive(true); + setActive(); postDial(); } else if (state == RtpEndUserState.DECLINED_OR_BUSY) { close(new DisconnectCause(DisconnectCause.BUSY));