summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/IconCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/IconCache.java')
-rw-r--r--src/com/android/launcher3/IconCache.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index 0c91a7113..6dfca9ef3 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -49,10 +49,8 @@ import com.android.launcher3.util.Thunk;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
-import java.util.Map.Entry;
import java.util.Stack;
/**
@@ -75,8 +73,8 @@ public class IconCache {
@Thunk static class CacheEntry {
public Bitmap icon;
- public CharSequence title;
- public CharSequence contentDescription;
+ public CharSequence title = "";
+ public CharSequence contentDescription = "";
public boolean isLowResIcon;
}
@@ -367,13 +365,6 @@ public class IconCache {
}
/**
- * Empty out the cache.
- */
- public synchronized void flush() {
- mCache.clear();
- }
-
- /**
* Fetches high-res icon for the provided ItemInfo and updates the caller when done.
* @return a request ID that can be used to cancel the request.
*/
@@ -584,7 +575,7 @@ public class IconCache {
CacheEntry entry = mCache.get(cacheKey);
if (entry == null || (entry.isLowResIcon && !useLowResIcon)) {
entry = new CacheEntry();
- mCache.put(cacheKey, entry);
+ boolean entryUpdated = true;
// Check the DB first.
if (!getEntryFromDB(cn, user, entry, useLowResIcon)) {
@@ -609,8 +600,14 @@ public class IconCache {
} catch (NameNotFoundException e) {
if (DEBUG) Log.d(TAG, "Application not installed " + packageName);
+ entryUpdated = false;
}
}
+
+ // Only add a filled-out entry to the cache
+ if (entryUpdated) {
+ mCache.put(cacheKey, entry);
+ }
}
return entry;
}