Change summary
src/main/java/eu/siacs/conversations/services/CallIntegration.java | 11
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 12
2 files changed, 18 insertions(+), 5 deletions(-)
Detailed changes
@@ -447,9 +447,16 @@ public class CallIntegration extends Connection {
}
public static boolean selfManaged(final Context context) {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && hasSystemFeature(context);
+ }
+
+ public static boolean hasSystemFeature(final Context context) {
final var packageManager = context.getPackageManager();
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
- && packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ return packageManager.hasSystemFeature(PackageManager.FEATURE_TELECOM);
+ } else {
+ return packageManager.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE);
+ }
}
public static boolean notSelfManaged(final Context context) {
@@ -1286,7 +1286,9 @@ public class XmppConnectionService extends Service {
toggleSetProfilePictureActivity(hasEnabledAccounts);
reconfigurePushDistributor();
- CallIntegrationConnectionService.togglePhoneAccountsAsync(this, this.accounts);
+ if (CallIntegration.hasSystemFeature(this)) {
+ CallIntegrationConnectionService.togglePhoneAccountsAsync(this, this.accounts);
+ }
restoreFromDatabase();
@@ -2465,7 +2467,9 @@ public class XmppConnectionService extends Service {
public void createAccount(final Account account) {
account.initAccountServices(this);
databaseBackend.createAccount(account);
- CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
+ if (CallIntegration.hasSystemFeature(this)) {
+ CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
+ }
this.accounts.add(account);
this.reconnectAccountInBackground(account);
updateAccountUi();
@@ -2589,7 +2593,9 @@ public class XmppConnectionService extends Service {
toggleForegroundService();
syncEnabledAccountSetting();
mChannelDiscoveryService.cleanCache();
- CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
+ if (CallIntegration.hasSystemFeature(this)) {
+ CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
+ }
return true;
} else {
return false;