Do not use PackageManagerHelper created on boot for LoaderTask.

This CL partially reverts ag/26827295.

Re-using the PackageManagerHelper obj created earlier than LoaderTask obj will lead to the bug where private space user handle is not recognized. This is a temporary fix to create a separate PackageManagerHelper obj for LoaderTask. The real fix should be on framework side.

Also note that PackageManager service instance is now created much later in launcher lifecycle than before.

Fix: 338091143
Test: manual
Flag: NONE
Change-Id: Iab467fe8979aec52c5837c8fd676f821b2e3eb3c
This commit is contained in:
Fengjiang Li
2024-05-10 14:26:13 -07:00
parent 42af1f0725
commit 1db1dfcb67

View File

@@ -171,7 +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());
mPmHelper = new PackageManagerHelper(mApp.getContext());
mSessionHelper = InstallSessionHelper.INSTANCE.get(mApp.getContext());
mIconCache = mApp.getIconCache();
mUserManagerState = userManagerState;