Always try dialler integration if enabled

Stephen Paul Weber created

Whereas call integration (true self managed) sometimes is blacklisted.

Change summary

src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java | 8 
src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java           | 6 
2 files changed, 6 insertions(+), 8 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java 🔗

@@ -394,7 +394,7 @@ public class CallIntegrationConnectionService extends ConnectionService {
     private static ArrayList<PhoneAccountHandle> findPhoneAccount(final Context context, final AbstractJingleConnection.Id id) {
         final var def = CallIntegrationConnectionService.getHandle(context, id.account);
         final var lst = new ArrayList<PhoneAccountHandle>();
-        lst.add(def);
+        if (CallIntegration.selfManaged(context)) lst.add(def);
         if (Build.VERSION.SDK_INT < 23) return lst;
 
         final var prefs = PreferenceManager.getDefaultSharedPreferences(context);
@@ -433,7 +433,8 @@ public class CallIntegrationConnectionService extends ConnectionService {
     public static boolean addNewIncomingCall(
             final Context context, final AbstractJingleConnection.Id id) {
         if (NotificationService.isQuietHours(context, id.getContact().getAccount())) return true;
-        if (CallIntegration.notSelfManaged(context)) {
+        final var phoneAccountHandles = findPhoneAccount(context, id);
+        if (phoneAccountHandles.isEmpty()) {
             Log.d(
                     Config.LOGTAG,
                     "not adding incoming call to TelecomManager on Android "
@@ -441,9 +442,8 @@ public class CallIntegrationConnectionService extends ConnectionService {
                             + " ("
                             + Build.DEVICE
                             + ")");
-            return true;
+            return false;
         }
-        final var phoneAccountHandles = findPhoneAccount(context, id);
         final var bundle = new Bundle();
         bundle.putString(
                 TelecomManager.EXTRA_INCOMING_CALL_ADDRESS,

src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java 🔗

@@ -1702,10 +1702,8 @@ public class JingleRtpConnection extends AbstractJingleConnection
         ringingTimeoutFuture =
                 jingleConnectionManager.schedule(
                         this::ringingTimeout, BUSY_TIME_OUT, TimeUnit.SECONDS);
-        if (CallIntegration.selfManaged(xmppConnectionService)) {
-            if (CallIntegrationConnectionService.addNewIncomingCall(xmppConnectionService, getId())) {
-                return;
-            }
+        if (CallIntegrationConnectionService.addNewIncomingCall(xmppConnectionService, getId())) {
+            return;
         }
         xmppConnectionService.getNotificationService().startRinging(id, getMedia());
     }