diff options
Diffstat (limited to 'src/com/android/launcher3/IconCache.java')
-rw-r--r-- | src/com/android/launcher3/IconCache.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java index 59ab8397d..c5eeba69d 100644 --- a/src/com/android/launcher3/IconCache.java +++ b/src/com/android/launcher3/IconCache.java @@ -52,8 +52,10 @@ import com.android.launcher3.util.Thunk; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import java.util.Stack; @@ -198,6 +200,20 @@ public class IconCache { } /** + * Empty out the cache that aren't of the correct grid size + */ + public synchronized void flushInvalidIcons(DeviceProfile deviceProfile) { + Iterator<Map.Entry<ComponentKey, CacheEntry>> it = mCache.entrySet().iterator(); + while (it.hasNext()) { + final CacheEntry e = it.next().getValue(); + if ((e.icon != null) && (e.icon.getWidth() < deviceProfile.iconSizePx + || e.icon.getHeight() < deviceProfile.iconSizePx)) { + it.remove(); + } + } + } + + /** * Remove any records for the supplied package name from memory. */ private void removeFromMemCacheLocked(String packageName, UserHandleCompat user) { |