mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Only fetching relevant widget info during first pass
This avoids loading resources for allwidget providers when they are not added to homescreen. Test: Verified on device Bug: 180867488 Change-Id: If9adde8eb035ecac75dc4e3e37cd3f0f526865e5
This commit is contained in:
@@ -31,14 +31,11 @@ import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.widget.custom.CustomWidgetManager;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -122,15 +119,6 @@ public class WidgetManagerHelper {
|
||||
appWidgetId).getBoolean(WIDGET_OPTION_RESTORE_COMPLETED);
|
||||
}
|
||||
|
||||
public static Map<ComponentKey, AppWidgetProviderInfo> getAllProvidersMap(Context context) {
|
||||
if (WidgetsModel.GO_DISABLE_WIDGETS) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return allWidgetsSteam(context).collect(
|
||||
Collectors.toMap(info -> new ComponentKey(info.provider, info.getProfile()),
|
||||
Function.identity()));
|
||||
}
|
||||
|
||||
private static Stream<AppWidgetProviderInfo> allWidgetsSteam(Context context) {
|
||||
AppWidgetManager awm = context.getSystemService(AppWidgetManager.class);
|
||||
return Stream.concat(
|
||||
|
||||
Reference in New Issue
Block a user