From 30dbf97a1c8a66918cf22081bce627bf798c4e4b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 14 Oct 2015 22:55:59 +0200 Subject: clear bitmap cache before running out of memory --- .../eu/siacs/conversations/services/XmppConnectionService.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index cfd3ba6e..f9f9b71e 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 { -- cgit v1.2.3