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

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

Merge "Requesting ApplicationInfo in cached object" into main

parents f9785964 15caab2a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.launcher3.icons.cache;

import android.content.ComponentName;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
@@ -53,4 +54,10 @@ public interface CachedObject<T extends BaseIconCache> {
    default Drawable getFullResIcon(@NonNull T cache) {
        return null;
    }

    /**
     * @see CachingLogic#getApplicationInfo
     */
    @Nullable
    ApplicationInfo getApplicationInfo();
}
+2 −0
Original line number Diff line number Diff line
@@ -52,4 +52,6 @@ constructor(
    }

    override fun addToMemCache() = addToMemCache

    override fun getApplicationInfo(info: CachedObject<T>) = info.applicationInfo
}
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.icons.cache;

import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.UserHandle;

@@ -45,6 +46,13 @@ public interface CachingLogic<T> {
        return fallback;
    }

    /**
     * Returns the application info associated with the object. This is used to maintain the
     * "freshness" of the disk cache. If null, the item will not be persisted to the disk
     */
    @Nullable
    ApplicationInfo getApplicationInfo(@NonNull T object);

    @NonNull
    BitmapInfo loadIcon(@NonNull Context context, @NonNull BaseIconCache cache, @NonNull T object);

+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ object LauncherActivityCachingLogic : CachingLogic<LauncherActivityInfo> {

    override fun getLabel(info: LauncherActivityInfo): CharSequence? = info.label

    override fun getDescription(info: LauncherActivityInfo, fallback: CharSequence) = fallback
    override fun getApplicationInfo(info: LauncherActivityInfo) = info.applicationInfo

    override fun loadIcon(
        context: Context,