Updating ItemInfoMatcher to work with java streams
Adding support for bulk removing items from a folder icon. This fixes workspace item removal when a folder gets replaced to an icon during the delete operation. - Lets say user has a folder with the same app twice. - User disables that app. - Launcher removes all shorcuts of that app However, because we call "replaceFolderWithFinalItem" during this removal, we end up creating a new shortcut that does not get tracked by the removal, so the user is left with an enabled icon of the disabled app. Bug: 162378169 Test: manual test, repo steps in bug Change-Id: Iaf6550894c156b3b5ec2a5aa58bab76a4a28819e
This commit is contained in:
@@ -51,6 +51,7 @@ import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
* Class for handling model updates.
|
||||
@@ -259,7 +260,9 @@ public class ModelWriter {
|
||||
* Removes all the items from the database matching {@param matcher}.
|
||||
*/
|
||||
public void deleteItemsFromDatabase(ItemInfoMatcher matcher) {
|
||||
deleteItemsFromDatabase(matcher.filterItemInfos(mBgDataModel.itemsIdMap));
|
||||
deleteItemsFromDatabase(StreamSupport.stream(mBgDataModel.itemsIdMap.spliterator(), false)
|
||||
.filter(matcher::matchesInfo)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user