From 3ff735b1cc3d95167920b7fe5fa6cf9c2090c598 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 30 Dec 2022 08:27:14 +0100 Subject: [PATCH] Use dedicated executor for main --- app/src/main/java/eu/faircode/email/ActivityMain.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityMain.java b/app/src/main/java/eu/faircode/email/ActivityMain.java index ccbf1fda51..68f812741a 100644 --- a/app/src/main/java/eu/faircode/email/ActivityMain.java +++ b/app/src/main/java/eu/faircode/email/ActivityMain.java @@ -41,6 +41,7 @@ import androidx.preference.PreferenceManager; import java.util.Date; import java.util.List; +import java.util.concurrent.ExecutorService; public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener { static final int RESTORE_STATE_INTERVAL = 3; // minutes @@ -49,6 +50,9 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack private static final long SERVICE_START_DELAY = 5 * 1000L; // milliseconds private static final long IGNORE_STORAGE_SPACE = 24 * 60 * 60 * 1000L; // milliseconds + private static final ExecutorService executor = + Helper.getBackgroundExecutor(0, 1, 3, "main"); + @Override protected void onCreate(Bundle savedInstanceState) { long now = new Date().getTime(); @@ -167,7 +171,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack protected void onException(Bundle args, Throwable ex) { // Ignored } - }.execute(this, args, "message:linked"); + }.setExecutor(executor).execute(this, args, "message:linked"); return; } @@ -337,7 +341,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack }) .show(); } - }; + }.setExecutor(executor); if (Helper.shouldAuthenticate(this, false)) Helper.authenticate(ActivityMain.this, ActivityMain.this, null,