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

Commit 031325e3 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing unused keywords column from DB

The additional column doesn't affect the DB, and  will get updated
next time the iconCache is reset

Bug: 366237794
FLAG: EXEMPT dead code removal
Test: Launcher presubmit
Change-Id: I4d82405af6450782f262c6d9ee1684948d0c44ea
parent 5024f96a
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -381,8 +381,8 @@ public abstract class BaseIconCache {
        entry.contentDescription = getUserBadgedLabel(entry.title, user);
        if (cachingLogic.addToMemCache()) mCache.put(key, entry);

        ContentValues values = newContentValues(entry.bitmap, entry.title.toString(),
                componentName.getPackageName(), cachingLogic.getKeywords(object, mLocaleList));
        ContentValues values = newContentValues(
                entry.bitmap, entry.title.toString(), componentName.getPackageName());
        addIconToDB(values, componentName, info, userSerial,
                cachingLogic.getLastUpdatedTime(object, info));
    }
@@ -644,7 +644,7 @@ public abstract class BaseIconCache {
                    // Add the icon in the DB here, since these do not get written during
                    // package updates.
                    ContentValues values = newContentValues(
                            iconInfo, entry.title.toString(), packageName, null);
                            iconInfo, entry.title.toString(), packageName);
                    addIconToDB(values, cacheKey.componentName, info, getSerialNumberForUser(user),
                            info.lastUpdateTime);

@@ -764,7 +764,6 @@ public abstract class BaseIconCache {
        public static final String COLUMN_FLAGS = "flags";
        public static final String COLUMN_LABEL = "label";
        public static final String COLUMN_SYSTEM_STATE = "system_state";
        public static final String COLUMN_KEYWORDS = "keywords";

        public static final String[] COLUMNS_LOW_RES = new String[]{
                COLUMN_COMPONENT,
@@ -803,7 +802,6 @@ public abstract class BaseIconCache {
                    + COLUMN_FLAGS + " INTEGER NOT NULL DEFAULT 0, "
                    + COLUMN_LABEL + " TEXT, "
                    + COLUMN_SYSTEM_STATE + " TEXT, "
                    + COLUMN_KEYWORDS + " TEXT, "
                    + "PRIMARY KEY (" + COLUMN_COMPONENT + ", " + COLUMN_USER + ") "
                    + ");");
        }
@@ -811,8 +809,7 @@ public abstract class BaseIconCache {

    @NonNull
    private ContentValues newContentValues(@NonNull final BitmapInfo bitmapInfo,
            @NonNull final String label, @NonNull final String packageName,
            @Nullable final String keywords) {
            @NonNull final String label, @NonNull final String packageName) {
        ContentValues values = new ContentValues();
        if (bitmapInfo.canPersist()) {
            values.put(IconDB.COLUMN_ICON, flattenBitmap(bitmapInfo.icon));
@@ -837,7 +834,6 @@ public abstract class BaseIconCache {

        values.put(IconDB.COLUMN_LABEL, label);
        values.put(IconDB.COLUMN_SYSTEM_STATE, getIconSystemState(packageName));
        values.put(IconDB.COLUMN_KEYWORDS, keywords);
        return values;
    }

+0 −9
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ 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;

import androidx.annotation.NonNull;
@@ -49,14 +48,6 @@ public interface CachingLogic<T> {
    @NonNull
    BitmapInfo loadIcon(@NonNull Context context, @NonNull BaseIconCache cache, @NonNull T object);

    /**
     * Provides a option list of keywords to associate with this object
     */
    @Nullable
    default String getKeywords(@NonNull final T object, @NonNull final LocaleList localeList) {
        return null;
    }

    /**
     * Returns the timestamp the entry was last updated in cache.
     */