Loading quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -52,8 +52,7 @@ public class HotseatPredictionModel { public static Bundle convertDataModelToAppTargetBundle(Context context, BgDataModel dataModel) { public static Bundle convertDataModelToAppTargetBundle(Context context, BgDataModel dataModel) { Bundle bundle = new Bundle(); Bundle bundle = new Bundle(); ArrayList<AppTargetEvent> events = new ArrayList<>(); ArrayList<AppTargetEvent> events = new ArrayList<>(); ArrayList<ItemInfo> workspaceItems = new ArrayList<>(dataModel.workspaceItems); ArrayList<ItemInfo> workspaceItems = dataModel.getAllWorkspaceItems(); workspaceItems.addAll(dataModel.appWidgets); for (ItemInfo item : workspaceItems) { for (ItemInfo item : workspaceItems) { AppTarget target = getAppTargetFromInfo(context, item); AppTarget target = getAppTargetFromInfo(context, item); if (target != null && !isTrackedForPrediction(item)) continue; if (target != null && !isTrackedForPrediction(item)) continue; Loading src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +7 −5 Original line number Original line Diff line number Diff line Loading @@ -629,6 +629,7 @@ public class LauncherPreviewRenderer extends ContextThemeWrapper private WorkspaceResult(BgDataModel dataModel, private WorkspaceResult(BgDataModel dataModel, WidgetsModel widgetsModel, WidgetsModel widgetsModel, Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) { Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) { synchronized (dataModel) { mWorkspaceItems = dataModel.workspaceItems; mWorkspaceItems = dataModel.workspaceItems; mAppWidgets = dataModel.appWidgets; mAppWidgets = dataModel.appWidgets; mHotseatPredictions = dataModel.extraItems.get(CONTAINER_HOTSEAT_PREDICTION); mHotseatPredictions = dataModel.extraItems.get(CONTAINER_HOTSEAT_PREDICTION); Loading @@ -637,3 +638,4 @@ public class LauncherPreviewRenderer extends ContextThemeWrapper } } } } } } } src/com/android/launcher3/model/BgDataModel.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -375,6 +375,16 @@ public class BgDataModel { } } } } /** * Returns a list containing all workspace items including widgets. */ public synchronized ArrayList<ItemInfo> getAllWorkspaceItems() { ArrayList<ItemInfo> items = new ArrayList<>(workspaceItems.size() + appWidgets.size()); items.addAll(workspaceItems); items.addAll(appWidgets); return items; } /** /** * Calls the provided {@code op} for all workspaceItems in the in-memory model (both persisted * Calls the provided {@code op} for all workspaceItems in the in-memory model (both persisted * items and dynamic/predicted items for the provided {@code userHandle}. * items and dynamic/predicted items for the provided {@code userHandle}. Loading src/com/android/launcher3/model/LoaderTask.java +7 −10 Original line number Original line Diff line number Diff line Loading @@ -166,12 +166,7 @@ public class LoaderTask implements Runnable { private void sendFirstScreenActiveInstallsBroadcast() { private void sendFirstScreenActiveInstallsBroadcast() { ArrayList<ItemInfo> firstScreenItems = new ArrayList<>(); ArrayList<ItemInfo> firstScreenItems = new ArrayList<>(); ArrayList<ItemInfo> allItems = mBgDataModel.getAllWorkspaceItems(); ArrayList<ItemInfo> allItems = new ArrayList<>(); synchronized (mBgDataModel) { allItems.addAll(mBgDataModel.workspaceItems); allItems.addAll(mBgDataModel.appWidgets); } // Screen set is never empty // Screen set is never empty final int firstScreen = mBgDataModel.collectWorkspaceScreens().get(0); final int firstScreen = mBgDataModel.collectWorkspaceScreens().get(0); Loading Loading @@ -858,11 +853,13 @@ public class LoaderTask implements Runnable { .call(contentResolver, .call(contentResolver, LauncherSettings.Settings.METHOD_DELETE_EMPTY_FOLDERS) LauncherSettings.Settings.METHOD_DELETE_EMPTY_FOLDERS) .getIntArray(LauncherSettings.Settings.EXTRA_VALUE); .getIntArray(LauncherSettings.Settings.EXTRA_VALUE); synchronized (mBgDataModel) { for (int folderId : deletedFolderIds) { for (int folderId : deletedFolderIds) { mBgDataModel.workspaceItems.remove(mBgDataModel.folders.get(folderId)); mBgDataModel.workspaceItems.remove(mBgDataModel.folders.get(folderId)); mBgDataModel.folders.remove(folderId); mBgDataModel.folders.remove(folderId); mBgDataModel.itemsIdMap.remove(folderId); mBgDataModel.itemsIdMap.remove(folderId); } } } // Remove any ghost widgets // Remove any ghost widgets LauncherSettings.Settings.call(contentResolver, LauncherSettings.Settings.call(contentResolver, Loading Loading
quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -52,8 +52,7 @@ public class HotseatPredictionModel { public static Bundle convertDataModelToAppTargetBundle(Context context, BgDataModel dataModel) { public static Bundle convertDataModelToAppTargetBundle(Context context, BgDataModel dataModel) { Bundle bundle = new Bundle(); Bundle bundle = new Bundle(); ArrayList<AppTargetEvent> events = new ArrayList<>(); ArrayList<AppTargetEvent> events = new ArrayList<>(); ArrayList<ItemInfo> workspaceItems = new ArrayList<>(dataModel.workspaceItems); ArrayList<ItemInfo> workspaceItems = dataModel.getAllWorkspaceItems(); workspaceItems.addAll(dataModel.appWidgets); for (ItemInfo item : workspaceItems) { for (ItemInfo item : workspaceItems) { AppTarget target = getAppTargetFromInfo(context, item); AppTarget target = getAppTargetFromInfo(context, item); if (target != null && !isTrackedForPrediction(item)) continue; if (target != null && !isTrackedForPrediction(item)) continue; Loading
src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +7 −5 Original line number Original line Diff line number Diff line Loading @@ -629,6 +629,7 @@ public class LauncherPreviewRenderer extends ContextThemeWrapper private WorkspaceResult(BgDataModel dataModel, private WorkspaceResult(BgDataModel dataModel, WidgetsModel widgetsModel, WidgetsModel widgetsModel, Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) { Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) { synchronized (dataModel) { mWorkspaceItems = dataModel.workspaceItems; mWorkspaceItems = dataModel.workspaceItems; mAppWidgets = dataModel.appWidgets; mAppWidgets = dataModel.appWidgets; mHotseatPredictions = dataModel.extraItems.get(CONTAINER_HOTSEAT_PREDICTION); mHotseatPredictions = dataModel.extraItems.get(CONTAINER_HOTSEAT_PREDICTION); Loading @@ -637,3 +638,4 @@ public class LauncherPreviewRenderer extends ContextThemeWrapper } } } } } } }
src/com/android/launcher3/model/BgDataModel.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -375,6 +375,16 @@ public class BgDataModel { } } } } /** * Returns a list containing all workspace items including widgets. */ public synchronized ArrayList<ItemInfo> getAllWorkspaceItems() { ArrayList<ItemInfo> items = new ArrayList<>(workspaceItems.size() + appWidgets.size()); items.addAll(workspaceItems); items.addAll(appWidgets); return items; } /** /** * Calls the provided {@code op} for all workspaceItems in the in-memory model (both persisted * Calls the provided {@code op} for all workspaceItems in the in-memory model (both persisted * items and dynamic/predicted items for the provided {@code userHandle}. * items and dynamic/predicted items for the provided {@code userHandle}. Loading
src/com/android/launcher3/model/LoaderTask.java +7 −10 Original line number Original line Diff line number Diff line Loading @@ -166,12 +166,7 @@ public class LoaderTask implements Runnable { private void sendFirstScreenActiveInstallsBroadcast() { private void sendFirstScreenActiveInstallsBroadcast() { ArrayList<ItemInfo> firstScreenItems = new ArrayList<>(); ArrayList<ItemInfo> firstScreenItems = new ArrayList<>(); ArrayList<ItemInfo> allItems = mBgDataModel.getAllWorkspaceItems(); ArrayList<ItemInfo> allItems = new ArrayList<>(); synchronized (mBgDataModel) { allItems.addAll(mBgDataModel.workspaceItems); allItems.addAll(mBgDataModel.appWidgets); } // Screen set is never empty // Screen set is never empty final int firstScreen = mBgDataModel.collectWorkspaceScreens().get(0); final int firstScreen = mBgDataModel.collectWorkspaceScreens().get(0); Loading Loading @@ -858,11 +853,13 @@ public class LoaderTask implements Runnable { .call(contentResolver, .call(contentResolver, LauncherSettings.Settings.METHOD_DELETE_EMPTY_FOLDERS) LauncherSettings.Settings.METHOD_DELETE_EMPTY_FOLDERS) .getIntArray(LauncherSettings.Settings.EXTRA_VALUE); .getIntArray(LauncherSettings.Settings.EXTRA_VALUE); synchronized (mBgDataModel) { for (int folderId : deletedFolderIds) { for (int folderId : deletedFolderIds) { mBgDataModel.workspaceItems.remove(mBgDataModel.folders.get(folderId)); mBgDataModel.workspaceItems.remove(mBgDataModel.folders.get(folderId)); mBgDataModel.folders.remove(folderId); mBgDataModel.folders.remove(folderId); mBgDataModel.itemsIdMap.remove(folderId); mBgDataModel.itemsIdMap.remove(folderId); } } } // Remove any ghost widgets // Remove any ghost widgets LauncherSettings.Settings.call(contentResolver, LauncherSettings.Settings.call(contentResolver, Loading