mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 00:36:49 +00:00
Migrate PackageManagerHelper to MainThreadInitializedObject
- This is in preparation for other things that can be loaded with PMH initialization and prevents duplicate temporary helpers from loading this many times. - Most calls in PMH can use the app context, but one call requires starting activities/showing toasts so that one needs to take the context and can be made static instead. Bug: 323112914 Test: atest NexusLauncherTests Change-Id: Id11c780955880cf49c022cbf2744c41e1b696355
This commit is contained in:
@@ -138,6 +138,7 @@ public class LoaderTask implements Runnable {
|
||||
private final LauncherApps mLauncherApps;
|
||||
private final UserManager mUserManager;
|
||||
private final UserCache mUserCache;
|
||||
private final PackageManagerHelper mPmHelper;
|
||||
|
||||
private final InstallSessionHelper mSessionHelper;
|
||||
private final IconCache mIconCache;
|
||||
@@ -170,6 +171,7 @@ public class LoaderTask implements Runnable {
|
||||
mLauncherApps = mApp.getContext().getSystemService(LauncherApps.class);
|
||||
mUserManager = mApp.getContext().getSystemService(UserManager.class);
|
||||
mUserCache = UserCache.INSTANCE.get(mApp.getContext());
|
||||
mPmHelper = PackageManagerHelper.INSTANCE.get(mApp.getContext());
|
||||
mSessionHelper = InstallSessionHelper.INSTANCE.get(mApp.getContext());
|
||||
mIconCache = mApp.getIconCache();
|
||||
mUserManagerState = userManagerState;
|
||||
@@ -407,7 +409,6 @@ public class LoaderTask implements Runnable {
|
||||
@Nullable LoaderMemoryLogger memoryLogger,
|
||||
@Nullable LauncherRestoreEventLogger restoreEventLogger) {
|
||||
final Context context = mApp.getContext();
|
||||
final PackageManagerHelper pmHelper = new PackageManagerHelper(context);
|
||||
final boolean isSdCardReady = Utilities.isBootCompleted();
|
||||
final WidgetInflater widgetInflater = new WidgetInflater(context);
|
||||
|
||||
@@ -447,7 +448,7 @@ public class LoaderTask implements Runnable {
|
||||
mUserCache, mUserManagerState, mLauncherApps, mPendingPackages,
|
||||
mShortcutKeyToPinnedShortcuts, mApp, mBgDataModel,
|
||||
mWidgetProvidersMap, installingPkgs, isSdCardReady,
|
||||
widgetInflater, pmHelper, iconRequestInfos, unlockedUsers,
|
||||
widgetInflater, mPmHelper, iconRequestInfos, unlockedUsers,
|
||||
allDeepShortcuts);
|
||||
|
||||
while (!mStopped && c.moveToNext()) {
|
||||
|
||||
Reference in New Issue
Block a user