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) {
|
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();
|
final var packageManager = context.getPackageManager();
|
||||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
&& packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
|
return packageManager.hasSystemFeature(PackageManager.FEATURE_TELECOM);
|
||||||
|
} else {
|
||||||
|
return packageManager.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean notSelfManaged(final Context context) {
|
public static boolean notSelfManaged(final Context context) {
|
||||||
|
|
|
@ -1286,7 +1286,9 @@ public class XmppConnectionService extends Service {
|
||||||
toggleSetProfilePictureActivity(hasEnabledAccounts);
|
toggleSetProfilePictureActivity(hasEnabledAccounts);
|
||||||
reconfigurePushDistributor();
|
reconfigurePushDistributor();
|
||||||
|
|
||||||
CallIntegrationConnectionService.togglePhoneAccountsAsync(this, this.accounts);
|
if (CallIntegration.hasSystemFeature(this)) {
|
||||||
|
CallIntegrationConnectionService.togglePhoneAccountsAsync(this, this.accounts);
|
||||||
|
}
|
||||||
|
|
||||||
restoreFromDatabase();
|
restoreFromDatabase();
|
||||||
|
|
||||||
|
@ -2465,7 +2467,9 @@ public class XmppConnectionService extends Service {
|
||||||
public void createAccount(final Account account) {
|
public void createAccount(final Account account) {
|
||||||
account.initAccountServices(this);
|
account.initAccountServices(this);
|
||||||
databaseBackend.createAccount(account);
|
databaseBackend.createAccount(account);
|
||||||
CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
|
if (CallIntegration.hasSystemFeature(this)) {
|
||||||
|
CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
|
||||||
|
}
|
||||||
this.accounts.add(account);
|
this.accounts.add(account);
|
||||||
this.reconnectAccountInBackground(account);
|
this.reconnectAccountInBackground(account);
|
||||||
updateAccountUi();
|
updateAccountUi();
|
||||||
|
@ -2589,7 +2593,9 @@ public class XmppConnectionService extends Service {
|
||||||
toggleForegroundService();
|
toggleForegroundService();
|
||||||
syncEnabledAccountSetting();
|
syncEnabledAccountSetting();
|
||||||
mChannelDiscoveryService.cleanCache();
|
mChannelDiscoveryService.cleanCache();
|
||||||
CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
|
if (CallIntegration.hasSystemFeature(this)) {
|
||||||
|
CallIntegrationConnectionService.togglePhoneAccountAsync(this, account);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue