Photoloader tweak
- Increase preload delay to 1000ms
- Decreased number of prelaod photos to 100
Bug 5245656
Change-Id: I4360696f9ef01d600b2daae38f054a24c1f8eecf
diff --git a/src/com/android/contacts/ContactPhotoManager.java b/src/com/android/contacts/ContactPhotoManager.java
index fd2e6a2..eb9531a 100644
--- a/src/com/android/contacts/ContactPhotoManager.java
+++ b/src/com/android/contacts/ContactPhotoManager.java
@@ -43,6 +43,7 @@
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.Iterator;
import java.util.List;
@@ -154,7 +155,7 @@
volatile boolean fresh;
Bitmap bitmap;
- SoftReference<Bitmap> bitmapRef;
+ Reference<Bitmap> bitmapRef;
public BitmapHolder(byte[] bytes) {
this.bytes = bytes;
@@ -494,7 +495,7 @@
/**
* A pause between preload batches that yields to the UI thread.
*/
- private static final int PHOTO_PRELOAD_DELAY = 50;
+ private static final int PHOTO_PRELOAD_DELAY = 1000;
/**
* Number of photos to preload per batch.
@@ -505,7 +506,7 @@
* Maximum number of photos to preload. If the cache size is 2Mb and
* the expected average size of a photo is 4kb, then this number should be 2Mb/4kb = 500.
*/
- private static final int MAX_PHOTOS_TO_PRELOAD = 500;
+ private static final int MAX_PHOTOS_TO_PRELOAD = 100;
private final ContentResolver mResolver;
private final StringBuilder mStringBuilder = new StringBuilder();
@@ -629,9 +630,8 @@
mPreloadStatus = PRELOAD_STATUS_DONE;
}
- Log.v(TAG, "Preloaded " + count + " photos. Photos in cache: "
- + mBitmapHolderCache.size()
- + ". Total size: " + mBitmapHolderCache.size());
+ Log.v(TAG, "Preloaded " + count + " photos. Cached bytes: "
+ + mBitmapHolderCache.size());
requestPreloading();
}