summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/icons
diff options
context:
space:
mode:
authorPinyao Ting <pinyaoting@google.com>2019-09-17 23:34:50 -0700
committerPinyao Ting <pinyaoting@google.com>2019-09-20 15:24:22 +0000
commitddd0ff44ba0424427e68016dc676ba006d4f70b0 (patch)
treeff9a61a2deae335a415cd9562d332732f529dfcc /src/com/android/launcher3/icons
parentca939f073c42b87035d910928fe87a3f6619abab (diff)
downloadandroid_packages_apps_Trebuchet-ddd0ff44ba0424427e68016dc676ba006d4f70b0.tar.gz
android_packages_apps_Trebuchet-ddd0ff44ba0424427e68016dc676ba006d4f70b0.tar.bz2
android_packages_apps_Trebuchet-ddd0ff44ba0424427e68016dc676ba006d4f70b0.zip
Exclude shortcuts in popup from IconCache.
We want to load from/save icons to icon cache for pinned shortcuts only to reduce memory footprint. Bug: 140242324 Change-Id: I25c7d59e29c6e27752b36c2c3c226849d4e177af
Diffstat (limited to 'src/com/android/launcher3/icons')
-rw-r--r--src/com/android/launcher3/icons/ComponentWithLabel.java9
-rw-r--r--src/com/android/launcher3/icons/IconCache.java4
-rw-r--r--src/com/android/launcher3/icons/ShortcutCachingLogic.java5
3 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/launcher3/icons/ComponentWithLabel.java b/src/com/android/launcher3/icons/ComponentWithLabel.java
index 46b500265..832956d7e 100644
--- a/src/com/android/launcher3/icons/ComponentWithLabel.java
+++ b/src/com/android/launcher3/icons/ComponentWithLabel.java
@@ -34,9 +34,11 @@ public interface ComponentWithLabel {
class ComponentCachingLogic implements CachingLogic<ComponentWithLabel> {
private final PackageManager mPackageManager;
+ private final boolean mAddToMemCache;
- public ComponentCachingLogic(Context context) {
+ public ComponentCachingLogic(Context context, boolean addToMemCache) {
mPackageManager = context.getPackageManager();
+ mAddToMemCache = addToMemCache;
}
@Override
@@ -60,5 +62,10 @@ public interface ComponentWithLabel {
// Do not load icon.
target.icon = BitmapInfo.LOW_RES_ICON;
}
+
+ @Override
+ public boolean addToMemCache() {
+ return mAddToMemCache;
+ }
}
}
diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java
index 50b5222d3..11c7f2053 100644
--- a/src/com/android/launcher3/icons/IconCache.java
+++ b/src/com/android/launcher3/icons/IconCache.java
@@ -77,7 +77,7 @@ public class IconCache extends BaseIconCache {
public IconCache(Context context, InvariantDeviceProfile inv) {
super(context, LauncherFiles.APP_ICONS_DB, MODEL_EXECUTOR.getLooper(),
inv.fillResIconDpi, inv.iconBitmapSize, true /* inMemoryCache */);
- mComponentWithLabelCachingLogic = new ComponentCachingLogic(context);
+ mComponentWithLabelCachingLogic = new ComponentCachingLogic(context, false);
mLauncherActivityInfoCachingLogic = LauncherActivityCachingLogic.newInstance(context);
mShortcutCachingLogic = new ShortcutCachingLogic();
mLauncherApps = LauncherAppsCompat.getInstance(mContext);
@@ -206,7 +206,7 @@ public class IconCache extends BaseIconCache {
public synchronized String getTitleNoCache(ComponentWithLabel info) {
CacheEntry entry = cacheLocked(info.getComponent(), info.getUser(), () -> info,
mComponentWithLabelCachingLogic, false /* usePackageIcon */,
- true /* useLowResIcon */, false /* addToMemCache */);
+ true /* useLowResIcon */);
return Utilities.trim(entry.title);
}
diff --git a/src/com/android/launcher3/icons/ShortcutCachingLogic.java b/src/com/android/launcher3/icons/ShortcutCachingLogic.java
index ee79b249c..5d696fd6f 100644
--- a/src/com/android/launcher3/icons/ShortcutCachingLogic.java
+++ b/src/com/android/launcher3/icons/ShortcutCachingLogic.java
@@ -64,4 +64,9 @@ public class ShortcutCachingLogic implements CachingLogic<ShortcutInfo> {
if (shortcutInfo == null) return info.lastUpdateTime;
return Math.max(shortcutInfo.getLastChangedTimestamp(), info.lastUpdateTime);
}
+
+ @Override
+ public boolean addToMemCache() {
+ return false;
+ }
}