fix system feature detection for call integration
This commit is contained in:
parent
72d194d8ff
commit
3d5d257707
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue