Replacing ItemInfoMatcher with predicate

This removed unnecessary componentName lookups when it
is not required. Many checks just rely on IDs and
userHandle

Bug: 231153610
Test: Presubmit
Change-Id: Ief93954abc5861062a9f55dc2ef181d3de106c62
This commit is contained in:
Sunny Goyal
2022-05-02 10:00:07 -07:00
parent 34f51fbfc4
commit 32084d49d3
18 changed files with 106 additions and 147 deletions

View File

@@ -27,7 +27,6 @@ import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
import java.util.ArrayList;
@@ -35,6 +34,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
@@ -128,7 +128,7 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
scheduleCallbackTask(c -> c.bindAllWidgets(widgets));
}
public void deleteAndBindComponentsRemoved(final ItemInfoMatcher matcher) {
public void deleteAndBindComponentsRemoved(final Predicate<ItemInfo> matcher) {
getModelWriter().deleteItemsFromDatabase(matcher);
// Call the components-removed callback