Moving predicted items to ItemIdMap instead of extraItems

> This allows the whole workspace model to be contained in itemIdMap instead of spread across multiple data containers
> Deprecating extraItems, all non-workspace data should use separate repositories
> Design: http://go/launchermodel-re-arch?#heading=h.5y8n4r164d5s

Bug: 390572144
Test: atest PredictionUpdateTaskTest
Flag: EXEMPT refactor
Change-Id: I886d0a8d5bbbf9f5c2054d4a2442bf03f9c4eab5
This commit is contained in:
Sunny Goyal
2025-04-30 15:37:23 -07:00
parent cf29edfa2f
commit aef6c7932e
31 changed files with 419 additions and 228 deletions
@@ -21,6 +21,7 @@ import static com.android.launcher3.util.LauncherModelHelper.TEST_ACTIVITY2;
import static com.android.launcher3.util.LauncherModelHelper.TEST_ACTIVITY3;
import static com.android.launcher3.util.LauncherModelHelper.TEST_PACKAGE;
import static com.android.launcher3.util.ModelTestExtensions.getBgDataModel;
import static com.android.launcher3.util.ModelTestExtensions.nonPredictedItemCount;
import static com.android.launcher3.util.TestUtil.runOnExecutorSync;
import static org.junit.Assert.assertEquals;
@@ -84,7 +85,7 @@ public class PackageInstallStateChangedTaskTest {
mDownloadingApps = IntSet.wrap(4, 5, 6, 7, 8, 9, 10);
mLayoutProvider.setupDefaultLayoutProvider(builder);
ModelTestExtensions.INSTANCE.loadModelSync(getModel());
assertEquals(10, getBgDataModel(getModel()).itemsIdMap.size());
assertEquals(10, nonPredictedItemCount(getBgDataModel(getModel()).itemsIdMap));
}
private PackageInstallStateChangedTask newTask(String pkg, int progress) {
@@ -128,6 +129,7 @@ public class PackageInstallStateChangedTaskTest {
private void verifyProgressUpdate(int progress, int... idsUpdated) {
IntSet updates = IntSet.wrap(idsUpdated);
for (ItemInfo info : getBgDataModel(getModel()).itemsIdMap) {
if (info.id < 0) continue;
int expectedProgress = updates.contains(info.id) ? progress
: (mDownloadingApps.contains(info.id) ? 0 : 100);
if (info instanceof WorkspaceItemInfo wi) {