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

Commit b5d3d5ee authored by Hyunyoung Song's avatar Hyunyoung Song Committed by android-build-merger
Browse files

ub-launcher3-qt-qpr1-dev @ build 5818303

am: 227daf01

Change-Id: I6aa8a25a124e07701e1fe215101597bc00d6a7a8
parents 97dfdf36 227daf01
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
    <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />




    <!--
    <!--
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ public final class LandscapeStatesTouchController extends PortraitStatesTouchCon
    }
    }


    @Override
    @Override
    protected int getLogContainerTypeForNormalState() {
    protected int getLogContainerTypeForNormalState(MotionEvent ev) {
        return LauncherLogProto.ContainerType.WORKSPACE;
        return LauncherLogProto.ContainerType.WORKSPACE;
    }
    }
}
}
+1 −4
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserHandle;


import com.android.launcher3.ItemInfo;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.notification.NotificationKeyData;


import java.util.Collections;
import java.util.Collections;
import java.util.List;
import java.util.List;
@@ -48,10 +49,6 @@ public class DeepShortcutManager {
    private DeepShortcutManager(Context context) {
    private DeepShortcutManager(Context context) {
    }
    }


    public static boolean supportsShortcuts(ItemInfo info) {
        return false;
    }

    public boolean wasLastCallSuccess() {
    public boolean wasLastCallSuccess() {
        return false;
        return false;
    }
    }
+54 −37
Original line number Original line Diff line number Diff line
@@ -36,12 +36,16 @@ import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Build;
import android.os.Handler;
import android.os.Handler;
import android.os.LocaleList;
import android.os.Looper;
import android.os.Looper;
import android.os.Process;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserHandle;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Log;
import android.util.Log;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.icons.BaseIconFactory;
import com.android.launcher3.icons.BaseIconFactory;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BitmapRenderer;
import com.android.launcher3.icons.BitmapRenderer;
@@ -57,8 +61,6 @@ import java.util.Map;
import java.util.Set;
import java.util.Set;
import java.util.function.Supplier;
import java.util.function.Supplier;


import androidx.annotation.NonNull;

public abstract class BaseIconCache {
public abstract class BaseIconCache {


    private static final String TAG = "BaseIconCache";
    private static final String TAG = "BaseIconCache";
@@ -84,6 +86,7 @@ public abstract class BaseIconCache {


    protected int mIconDpi;
    protected int mIconDpi;
    protected IconDB mIconDb;
    protected IconDB mIconDb;
    protected LocaleList mLocaleList = LocaleList.getEmptyLocaleList();
    protected String mSystemState = "";
    protected String mSystemState = "";


    private final String mDbFileName;
    private final String mDbFileName;
@@ -227,12 +230,12 @@ public abstract class BaseIconCache {


    /**
    /**
     * Refreshes the system state definition used to check the validity of the cache. It
     * Refreshes the system state definition used to check the validity of the cache. It
     * incorporates all the properties that can affect the cache like locale and system-version.
     * incorporates all the properties that can affect the cache like the list of enabled locale
     * and system-version.
     */
     */
    private void updateSystemState() {
    private void updateSystemState() {
        final String locale =
        mLocaleList = mContext.getResources().getConfiguration().getLocales();
                mContext.getResources().getConfiguration().getLocales().toLanguageTags();
        mSystemState = mLocaleList.toLanguageTags() + "," + Build.VERSION.SDK_INT;
        mSystemState = locale + "," + Build.VERSION.SDK_INT;
    }
    }


    protected String getIconSystemState(String packageName) {
    protected String getIconSystemState(String packageName) {
@@ -269,7 +272,7 @@ public abstract class BaseIconCache {
        mCache.put(key, entry);
        mCache.put(key, entry);


        ContentValues values = newContentValues(entry, entry.title.toString(),
        ContentValues values = newContentValues(entry, entry.title.toString(),
                componentName.getPackageName());
                componentName.getPackageName(), cachingLogic.getKeywords(object, mLocaleList));
        addIconToDB(values, componentName, info, userSerial);
        addIconToDB(values, componentName, info, userSerial);
    }
    }


@@ -445,7 +448,7 @@ public abstract class BaseIconCache {
                    // Add the icon in the DB here, since these do not get written during
                    // Add the icon in the DB here, since these do not get written during
                    // package updates.
                    // package updates.
                    ContentValues values = newContentValues(
                    ContentValues values = newContentValues(
                            iconInfo, entry.title.toString(), packageName);
                            iconInfo, entry.title.toString(), packageName, null);
                    addIconToDB(values, cacheKey.componentName, info, getSerialNumberForUser(user));
                    addIconToDB(values, cacheKey.componentName, info, getSerialNumberForUser(user));


                } catch (NameNotFoundException e) {
                } catch (NameNotFoundException e) {
@@ -504,23 +507,35 @@ public abstract class BaseIconCache {
        return false;
        return false;
    }
    }


    static final class IconDB extends SQLiteCacheHelper {
    /**
        private final static int RELEASE_VERSION = 26;
     * Returns a cursor for an arbitrary query to the cache db

     */
        public final static String TABLE_NAME = "icons";
    public synchronized Cursor queryCacheDb(String[] columns, String selection,
        public final static String COLUMN_ROWID = "rowid";
            String[] selectionArgs) {
        public final static String COLUMN_COMPONENT = "componentName";
        return mIconDb.query(columns, selection, selectionArgs);
        public final static String COLUMN_USER = "profileId";
    }
        public final static String COLUMN_LAST_UPDATED = "lastUpdated";
        public final static String COLUMN_VERSION = "version";
        public final static String COLUMN_ICON = "icon";
        public final static String COLUMN_ICON_COLOR = "icon_color";
        public final static String COLUMN_LABEL = "label";
        public final static String COLUMN_SYSTEM_STATE = "system_state";


        public final static String[] COLUMNS_HIGH_RES = new String[] {
    /**
     * Cache class to store the actual entries on disk
     */
    public static final class IconDB extends SQLiteCacheHelper {
        private static final int RELEASE_VERSION = 27;

        public static final String TABLE_NAME = "icons";
        public static final String COLUMN_ROWID = "rowid";
        public static final String COLUMN_COMPONENT = "componentName";
        public static final String COLUMN_USER = "profileId";
        public static final String COLUMN_LAST_UPDATED = "lastUpdated";
        public static final String COLUMN_VERSION = "version";
        public static final String COLUMN_ICON = "icon";
        public static final String COLUMN_ICON_COLOR = "icon_color";
        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_HIGH_RES = new String[] {
                IconDB.COLUMN_ICON_COLOR, IconDB.COLUMN_LABEL, IconDB.COLUMN_ICON };
                IconDB.COLUMN_ICON_COLOR, IconDB.COLUMN_LABEL, IconDB.COLUMN_ICON };
        public final static String[] COLUMNS_LOW_RES = new String[] {
        public static final String[] COLUMNS_LOW_RES = new String[] {
                IconDB.COLUMN_ICON_COLOR, IconDB.COLUMN_LABEL };
                IconDB.COLUMN_ICON_COLOR, IconDB.COLUMN_LABEL };


        public IconDB(Context context, String dbFileName, int iconPixelSize) {
        public IconDB(Context context, String dbFileName, int iconPixelSize) {
@@ -529,21 +544,23 @@ public abstract class BaseIconCache {


        @Override
        @Override
        protected void onCreateTable(SQLiteDatabase db) {
        protected void onCreateTable(SQLiteDatabase db) {
            db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
            db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " ("
                    COLUMN_COMPONENT + " TEXT NOT NULL, " +
                    + COLUMN_COMPONENT + " TEXT NOT NULL, "
                    COLUMN_USER + " INTEGER NOT NULL, " +
                    + COLUMN_USER + " INTEGER NOT NULL, "
                    COLUMN_LAST_UPDATED + " INTEGER NOT NULL DEFAULT 0, " +
                    + COLUMN_LAST_UPDATED + " INTEGER NOT NULL DEFAULT 0, "
                    COLUMN_VERSION + " INTEGER NOT NULL DEFAULT 0, " +
                    + COLUMN_VERSION + " INTEGER NOT NULL DEFAULT 0, "
                    COLUMN_ICON + " BLOB, " +
                    + COLUMN_ICON + " BLOB, "
                    COLUMN_ICON_COLOR + " INTEGER NOT NULL DEFAULT 0, " +
                    + COLUMN_ICON_COLOR + " INTEGER NOT NULL DEFAULT 0, "
                    COLUMN_LABEL + " TEXT, " +
                    + COLUMN_LABEL + " TEXT, "
                    COLUMN_SYSTEM_STATE + " TEXT, " +
                    + COLUMN_SYSTEM_STATE + " TEXT, "
                    "PRIMARY KEY (" + COLUMN_COMPONENT + ", " + COLUMN_USER + ") " +
                    + COLUMN_KEYWORDS + " TEXT, "
                    ");");
                    + "PRIMARY KEY (" + COLUMN_COMPONENT + ", " + COLUMN_USER + ") "
        }
                    + ");");
    }
        }

    }
    private ContentValues newContentValues(BitmapInfo bitmapInfo, String label, String packageName) {

    private ContentValues newContentValues(BitmapInfo bitmapInfo, String label,
            String packageName, @Nullable String keywords) {
        ContentValues values = new ContentValues();
        ContentValues values = new ContentValues();
        values.put(IconDB.COLUMN_ICON,
        values.put(IconDB.COLUMN_ICON,
                bitmapInfo.isLowRes() ? null : GraphicsUtils.flattenBitmap(bitmapInfo.icon));
                bitmapInfo.isLowRes() ? null : GraphicsUtils.flattenBitmap(bitmapInfo.icon));
@@ -551,7 +568,7 @@ public abstract class BaseIconCache {


        values.put(IconDB.COLUMN_LABEL, label);
        values.put(IconDB.COLUMN_LABEL, label);
        values.put(IconDB.COLUMN_SYSTEM_STATE, getIconSystemState(packageName));
        values.put(IconDB.COLUMN_SYSTEM_STATE, getIconSystemState(packageName));

        values.put(IconDB.COLUMN_KEYWORDS, keywords);
        return values;
        return values;
    }
    }


+11 −0
Original line number Original line Diff line number Diff line
@@ -17,8 +17,11 @@ package com.android.launcher3.icons.cache;


import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.os.LocaleList;
import android.os.UserHandle;
import android.os.UserHandle;


import androidx.annotation.Nullable;

import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BitmapInfo;


public interface CachingLogic<T> {
public interface CachingLogic<T> {
@@ -30,4 +33,12 @@ public interface CachingLogic<T> {
    CharSequence getLabel(T object);
    CharSequence getLabel(T object);


    void loadIcon(Context context, T object, BitmapInfo target);
    void loadIcon(Context context, T object, BitmapInfo target);

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