From b97e2deaa29dad374c936ca46c2ca0dbb210192c Mon Sep 17 00:00:00 2001 From: Licaon_Kter Date: Wed, 17 Feb 2021 08:45:57 +0000 Subject: [PATCH] Show battery dialogue always --- .../conversations/ui/ConversationsActivity.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 6d0a03f8b..c31c3464b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -221,8 +221,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } private void openBatteryOptimizationDialogIfNeeded() { - if (hasAccountWithoutPush() - && isOptimizingBattery() + if (isOptimizingBattery() && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); @@ -245,15 +244,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } } - private boolean hasAccountWithoutPush() { - for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() == Account.State.ONLINE && !xmppConnectionService.getPushManagementService().available(account)) { - return true; - } - } - return false; - } - private void notifyFragmentOfBackendConnected(@IdRes int id) { final Fragment fragment = getFragmentManager().findFragmentById(id); if (fragment instanceof OnBackendConnected) {