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

Commit 7f28b881 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Moving data sanitization to the end, as it need not block the loading"...

Merge "Moving data sanitization to the end, as it need not block the loading" into ub-launcher3-master
parents e7c1769e 77ca1e4c
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -128,6 +128,8 @@ public class LoaderTask implements Runnable {

    private boolean mStopped;

    private boolean mItemsDeleted = false;

    public LoaderTask(LauncherAppState app, AllAppsList bgAllAppsList, BgDataModel dataModel,
            ModelDelegate modelDelegate, LoaderResults results) {
        mApp = app;
@@ -271,6 +273,7 @@ public class LoaderTask implements Runnable {
            if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
                loadFolderNames();
            }
            sanitizeData();

            verifyNotStopped();
            updateHandler.finish();
@@ -791,14 +794,9 @@ public class LoaderTask implements Runnable {
                    mBgDataModel.itemsIdMap.remove(folderId);
                }

                // Remove any ghost widgets
                LauncherSettings.Settings.call(contentResolver,
                        LauncherSettings.Settings.METHOD_REMOVE_GHOST_WIDGETS);
                mItemsDeleted = true;
            }

            // Update pinned state of model shortcuts
            mBgDataModel.updateShortcutPinnedState(context);

            // Sort the folder items, update ranks, and make sure all preview items are high res.
            FolderGridOrganizer verifier =
                    new FolderGridOrganizer(mApp.getInvariantDeviceProfile());
@@ -872,6 +870,18 @@ public class LoaderTask implements Runnable {
        }
    }

    private void sanitizeData() {
        Context context = mApp.getContext();
        if (mItemsDeleted) {
            // Remove any ghost widgets
            LauncherSettings.Settings.call(context.getContentResolver(),
                    LauncherSettings.Settings.METHOD_REMOVE_GHOST_WIDGETS);
        }

        // Update pinned state of model shortcuts
        mBgDataModel.updateShortcutPinnedState(context);
    }

    private List<LauncherActivityInfo> loadAllApps() {
        final List<UserHandle> profiles = mUserCache.getUserProfiles();
        List<LauncherActivityInfo> allActivityList = new ArrayList<>();