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

Commit 1c618be1 authored by Abhishek Aggarwal's avatar Abhishek Aggarwal
Browse files

MultiModeController: Pause the loader untill we add our apps

parent c9d72b5c
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package foundation.e.bliss.multimode
import android.content.Context
import com.android.launcher3.InvariantDeviceProfile
import com.android.launcher3.LauncherPrefs
import com.android.launcher3.model.ItemInstallQueue
import com.android.launcher3.model.data.AppInfo
import com.android.launcher3.util.Executors.MODEL_EXECUTOR
import foundation.e.bliss.BaseController
@@ -60,6 +61,8 @@ class MultiModeController(val context: Context, val monitor: LauncherAppMonitor)
                    onLoadAllAppsEnd(it)
                    cachedApps = null
                }
                ItemInstallQueue.INSTANCE.get(context)
                    .resumeModelPush(ItemInstallQueue.FLAG_LOADER_RUNNING)
            }

            override fun onAppSharedPreferenceChanged(key: String?) {
@@ -90,6 +93,8 @@ class MultiModeController(val context: Context, val monitor: LauncherAppMonitor)
        }

    init {
        ItemInstallQueue.INSTANCE.get(context).pauseModelPush(ItemInstallQueue.FLAG_LOADER_RUNNING)

        prefs = LauncherPrefs.get(context)
        monitor.registerCallback(mAppMonitorCallback)
    }
+1 −3
Original line number Diff line number Diff line
@@ -133,8 +133,7 @@ class LauncherModel(

    /** Adds the provided items to the workspace. */
    fun addAndBindAddedWorkspaceItems(itemList: List<Pair<ItemInfo?, Any?>?>) {
        callbacks.forEach { it.preAddApps() }
        enqueueModelUpdateTask(AddWorkspaceItemsTask(itemList))
        addAndBindAddedWorkspaceItems(itemList, animated = true, ignoreLoaded = false)
    }

    /**
@@ -152,7 +151,6 @@ class LauncherModel(
        } else {
            itemList
        }
        enqueueModelUpdateTask(AddWorkspaceItemsTask(sortedItemList))
        val addWorkspaceItemsTask =
            AddWorkspaceItemsTask(sortedItemList, ignoreLoaded)
        addWorkspaceItemsTask.setEnableAnimated(animated)
+0 −7
Original line number Diff line number Diff line
@@ -114,13 +114,6 @@ public class AddWorkspaceItemsTask implements ModelUpdateTask {
            for (Pair<ItemInfo, Object> entry : mItemList) {
                ItemInfo item = entry.first;
                if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
                    // Don't add webapk before we load system app icons
                    if (!isIgnoreLoaded() && dataModel.getAllWorkspaceItems().size() < 5 &&
                            Objects.requireNonNull(item.getTargetPackage()).startsWith(
                                    "foundation.e.webapk")) {
                        continue;
                    }

                    // Short-circuit this logic if the icon exists somewhere on the workspace
                    if (shortcutExists(dataModel, item.getIntent(), item.user)) {
                        continue;
+7 −3
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ import com.android.launcher3.util.RunnableList;
import com.android.launcher3.widget.model.WidgetsListBaseEntriesBuilder;
import com.android.launcher3.widget.model.WidgetsListBaseEntry;

import foundation.e.bliss.multimode.MultiModeController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -369,9 +371,11 @@ public class BaseLauncherBinder {
            executeCallbacksTask(c -> c.finishBindingItems(currentScreenIds), pendingExecutor);
            pendingExecutor.execute(
                    () -> {
                        if (!MultiModeController.isSingleLayerMode()) {
                            MODEL_EXECUTOR.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
                            ItemInstallQueue.INSTANCE.get(mApp.getContext())
                                    .resumeModelPush(FLAG_LOADER_RUNNING);
                        }
                    });
        }