mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user