From 821e655e1db08fa679974b9e529586b0d377d1ab Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 27 Dec 2022 21:03:02 -0500 Subject: [PATCH] Do not try to use phone accounts if system does not support them --- src/main/java/eu/siacs/conversations/entities/Contact.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index 6da9283f982613af3a9673cc3a8ab76d9c4fdbb3..ea411212aa87eaef5d01e2c62f45aceacc10c387 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -3,6 +3,7 @@ package eu.siacs.conversations.entities; import android.content.ComponentName; import android.content.ContentValues; import android.content.Context; +import android.content.pm.PackageManager; import android.database.Cursor; import android.graphics.drawable.Icon; import android.net.Uri; @@ -632,6 +633,7 @@ public class Contact implements ListItem, Blockable { // This Contact is a gateway to use for voice calls, register it with OS public void registerAsPhoneAccount(XmppConnectionService ctx) { if (Build.VERSION.SDK_INT < 23) return; + if (!ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) return; TelecomManager telecomManager = ctx.getSystemService(TelecomManager.class); @@ -656,6 +658,7 @@ public class Contact implements ListItem, Blockable { // Unregister any associated PSTN gateway integration public void unregisterAsPhoneAccount(Context ctx) { if (Build.VERSION.SDK_INT < 23) return; + if (!ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE)) return; TelecomManager telecomManager = ctx.getSystemService(TelecomManager.class); telecomManager.unregisterPhoneAccount(phoneAccountHandle());