summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-05-28 12:53:44 -0700
committerWinson Chung <winsonc@google.com>2015-05-28 15:25:45 -0700
commitcdefc631f8b4b3e56ea3bd238d46d0bc9e28eabe (patch)
tree5e8054c2a644e436e618c5dfa921f990c69f1bc5 /src
parent8f73d7032e557c6f01a9954a2ec0f386987946e4 (diff)
downloadandroid_packages_apps_Trebuchet-cdefc631f8b4b3e56ea3bd238d46d0bc9e28eabe.tar.gz
android_packages_apps_Trebuchet-cdefc631f8b4b3e56ea3bd238d46d0bc9e28eabe.tar.bz2
android_packages_apps_Trebuchet-cdefc631f8b4b3e56ea3bd238d46d0bc9e28eabe.zip
Ensuring that each CacheEntry has a default title and content description.
- Also defer adding entry to cache until we know that it has correctly loaded Bug: 21446070 Change-Id: Ia7aae65ecdc5d9d7741f75d3fb6e7b85daeafeff
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/IconCache.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index 0c91a7113..a3376c42f 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;
}
@@ -584,7 +582,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 +607,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;
}