Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd44941b authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding some utility methods for testing

Test: atest FolderIconLoadTest
Bug: 315352494
Flag: N/A
Change-Id: Ieafc4e876ba6429a42f7b765aab7c7a567a3188c
parent 8e0d3fae
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.launcher3.icons.BaseIconFactory.getFullResDefaultActiv
import static com.android.launcher3.icons.BitmapInfo.LOW_RES_ICON;
import static com.android.launcher3.icons.GraphicsUtils.flattenBitmap;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import static com.android.launcher3.icons.cache.IconCacheUpdateHandler.ICON_UPDATE_TOKEN;

import static java.util.Objects.requireNonNull;

@@ -499,9 +500,16 @@ public abstract class BaseIconCache {
                cachingLogic.getDescription(object, entry.title), user);
    }

    public synchronized void clear() {
    public synchronized void clearMemoryCache() {
        assertWorkerThread();
        mIconDb.clear();
        mCache.clear();
    }

    /**
     * Returns true if an icon update is in progress
     */
    public boolean isIconUpdateInProgress() {
        return mWorkerHandler.hasMessages(0, ICON_UPDATE_TOKEN);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public class IconCacheUpdateHandler {
     */
    private static final boolean MODE_CLEAR_VALID_ITEMS = false;

    private static final Object ICON_UPDATE_TOKEN = new Object();
    static final Object ICON_UPDATE_TOKEN = new Object();

    private final HashMap<String, PackageInfo> mPkgInfoMap;
    private final BaseIconCache mIconCache;