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

Commit e856a2c5 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

feat: Defer onLoadAllAppsEnd if launcherModel is null atm

parent 9b70b218
Loading
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -34,12 +34,32 @@ class MultiModeController(val context: Context, val monitor: LauncherAppMonitor)
    private val idp by lazy { InvariantDeviceProfile.INSTANCE.get(context) }
    private val mAppMonitorCallback: LauncherAppMonitorCallback =
        object : LauncherAppMonitorCallback {
            private var cachedApps: ArrayList<AppInfo?>? = null

            override fun onLoadAllAppsEnd(apps: ArrayList<AppInfo?>?) {
                val launcher = monitor.launcher ?: return
                val model = launcher.model ?: return
                val launcherModel = monitor.launcher?.model
                if (launcherModel != null) {
                    MODEL_EXECUTOR.submit(
                    VerifyIdleAppTask(context, apps, null, null, false, model.mBgDataModel)
                        VerifyIdleAppTask(
                            context,
                            apps,
                            null,
                            null,
                            false,
                            launcherModel.mBgDataModel,
                        )
                    )
                } else {
                    cachedApps = apps
                }
            }

            override fun onLauncherCreated() {
                super.onLauncherCreated()
                cachedApps?.let {
                    onLoadAllAppsEnd(it)
                    cachedApps = null
                }
            }

            override fun onAppSharedPreferenceChanged(key: String?) {