aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-10-14 22:55:59 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-10-14 22:55:59 +0200
commit30dbf97a1c8a66918cf22081bce627bf798c4e4b (patch)
treea8fd8bc090a4e3e66cb93dd94ce81c016606b93c
parent5f9476448f54113e27f04f38fd64959b13bcd97b (diff)
clear bitmap cache before running out of memory
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java9
1 files changed, 9 insertions, 0 deletions
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
@@ -674,6 +674,15 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
@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 {
unregisterReceiver(this.mEventReceiver);