diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index cbdd17f74d..0782081253 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -152,6 +152,9 @@ public class ApplicationEx extends Application { Map crumb = new HashMap<>(); crumb.put("free", Integer.toString(Log.getFreeMemMb())); Log.breadcrumb("low", crumb); + + ContactInfo.clearCache(this, false); + super.onLowMemory(); } diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index 97514913aa..c85b9c9e47 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -138,12 +138,22 @@ public class ContactInfo { } static void clearCache(Context context) { + clearCache(context, true); + } + + static void clearCache(Context context, boolean files) { synchronized (emailContactInfo) { emailContactInfo.clear(); } - final File dir = new File(context.getCacheDir(), "favicons"); + synchronized (emailGravatar) { + emailGravatar.clear(); + } + if (!files) + return; + + final File dir = new File(context.getCacheDir(), "favicons"); executorFavicon.submit(new Runnable() { @Override public void run() {