Replacing all int lookup flags and boolean overrides with an object to make it easier to extend options

Bug: 381897614
Bug: 366237794
Flag: EXEMPT refactor
Test: atest CacheLookupFlagTest
Change-Id: Ic89d48dd1c5dc8b0a89b1898cd7b00d9c61d6513
This commit is contained in:
Sunny Goyal committed 2024-12-12 18:32:55 -08:00
1 parent 0f0394c597
commit 18e480838a
24 files changed
+160 -66

No files matched your search

@@ -25,6 +25,7 @@ import static com.android.launcher3.LauncherPrefs.IS_FIRST_LOAD_AFTER_RESTORE;
import static com.android.launcher3.LauncherPrefs.SHOULD_SHOW_SMARTSPACE;
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
import static com.android.launcher3.icons.CacheableShortcutInfo.convertShortcutsToCacheableShortcuts;
import static com.android.launcher3.icons.cache.CacheLookupFlag.DEFAULT_LOOKUP_FLAG;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_HAS_SHORTCUT_PERMISSION;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_PRIVATE_PROFILE_QUIET_MODE_ENABLED;
import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_CHANGE_PERMISSION;
@@ -599,10 +600,10 @@ public class LoaderTask implements Runnable {
info.rank = rank;
if (info instanceof WorkspaceItemInfo wii
&& wii.usingLowResIcon()
&& wii.getMatchingLookupFlag().useLowRes()
&& wii.itemType == Favorites.ITEM_TYPE_APPLICATION
&& verifiers.stream().anyMatch(it -> it.isItemInPreview(info.rank))) {
mIconCache.getTitleAndIcon(wii, false);
mIconCache.getTitleAndIcon(wii, DEFAULT_LOOKUP_FLAG);
} else if (info instanceof AppPairInfo api) {
api.fetchHiResIconsIfNeeded(mIconCache);
}
@@ -765,7 +766,7 @@ public class LoaderTask implements Runnable {
iconRequestInfos.add(new IconRequestInfo<>(
promiseAppInfo,
/* launcherActivityInfo= */ null,
promiseAppInfo.usingLowResIcon()));
promiseAppInfo.getMatchingLookupFlag().useLowRes()));
}
}
}