summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-08-01 14:34:46 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-08-01 14:34:47 -0700
commit6a916ed0c0f5c5c5ec53f11087265eb13fc34ff1 (patch)
tree0e15c44e6fabd36942e3aad022da9ab12e9936f5
parent3a68038249c0908e7e16ca03f33a9e2edb22c639 (diff)
parentd96b585f5c40ee0d1232630ac0124d4610341577 (diff)
downloadframeworks_base-6a916ed0c0f5c5c5ec53f11087265eb13fc34ff1.zip
frameworks_base-6a916ed0c0f5c5c5ec53f11087265eb13fc34ff1.tar.gz
frameworks_base-6a916ed0c0f5c5c5ec53f11087265eb13fc34ff1.tar.bz2
Merge "Add trimToSize() to public API." into jb-mr1-dev
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/util/LruCache.java7
2 files changed, 6 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt
index 66b76bb..fe16ee5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22791,6 +22791,7 @@ package android.util {
method protected int sizeOf(K, V);
method public final synchronized java.util.Map<K, V> snapshot();
method public final synchronized java.lang.String toString();
+ method public void trimToSize(int);
}
public final class MalformedJsonException extends java.io.IOException {
diff --git a/core/java/android/util/LruCache.java b/core/java/android/util/LruCache.java
index 51e373c..dd504c1 100644
--- a/core/java/android/util/LruCache.java
+++ b/core/java/android/util/LruCache.java
@@ -186,10 +186,13 @@ public class LruCache<K, V> {
}
/**
+ * Remove the eldest entries until the total of remaining entries is at or
+ * below the requested size.
+ *
* @param maxSize the maximum size of the cache before returning. May be -1
- * to evict even 0-sized elements.
+ * to evict even 0-sized elements.
*/
- private void trimToSize(int maxSize) {
+ public void trimToSize(int maxSize) {
while (true) {
K key;
V value;