summaryrefslogtreecommitdiffstats
path: root/iconloaderlib
diff options
context:
space:
mode:
authorPinyao Ting <pinyaoting@google.com>2019-09-05 14:38:08 -0700
committerPinyao Ting <pinyaoting@google.com>2019-09-12 09:14:43 -0700
commit050f9b1279d924d211ba8572876e9ada55a541f0 (patch)
tree532423380eebd897bfe3f58e79a8278391153f89 /iconloaderlib
parenta9a1c45967700df8cdd43e985ce87adee3effcb9 (diff)
downloadandroid_packages_apps_Trebuchet-050f9b1279d924d211ba8572876e9ada55a541f0.tar.gz
android_packages_apps_Trebuchet-050f9b1279d924d211ba8572876e9ada55a541f0.tar.bz2
android_packages_apps_Trebuchet-050f9b1279d924d211ba8572876e9ada55a541f0.zip
cache shourtcut image
Deep shortcuts now supports icon cache. When workspace is being loaded, we will now attempt to load deep shortcuts from memcache/db. The icon for deep shortcuts loaded in the workspace is saved to memcache/db after the workspace is loaded. Bug: 140242324 Change-Id: I49da8319ad203476fe1e45683e2848dbde3473f2
Diffstat (limited to 'iconloaderlib')
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java8
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java b/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java
index 09f59b84c..16bc7ae83 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java
@@ -17,6 +17,7 @@ package com.android.launcher3.icons.cache;
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.PackageInfo;
import android.os.LocaleList;
import android.os.UserHandle;
@@ -41,4 +42,11 @@ public interface CachingLogic<T> {
default String getKeywords(T object, LocaleList localeList) {
return null;
}
+
+ /**
+ * Returns the timestamp the entry was last updated in cache.
+ */
+ default long getLastUpdatedTime(T object, PackageInfo info) {
+ return info.lastUpdateTime;
+ }
}
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java b/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java
index 3c71bd027..bcdbce5e2 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java
@@ -171,8 +171,9 @@ public class IconCacheUpdateHandler {
long updateTime = c.getLong(indexLastUpdate);
int version = c.getInt(indexVersion);
T app = componentMap.remove(component);
- if (version == info.versionCode && updateTime == info.lastUpdateTime &&
- TextUtils.equals(c.getString(systemStateIndex),
+ if (version == info.versionCode
+ && updateTime == cachingLogic.getLastUpdatedTime(app, info)
+ && TextUtils.equals(c.getString(systemStateIndex),
mIconCache.getIconSystemState(info.packageName))) {
if (mFilterMode == MODE_CLEAR_VALID_ITEMS) {
@@ -231,7 +232,6 @@ public class IconCacheUpdateHandler {
}
}
-
/**
* A runnable that updates invalid icons and adds missing icons in the DB for the provided
* LauncherActivityInfo list. Items are updated/added one at a time, so that the