Merge "Add READ_PROFILE and READ_SOCIAL_STREAM to test apk"
diff --git a/res/drawable-hdpi/aggregation_suggestions_bg.9.png b/res/drawable-hdpi/aggregation_suggestions_bg.9.png
index 687cc08..d279fb1 100644
--- a/res/drawable-hdpi/aggregation_suggestions_bg.9.png
+++ b/res/drawable-hdpi/aggregation_suggestions_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/aggregation_suggestions_bg.9.png b/res/drawable-mdpi/aggregation_suggestions_bg.9.png
index 687cc08..6cce274 100644
--- a/res/drawable-mdpi/aggregation_suggestions_bg.9.png
+++ b/res/drawable-mdpi/aggregation_suggestions_bg.9.png
Binary files differ
diff --git a/src/com/android/contacts/ContactPhotoManager.java b/src/com/android/contacts/ContactPhotoManager.java
index cb0dc78..35585a6 100644
--- a/src/com/android/contacts/ContactPhotoManager.java
+++ b/src/com/android/contacts/ContactPhotoManager.java
@@ -255,6 +255,11 @@
     private final LruCache<Object, BitmapHolder> mBitmapHolderCache;
 
     /**
+     * {@code true} if ALL entries in {@link #mBitmapHolderCache} are NOT fresh.
+     */
+    private volatile boolean mBitmapHolderCacheAllUnfresh = true;
+
+    /**
      * Cache size threshold at which bitmaps will not be preloaded.
      */
     private final int mBitmapHolderCacheRedZoneBytes;
@@ -460,7 +465,12 @@
 
     @Override
     public void refreshCache() {
+        if (mBitmapHolderCacheAllUnfresh) {
+            if (DEBUG) Log.d(TAG, "refreshCache -- no fresh entries.");
+            return;
+        }
         if (DEBUG) Log.d(TAG, "refreshCache");
+        mBitmapHolderCacheAllUnfresh = true;
         for (BitmapHolder holder : mBitmapHolderCache.snapshot().values()) {
             holder.fresh = false;
         }
@@ -666,7 +676,6 @@
             Log.d(TAG, "Caching data: key=" + key + ", " + btk(bytes.length));
         }
         BitmapHolder holder = new BitmapHolder(bytes);
-        holder.fresh = true;
 
         // Unless this image is being preloaded, decode it right away while
         // we are still on the background thread.
@@ -675,6 +684,7 @@
         }
 
         mBitmapHolderCache.put(key, holder);
+        mBitmapHolderCacheAllUnfresh = false;
     }
 
     @Override
@@ -682,6 +692,7 @@
         Request request = Request.createFromUri(photoUri, true, false, DEFAULT_AVATAR);
         BitmapHolder holder = new BitmapHolder(photoBytes);
         mBitmapHolderCache.put(request.getKey(), holder);
+        mBitmapHolderCacheAllUnfresh = false;
         mBitmapCache.put(request.getKey(), bitmap);
     }