(un)register phone account on xmpp account creation/deletion

This commit is contained in:
Daniel Gultsch 2024-01-15 12:50:50 +01:00
parent b9e4296321
commit f119c36bff
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 6 additions and 0 deletions

View file

@ -181,6 +181,10 @@ public class CallIntegrationConnectionService extends ConnectionService {
}
}
public static void unregisterPhoneAccount(final Context context, final Account account) {
context.getSystemService(TelecomManager.class).unregisterPhoneAccount(getHandle(context, account));
}
public static PhoneAccountHandle getHandle(final Context context, final Account account) {
final var competentName =
new ComponentName(context, CallIntegrationConnectionService.class);

View file

@ -2460,6 +2460,7 @@ public class XmppConnectionService extends Service {
public void createAccount(final Account account) {
account.initAccountServices(this);
databaseBackend.createAccount(account);
CallIntegrationConnectionService.registerPhoneAccount(this, account);
this.accounts.add(account);
this.reconnectAccountInBackground(account);
updateAccountUi();
@ -2644,6 +2645,7 @@ public class XmppConnectionService extends Service {
};
mDatabaseWriterExecutor.execute(runnable);
this.accounts.remove(account);
CallIntegrationConnectionService.unregisterPhoneAccount(this, account);
this.mRosterSyncTaskManager.clear(account);
updateAccountUi();
mNotificationService.updateErrorNotification();