Merge "Add a static method on the ApplicationsState to enable app icon cache"

This commit is contained in:
YK Hung
2023-02-02 07:28:21 +00:00
committed by Android (Google) Code Review

View File

@@ -101,6 +101,9 @@ public class ApplicationsState {
@VisibleForTesting
static ApplicationsState sInstance;
// Whether the app icon cache mechanism is enabled or not.
private static boolean sAppIconCacheEnabled = false;
public static ApplicationsState getInstance(Application app) {
return getInstance(app, AppGlobals.getPackageManager());
}
@@ -115,6 +118,11 @@ public class ApplicationsState {
}
}
/** Set whether the app icon cache mechanism is enabled or not. */
public static void setAppIconCacheEnabled(boolean enabled) {
sAppIconCacheEnabled = enabled;
}
final Context mContext;
final PackageManager mPm;
final IPackageManager mIpm;
@@ -776,7 +784,8 @@ public class ApplicationsState {
}
private static boolean isAppIconCacheEnabled(Context context) {
return SETTING_PKG.equals(context.getPackageName());
return SETTING_PKG.equals(context.getPackageName())
|| sAppIconCacheEnabled;
}
void rebuildActiveSessions() {