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

Commit 222ee6c3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Converting BaseIconCache to kotlin" into main

parents d9af166a 89db0c17
Loading
Loading
Loading
Loading
+0 −781

File deleted.

Preview size limit exceeded, changes collapsed.

+673 −0

File added.

Preview size limit exceeded, changes collapsed.

+8 −9
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.os.SystemClock
import android.os.UserHandle
import android.util.ArrayMap
import android.util.Log
import com.android.launcher3.icons.cache.BaseIconCache.IconDB
import com.android.launcher3.util.ComponentKey
import com.android.launcher3.util.SQLiteCacheHelper
import java.util.ArrayDeque
@@ -107,19 +106,19 @@ class IconCacheUpdateHandler(
            cacheDb
                .query(
                    arrayOf(
                        IconDB.COLUMN_ROWID,
                        IconDB.COLUMN_COMPONENT,
                        IconDB.COLUMN_FRESHNESS_ID,
                        BaseIconCache.COLUMN_ROWID,
                        BaseIconCache.COLUMN_COMPONENT,
                        BaseIconCache.COLUMN_FRESHNESS_ID,
                    ),
                    "${IconDB.COLUMN_USER} = ? ",
                    "${BaseIconCache.COLUMN_USER} = ? ",
                    arrayOf(userSerial.toString()),
                )
                .use { c ->
                    var ignorePackages = packagesToIgnore[user] ?: emptySet()

                    val indexComponent = c.getColumnIndex(IconDB.COLUMN_COMPONENT)
                    val indexFreshnessId = c.getColumnIndex(IconDB.COLUMN_FRESHNESS_ID)
                    val rowIndex = c.getColumnIndex(IconDB.COLUMN_ROWID)
                    val indexComponent = c.getColumnIndex(BaseIconCache.COLUMN_COMPONENT)
                    val indexFreshnessId = c.getColumnIndex(BaseIconCache.COLUMN_FRESHNESS_ID)
                    val rowIndex = c.getColumnIndex(BaseIconCache.COLUMN_ROWID)

                    while (c.moveToNext()) {
                        val rowId = c.getInt(rowIndex)
@@ -232,7 +231,7 @@ class IconCacheUpdateHandler(
        // Commit all deletes
        if (itemsToDelete.isNotEmpty()) {
            val r = itemsToDelete.joinToString { it.rowId.toString() }
            cacheDb.delete("${IconDB.COLUMN_ROWID} IN ($r)", null)
            cacheDb.delete("${BaseIconCache.COLUMN_ROWID} IN ($r)", null)
            Log.d(TAG, "Deleting obsolete entries, count=" + itemsToDelete.size)
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public class SimpleIconCache extends BaseIconCache {
    }

    @Override
    protected long getSerialNumberForUser(@NonNull UserHandle user) {
    public long getSerialNumberForUser(@NonNull UserHandle user) {
        synchronized (mUserSerialMap) {
            int index = mUserSerialMap.indexOfKey(user.getIdentifier());
            if (index >= 0) {
@@ -92,7 +92,7 @@ public class SimpleIconCache extends BaseIconCache {
    @NonNull
    @Override
    public BaseIconFactory getIconFactory() {
        return IconFactory.obtain(mContext);
        return IconFactory.obtain(context);
    }

    public static SimpleIconCache getIconCache(Context context) {