mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Ensure widgets from WidgetSections.xml are included in suggestions
Additionally, let only prediction system provide suggestions, since the UI surface has been there for a while, adding locally filtered widgets from app package isn't required. Bug: 345520128 Test: Unit tests Flag: EXEMPT bugfix Change-Id: Ia97f0743fefeae750e07a694bb19d24a5cc11ffe
This commit is contained in:
@@ -32,6 +32,7 @@ import com.android.launcher3.icons.ComponentWithLabelAndIcon;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.model.data.PackageItemInfo;
|
||||
import com.android.launcher3.pm.ShortcutConfigActivityInfo;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
@@ -129,6 +130,22 @@ public class WidgetsModel {
|
||||
return packagesToWidgets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of widget component keys to corresponding widget items. Excludes the
|
||||
* shortcuts.
|
||||
*/
|
||||
public synchronized Map<ComponentKey, WidgetItem> getAllWidgetComponentsWithoutShortcuts() {
|
||||
if (!WIDGETS_ENABLED) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<ComponentKey, WidgetItem> widgetsMap = new HashMap<>();
|
||||
mWidgetsList.forEach((packageItemInfo, widgetsAndShortcuts) ->
|
||||
widgetsAndShortcuts.stream().filter(item -> item.widgetInfo != null).forEach(
|
||||
item -> widgetsMap.put(new ComponentKey(item.componentName, item.user),
|
||||
item)));
|
||||
return widgetsMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param packageUser If null, all widgets and shortcuts are updated and returned, otherwise
|
||||
* only widgets and shortcuts associated with the package/user are.
|
||||
|
||||
Reference in New Issue
Block a user