Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e209b03a authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Only load the first page in grid preview

Bug: 160662425
Test: manual (verified correctness)
Merged-In: I9dc3b7d7b84924ffb588470d4b6b20431a62b6cd
Change-Id: I9dc3b7d7b84924ffb588470d4b6b20431a62b6cd
(cherry picked from commit 312cf438)
parent 3cdba9d5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -595,7 +595,10 @@ public class LauncherPreviewRenderer {
        @Override
        public WorkspaceResult call() throws Exception {
            List<ShortcutInfo> allShortcuts = new ArrayList<>();
            loadWorkspace(allShortcuts, LauncherSettings.Favorites.PREVIEW_CONTENT_URI);
            loadWorkspace(allShortcuts, LauncherSettings.Favorites.PREVIEW_CONTENT_URI,
                    LauncherSettings.Favorites.SCREEN + " = 0 or "
                    + LauncherSettings.Favorites.CONTAINER + " = "
                    + LauncherSettings.Favorites.CONTAINER_HOTSEAT);
            return new WorkspaceResult(mBgDataModel.workspaceItems, mBgDataModel.appWidgets,
                    mBgDataModel.cachedPredictedItems, null, mWidgetProvidersMap);
        }
+33 −29
Original line number Diff line number Diff line
@@ -293,10 +293,12 @@ public class LoaderTask implements Runnable {
    }

    private void loadWorkspace(List<ShortcutInfo> allDeepShortcuts) {
        loadWorkspace(allDeepShortcuts, LauncherSettings.Favorites.CONTENT_URI);
        loadWorkspace(allDeepShortcuts, LauncherSettings.Favorites.CONTENT_URI,
                null /* selection */);
    }

    protected void loadWorkspace(List<ShortcutInfo> allDeepShortcuts, Uri contentUri) {
    protected void loadWorkspace(List<ShortcutInfo> allDeepShortcuts, Uri contentUri,
            String selection) {
        final Context context = mApp.getContext();
        final ContentResolver contentResolver = context.getContentResolver();
        final PackageManagerHelper pmHelper = new PackageManagerHelper(context);
@@ -341,8 +343,8 @@ public class LoaderTask implements Runnable {

            Map<ShortcutKey, ShortcutInfo> shortcutKeyToPinnedShortcuts = new HashMap<>();
            final LoaderCursor c = new LoaderCursor(
                    contentResolver.query(contentUri, null, null, null, null), contentUri, mApp,
                    mUserManagerState);
                    contentResolver.query(contentUri, null, selection, null, null), contentUri,
                    mApp, mUserManagerState);

            try {
                final int appWidgetIdIndex = c.getColumnIndexOrThrow(
@@ -776,6 +778,7 @@ public class LoaderTask implements Runnable {
                return;
            }

            if (contentUri == LauncherSettings.Favorites.CONTENT_URI) {
                // Remove dead items
                if (c.commitDeleted()) {
                    // Remove any empty folder
@@ -805,6 +808,7 @@ public class LoaderTask implements Runnable {
                        mBgDataModel.unpinShortcut(context, key);
                    }
                }
            }

            // Sort the folder items, update ranks, and make sure all preview items are high res.
            FolderGridOrganizer verifier =