From 30dbf97a1c8a66918cf22081bce627bf798c4e4b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 14 Oct 2015 22:55:59 +0200 Subject: [PATCH] clear bitmap cache before running out of memory --- .../conversations/services/XmppConnectionService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index cfd3ba6e0..f9f9b71e2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -673,6 +673,15 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa toggleScreenEventReceiver(); } + @Override + public void onTrimMemory(int level) { + super.onTrimMemory(level); + if (level >= TRIM_MEMORY_COMPLETE) { + Log.d(Config.LOGTAG,"clear cache due to low memory"); + getBitmapCache().evictAll(); + } + } + @Override public void onDestroy() { try {