Loading src/com/android/launcher3/dragndrop/AddItemActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ public class AddItemActivity extends BaseActivity new PinShortcutRequestActivityInfo(mRequest, this); mWidgetCell.getWidgetView().setTag(new PendingAddShortcutInfo(shortcutInfo)); applyWidgetItemAsync( () -> new WidgetItem(shortcutInfo, mApp.getIconCache(), getPackageManager())); () -> new WidgetItem(shortcutInfo, mApp.getIconCache())); return new PackageItemInfo(mRequest.getShortcutInfo().getPackage(), mRequest.getShortcutInfo().getUserHandle()); } Loading src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java +3 −4 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; import android.content.pm.LauncherApps.PinItemRequest; import android.content.pm.PackageManager; import android.content.pm.ShortcutInfo; import android.graphics.drawable.Drawable; import android.os.Build; Loading @@ -40,7 +39,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.cache.BaseIconCache; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.pm.ShortcutConfigActivityInfo; Loading Loading @@ -82,12 +81,12 @@ public class PinShortcutRequestActivityInfo extends ShortcutConfigActivityInfo { } @Override public CharSequence getLabel(PackageManager pm) { public CharSequence getLabel() { return mInfo.getShortLabel(); } @Override public Drawable getFullResIcon(IconCache cache) { public Drawable getFullResIcon(BaseIconCache cache) { Drawable d = mContext.getSystemService(LauncherApps.class) .getShortcutIconDrawable(mInfo, LauncherAppState.getIDP(mContext).fillResIconDpi); if (d == null) { Loading src/com/android/launcher3/icons/IconCache.java +9 −14 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Utilities; import com.android.launcher3.icons.cache.BaseIconCache; import com.android.launcher3.icons.cache.CachedObject; import com.android.launcher3.icons.cache.CachedObjectCachingLogic; import com.android.launcher3.icons.cache.CachingLogic; import com.android.launcher3.icons.cache.LauncherActivityCachingLogic; import com.android.launcher3.logging.FileLog; import com.android.launcher3.model.data.AppInfo; Loading Loading @@ -92,9 +92,6 @@ public class IconCache extends BaseIconCache { private final Predicate<ItemInfoWithIcon> mIsUsingFallbackOrNonDefaultIconCheck = w -> w.bitmap != null && (w.bitmap.isNullOrLowRes() || !isDefaultIcon(w.bitmap, w.user)); private final CachingLogic<ComponentWithLabel> mComponentWithLabelCachingLogic; private final CachingLogic<LauncherActivityInfo> mLauncherActivityInfoCachingLogic; private final LauncherApps mLauncherApps; private final UserCache mUserManager; private final InstantAppResolver mInstantAppResolver; Loading @@ -108,8 +105,6 @@ public class IconCache extends BaseIconCache { IconProvider iconProvider) { super(context, dbFileName, MODEL_EXECUTOR.getLooper(), idp.fillResIconDpi, idp.iconBitmapSize, true /* inMemoryCache */, iconProvider); mComponentWithLabelCachingLogic = new CachedObjectCachingLogic(context); mLauncherActivityInfoCachingLogic = LauncherActivityCachingLogic.INSTANCE; mLauncherApps = mContext.getSystemService(LauncherApps.class); mUserManager = UserCache.INSTANCE.get(mContext); mInstantAppResolver = InstantAppResolver.newInstance(mContext); Loading Loading @@ -143,7 +138,7 @@ public class IconCache extends BaseIconCache { removeIconsForPkg(packageName, user); long userSerial = mUserManager.getSerialNumberForUser(user); for (LauncherActivityInfo app : mLauncherApps.getActivityList(packageName, user)) { addIconToDBAndMemCache(app, mLauncherActivityInfoCachingLogic, userSerial); addIconToDBAndMemCache(app, LauncherActivityCachingLogic.INSTANCE, userSerial); } } Loading Loading @@ -211,7 +206,7 @@ public class IconCache extends BaseIconCache { */ public synchronized void updateTitleAndIcon(AppInfo application) { CacheEntry entry = cacheLocked(application.componentName, application.user, () -> null, mLauncherActivityInfoCachingLogic, application.user, () -> null, LauncherActivityCachingLogic.INSTANCE, application.usingLowResIcon() ? LookupFlag.USE_LOW_RES : LookupFlag.DEFAULT); if (entry.bitmap != null || !isDefaultIcon(entry.bitmap, application.user)) { applyCacheEntry(entry, application); Loading Loading @@ -326,9 +321,9 @@ public class IconCache extends BaseIconCache { /** * Loads and returns the icon for the provided object without adding it to memCache */ public synchronized String getTitleNoCache(ComponentWithLabel info) { public synchronized String getTitleNoCache(CachedObject info) { CacheEntry entry = cacheLocked(info.getComponent(), info.getUser(), () -> info, mComponentWithLabelCachingLogic, CachedObjectCachingLogic.INSTANCE, LookupFlag.USE_LOW_RES | LookupFlag.SKIP_ADD_TO_MEM_CACHE); return Utilities.trim(entry.title); } Loading @@ -344,7 +339,7 @@ public class IconCache extends BaseIconCache { if (usePkgIcon) lookupFlags |= LookupFlag.USE_PACKAGE_ICON; if (useLowResIcon) lookupFlags |= LookupFlag.USE_LOW_RES; CacheEntry entry = cacheLocked(infoInOut.getTargetComponent(), infoInOut.user, activityInfoProvider, mLauncherActivityInfoCachingLogic, lookupFlags); activityInfoProvider, LauncherActivityCachingLogic.INSTANCE, lookupFlags); applyCacheEntry(entry, infoInOut); } Loading Loading @@ -445,7 +440,7 @@ public class IconCache extends BaseIconCache { cn, /* user = */ sectionKey.first, () -> duplicateIconRequests.get(0).launcherActivityInfo, mLauncherActivityInfoCachingLogic, LauncherActivityCachingLogic.INSTANCE, sectionKey.second ? LookupFlag.USE_LOW_RES : LookupFlag.DEFAULT, c); Loading Loading @@ -494,7 +489,7 @@ public class IconCache extends BaseIconCache { loadFallbackIcon( lai, entry, mLauncherActivityInfoCachingLogic, LauncherActivityCachingLogic.INSTANCE, /* usePackageIcon= */ false, /* usePackageTitle= */ loadFallbackTitle, cn, Loading @@ -504,7 +499,7 @@ public class IconCache extends BaseIconCache { loadFallbackTitle( lai, entry, mLauncherActivityInfoCachingLogic, LauncherActivityCachingLogic.INSTANCE, sectionKey.first); } Loading src/com/android/launcher3/icons/Legacy.ktdeleted 100644 → 0 +0 −31 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.icons import com.android.launcher3.icons.cache.CachedObject /** * This files contains some definitions used during refactoring to avoid breaking changes. * * TODO(b/366237794) remove this file once refactoring is complete */ /** Temporary interface to allow easier refactoring */ interface ComponentWithLabel : CachedObject<IconCache> /** Temporary interface to allow easier refactoring */ interface ComponentWithLabelAndIcon : ComponentWithLabel src/com/android/launcher3/model/LoaderTask.java +3 −4 Original line number Diff line number Diff line Loading @@ -72,8 +72,8 @@ import com.android.launcher3.folder.FolderNameInfos; import com.android.launcher3.folder.FolderNameProvider; import com.android.launcher3.icons.CacheableShortcutCachingLogic; import com.android.launcher3.icons.CacheableShortcutInfo; import com.android.launcher3.icons.ComponentWithLabelAndIcon; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.cache.CachedObject; import com.android.launcher3.icons.cache.CachedObjectCachingLogic; import com.android.launcher3.icons.cache.IconCacheUpdateHandler; import com.android.launcher3.icons.cache.LauncherActivityCachingLogic; Loading Loading @@ -335,8 +335,7 @@ public class LoaderTask implements Runnable { verifyNotStopped(); // fourth step List<ComponentWithLabelAndIcon> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null); List<CachedObject> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null); logASplit("load widgets"); verifyNotStopped(); Loading Loading @@ -364,7 +363,7 @@ public class LoaderTask implements Runnable { } updateHandler.updateIcons(allWidgetsList, new CachedObjectCachingLogic(mApp.getContext()), CachedObjectCachingLogic.INSTANCE, mApp.getModel()::onWidgetLabelsUpdated); logASplit("save widgets in icon cache"); Loading Loading
src/com/android/launcher3/dragndrop/AddItemActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ public class AddItemActivity extends BaseActivity new PinShortcutRequestActivityInfo(mRequest, this); mWidgetCell.getWidgetView().setTag(new PendingAddShortcutInfo(shortcutInfo)); applyWidgetItemAsync( () -> new WidgetItem(shortcutInfo, mApp.getIconCache(), getPackageManager())); () -> new WidgetItem(shortcutInfo, mApp.getIconCache())); return new PackageItemInfo(mRequest.getShortcutInfo().getPackage(), mRequest.getShortcutInfo().getUserHandle()); } Loading
src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java +3 −4 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.LauncherApps; import android.content.pm.LauncherApps.PinItemRequest; import android.content.pm.PackageManager; import android.content.pm.ShortcutInfo; import android.graphics.drawable.Drawable; import android.os.Build; Loading @@ -40,7 +39,7 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.cache.BaseIconCache; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pm.PinRequestHelper; import com.android.launcher3.pm.ShortcutConfigActivityInfo; Loading Loading @@ -82,12 +81,12 @@ public class PinShortcutRequestActivityInfo extends ShortcutConfigActivityInfo { } @Override public CharSequence getLabel(PackageManager pm) { public CharSequence getLabel() { return mInfo.getShortLabel(); } @Override public Drawable getFullResIcon(IconCache cache) { public Drawable getFullResIcon(BaseIconCache cache) { Drawable d = mContext.getSystemService(LauncherApps.class) .getShortcutIconDrawable(mInfo, LauncherAppState.getIDP(mContext).fillResIconDpi); if (d == null) { Loading
src/com/android/launcher3/icons/IconCache.java +9 −14 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Utilities; import com.android.launcher3.icons.cache.BaseIconCache; import com.android.launcher3.icons.cache.CachedObject; import com.android.launcher3.icons.cache.CachedObjectCachingLogic; import com.android.launcher3.icons.cache.CachingLogic; import com.android.launcher3.icons.cache.LauncherActivityCachingLogic; import com.android.launcher3.logging.FileLog; import com.android.launcher3.model.data.AppInfo; Loading Loading @@ -92,9 +92,6 @@ public class IconCache extends BaseIconCache { private final Predicate<ItemInfoWithIcon> mIsUsingFallbackOrNonDefaultIconCheck = w -> w.bitmap != null && (w.bitmap.isNullOrLowRes() || !isDefaultIcon(w.bitmap, w.user)); private final CachingLogic<ComponentWithLabel> mComponentWithLabelCachingLogic; private final CachingLogic<LauncherActivityInfo> mLauncherActivityInfoCachingLogic; private final LauncherApps mLauncherApps; private final UserCache mUserManager; private final InstantAppResolver mInstantAppResolver; Loading @@ -108,8 +105,6 @@ public class IconCache extends BaseIconCache { IconProvider iconProvider) { super(context, dbFileName, MODEL_EXECUTOR.getLooper(), idp.fillResIconDpi, idp.iconBitmapSize, true /* inMemoryCache */, iconProvider); mComponentWithLabelCachingLogic = new CachedObjectCachingLogic(context); mLauncherActivityInfoCachingLogic = LauncherActivityCachingLogic.INSTANCE; mLauncherApps = mContext.getSystemService(LauncherApps.class); mUserManager = UserCache.INSTANCE.get(mContext); mInstantAppResolver = InstantAppResolver.newInstance(mContext); Loading Loading @@ -143,7 +138,7 @@ public class IconCache extends BaseIconCache { removeIconsForPkg(packageName, user); long userSerial = mUserManager.getSerialNumberForUser(user); for (LauncherActivityInfo app : mLauncherApps.getActivityList(packageName, user)) { addIconToDBAndMemCache(app, mLauncherActivityInfoCachingLogic, userSerial); addIconToDBAndMemCache(app, LauncherActivityCachingLogic.INSTANCE, userSerial); } } Loading Loading @@ -211,7 +206,7 @@ public class IconCache extends BaseIconCache { */ public synchronized void updateTitleAndIcon(AppInfo application) { CacheEntry entry = cacheLocked(application.componentName, application.user, () -> null, mLauncherActivityInfoCachingLogic, application.user, () -> null, LauncherActivityCachingLogic.INSTANCE, application.usingLowResIcon() ? LookupFlag.USE_LOW_RES : LookupFlag.DEFAULT); if (entry.bitmap != null || !isDefaultIcon(entry.bitmap, application.user)) { applyCacheEntry(entry, application); Loading Loading @@ -326,9 +321,9 @@ public class IconCache extends BaseIconCache { /** * Loads and returns the icon for the provided object without adding it to memCache */ public synchronized String getTitleNoCache(ComponentWithLabel info) { public synchronized String getTitleNoCache(CachedObject info) { CacheEntry entry = cacheLocked(info.getComponent(), info.getUser(), () -> info, mComponentWithLabelCachingLogic, CachedObjectCachingLogic.INSTANCE, LookupFlag.USE_LOW_RES | LookupFlag.SKIP_ADD_TO_MEM_CACHE); return Utilities.trim(entry.title); } Loading @@ -344,7 +339,7 @@ public class IconCache extends BaseIconCache { if (usePkgIcon) lookupFlags |= LookupFlag.USE_PACKAGE_ICON; if (useLowResIcon) lookupFlags |= LookupFlag.USE_LOW_RES; CacheEntry entry = cacheLocked(infoInOut.getTargetComponent(), infoInOut.user, activityInfoProvider, mLauncherActivityInfoCachingLogic, lookupFlags); activityInfoProvider, LauncherActivityCachingLogic.INSTANCE, lookupFlags); applyCacheEntry(entry, infoInOut); } Loading Loading @@ -445,7 +440,7 @@ public class IconCache extends BaseIconCache { cn, /* user = */ sectionKey.first, () -> duplicateIconRequests.get(0).launcherActivityInfo, mLauncherActivityInfoCachingLogic, LauncherActivityCachingLogic.INSTANCE, sectionKey.second ? LookupFlag.USE_LOW_RES : LookupFlag.DEFAULT, c); Loading Loading @@ -494,7 +489,7 @@ public class IconCache extends BaseIconCache { loadFallbackIcon( lai, entry, mLauncherActivityInfoCachingLogic, LauncherActivityCachingLogic.INSTANCE, /* usePackageIcon= */ false, /* usePackageTitle= */ loadFallbackTitle, cn, Loading @@ -504,7 +499,7 @@ public class IconCache extends BaseIconCache { loadFallbackTitle( lai, entry, mLauncherActivityInfoCachingLogic, LauncherActivityCachingLogic.INSTANCE, sectionKey.first); } Loading
src/com/android/launcher3/icons/Legacy.ktdeleted 100644 → 0 +0 −31 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.icons import com.android.launcher3.icons.cache.CachedObject /** * This files contains some definitions used during refactoring to avoid breaking changes. * * TODO(b/366237794) remove this file once refactoring is complete */ /** Temporary interface to allow easier refactoring */ interface ComponentWithLabel : CachedObject<IconCache> /** Temporary interface to allow easier refactoring */ interface ComponentWithLabelAndIcon : ComponentWithLabel
src/com/android/launcher3/model/LoaderTask.java +3 −4 Original line number Diff line number Diff line Loading @@ -72,8 +72,8 @@ import com.android.launcher3.folder.FolderNameInfos; import com.android.launcher3.folder.FolderNameProvider; import com.android.launcher3.icons.CacheableShortcutCachingLogic; import com.android.launcher3.icons.CacheableShortcutInfo; import com.android.launcher3.icons.ComponentWithLabelAndIcon; import com.android.launcher3.icons.IconCache; import com.android.launcher3.icons.cache.CachedObject; import com.android.launcher3.icons.cache.CachedObjectCachingLogic; import com.android.launcher3.icons.cache.IconCacheUpdateHandler; import com.android.launcher3.icons.cache.LauncherActivityCachingLogic; Loading Loading @@ -335,8 +335,7 @@ public class LoaderTask implements Runnable { verifyNotStopped(); // fourth step List<ComponentWithLabelAndIcon> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null); List<CachedObject> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null); logASplit("load widgets"); verifyNotStopped(); Loading Loading @@ -364,7 +363,7 @@ public class LoaderTask implements Runnable { } updateHandler.updateIcons(allWidgetsList, new CachedObjectCachingLogic(mApp.getContext()), CachedObjectCachingLogic.INSTANCE, mApp.getModel()::onWidgetLabelsUpdated); logASplit("save widgets in icon cache"); Loading