From f119c36bffa318ca16a78728120fbaf222aeef92 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 15 Jan 2024 12:50:50 +0100 Subject: [PATCH] (un)register phone account on xmpp account creation/deletion --- .../services/CallIntegrationConnectionService.java | 4 ++++ .../siacs/conversations/services/XmppConnectionService.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java index 28f59a060..01f246844 100644 --- a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java @@ -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); diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5f48fca58..41c467b15 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -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();