Flushing icons of the wrong size. (Bug 11203738)
Change-Id: I9468d2e798fcf9890970270041d341e7653432f1
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index 1797826..2aab68b 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -147,6 +147,20 @@
}
/**
+ * Empty out the cache that aren't of the correct grid size
+ */
+ public void flushInvalidIcons(DeviceProfile grid) {
+ synchronized (mCache) {
+ for (ComponentName cn : mCache.keySet()) {
+ final CacheEntry e = mCache.get(cn);
+ if (e.icon.getWidth() != grid.iconSizePx || e.icon.getHeight() != grid.iconSizePx) {
+ mCache.remove(cn);
+ }
+ }
+ }
+ }
+
+ /**
* Fill in "application" with the icon and label for "info."
*/
public void getTitleAndIcon(AppInfo application, ResolveInfo info,
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ee13f29..b0e4968 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -402,6 +402,7 @@
Context.MODE_PRIVATE);
mModel = app.setLauncher(this);
mIconCache = app.getIconCache();
+ mIconCache.flushInvalidIcons(grid);
mDragController = new DragController(this);
mInflater = getLayoutInflater();