Clear contact info on low memory

pull/185/head
M66B 4 years ago
parent d0807bb283
commit e5bfbce6b0

@ -152,6 +152,9 @@ public class ApplicationEx extends Application {
Map<String, String> crumb = new HashMap<>();
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
Log.breadcrumb("low", crumb);
ContactInfo.clearCache(this, false);
super.onLowMemory();
}

@ -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() {

Loading…
Cancel
Save