From fff585490f85cedccab71ac82efa69e2cb09562a Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 26 Oct 2020 18:56:34 +0100 Subject: [PATCH] Simplification --- .../java/eu/faircode/email/ServiceSynchronize.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index b4cdf8e9f8..9368ad4344 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -950,7 +950,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if ("Still here".equals(message) && !isTransient(account)) { long now = new Date().getTime(); if (now - start < STILL_THERE_THRESHOLD) - optimizeAccount(ServiceSynchronize.this, account, message); + optimizeAccount(account, message); } } else try { @@ -1009,7 +1009,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences final boolean capIdle = iservice.hasCapability("IDLE"); Log.i(account.name + " idle=" + capIdle); if (!capIdle || account.poll_interval < OPTIMIZE_KEEP_ALIVE_INTERVAL) - optimizeAccount(ServiceSynchronize.this, account, "IDLE"); + optimizeAccount(account, "IDLE"); db.account().setAccountState(account.id, "connected"); db.account().setAccountError(account.id, null); @@ -1807,16 +1807,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences return (!enabled || account.ondemand || (pollInterval > 0 && !account.poll_exempted)); } - private void optimizeAccount(Context context, EntityAccount account, String reason) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + private void optimizeAccount(EntityAccount account, String reason) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean auto_optimize = prefs.getBoolean("auto_optimize", false); if (!auto_optimize) return; - DB db = DB.getInstance(context); + DB db = DB.getInstance(this); int pollInterval = prefs.getInt("poll_interval", DEFAULT_POLL_INTERVAL); - EntityLog.log(context, "Auto optimize account=" + account.name + " poll interval=" + pollInterval); + EntityLog.log(this, "Auto optimize account=" + account.name + " poll interval=" + pollInterval); if (pollInterval == 0) { try { db.beginTransaction();