summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/icons
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/icons')
-rw-r--r--src/com/android/launcher3/icons/BaseIconCache.java15
-rw-r--r--src/com/android/launcher3/icons/IconCache.java3
-rw-r--r--src/com/android/launcher3/icons/LauncherIcons.java1
3 files changed, 10 insertions, 9 deletions
diff --git a/src/com/android/launcher3/icons/BaseIconCache.java b/src/com/android/launcher3/icons/BaseIconCache.java
index 9a2e287db..61c8ccc40 100644
--- a/src/com/android/launcher3/icons/BaseIconCache.java
+++ b/src/com/android/launcher3/icons/BaseIconCache.java
@@ -36,14 +36,13 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Handler;
+import android.os.Looper;
import android.os.Process;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import com.android.launcher3.IconProvider;
-import com.android.launcher3.LauncherModel;
-import com.android.launcher3.graphics.BitmapRenderer;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.Provider;
@@ -58,7 +57,6 @@ public abstract class BaseIconCache {
private static final String TAG = "BaseIconCache";
private static final boolean DEBUG = false;
- private static final boolean DEBUG_IGNORE_CACHE = false;
private static final int INITIAL_ICON_CACHE_CAPACITY = 50;
@@ -78,21 +76,24 @@ public abstract class BaseIconCache {
private final HashMap<ComponentKey, CacheEntry> mCache =
new HashMap<>(INITIAL_ICON_CACHE_CAPACITY);
- final Handler mWorkerHandler;
+ protected final Handler mWorkerHandler;
protected int mIconDpi;
IconDB mIconDb;
private final String mDbFileName;
private final BitmapFactory.Options mDecodeOptions;
+ private final Looper mBgLooper;
- public BaseIconCache(Context context, String dbFileName, int iconDpi, int iconPixelSize) {
+ public BaseIconCache(Context context, String dbFileName, Looper bgLooper,
+ int iconDpi, int iconPixelSize) {
mContext = context;
mDbFileName = dbFileName;
mPackageManager = context.getPackageManager();
+ mBgLooper = bgLooper;
mIconProvider = IconProvider.newInstance(context);
- mWorkerHandler = new Handler(LauncherModel.getWorkerLooper());
+ mWorkerHandler = new Handler(mBgLooper);
if (BitmapRenderer.USE_HARDWARE_BITMAP && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mDecodeOptions = new BitmapFactory.Options();
@@ -294,7 +295,7 @@ public abstract class BaseIconCache {
T object = null;
boolean providerFetchedOnce = false;
- if (!getEntryFromDB(cacheKey, entry, useLowResIcon) || DEBUG_IGNORE_CACHE) {
+ if (!getEntryFromDB(cacheKey, entry, useLowResIcon)) {
object = infoProvider.get();
providerFetchedOnce = true;
diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java
index 9c0a36374..7b318048a 100644
--- a/src/com/android/launcher3/icons/IconCache.java
+++ b/src/com/android/launcher3/icons/IconCache.java
@@ -66,7 +66,8 @@ public class IconCache extends BaseIconCache {
private int mPendingIconRequestCount = 0;
public IconCache(Context context, InvariantDeviceProfile inv) {
- super(context, LauncherFiles.APP_ICONS_DB, inv.fillResIconDpi, inv.iconBitmapSize);
+ super(context, LauncherFiles.APP_ICONS_DB, LauncherModel.getWorkerLooper(),
+ inv.fillResIconDpi, inv.iconBitmapSize);
mComponentWithLabelCachingLogic = new ComponentCachingLogic(context);
mLauncherActivityInfoCachingLogic = new LauncherActivtiyCachingLogic(this);
mLauncherApps = LauncherAppsCompat.getInstance(mContext);
diff --git a/src/com/android/launcher3/icons/LauncherIcons.java b/src/com/android/launcher3/icons/LauncherIcons.java
index c96d35db5..0cf1a7258 100644
--- a/src/com/android/launcher3/icons/LauncherIcons.java
+++ b/src/com/android/launcher3/icons/LauncherIcons.java
@@ -31,7 +31,6 @@ import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.Utilities;
-import com.android.launcher3.graphics.BitmapRenderer;
import com.android.launcher3.model.PackageItemInfo;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;