[Android] Use larger cache on Android 3+ devices
Geoffrey Métais
git at videolan.org
Wed Apr 8 17:19:46 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Apr 8 10:20:39 2015 +0200| [3b4e2d0a5e63ddba566604e07faf2e914a3671fe] | committer: Geoffrey Métais
Use larger cache on Android 3+ devices
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=3b4e2d0a5e63ddba566604e07faf2e914a3671fe
---
vlc-android/src/org/videolan/vlc/util/BitmapCache.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/util/BitmapCache.java b/vlc-android/src/org/videolan/vlc/util/BitmapCache.java
index f32e0be..8a84505 100644
--- a/vlc-android/src/org/videolan/vlc/util/BitmapCache.java
+++ b/vlc-android/src/org/videolan/vlc/util/BitmapCache.java
@@ -20,6 +20,7 @@
package org.videolan.vlc.util;
+import org.videolan.libvlc.LibVlcUtil;
import org.videolan.vlc.VLCApplication;
import android.app.ActivityManager;
@@ -51,8 +52,9 @@ public class BitmapCache {
// Get memory class of this device, exceeding this amount will throw an
// OutOfMemory exception.
- final int memClass = ((ActivityManager) context.getSystemService(
- Context.ACTIVITY_SERVICE)).getMemoryClass();
+ final ActivityManager am = ((ActivityManager) context.getSystemService(
+ Context.ACTIVITY_SERVICE));
+ final int memClass = LibVlcUtil.isHoneycombOrLater() ? am.getLargeMemoryClass() : am.getMemoryClass();
// Use 1/5th of the available memory for this memory cache.
final int cacheSize = 1024 * 1024 * memClass / 5;
More information about the Android
mailing list