Merge "Migrate PackageManagerHelper to MainThreadInitializedObject" into main

This commit is contained in:
Winson Chung
2024-04-23 18:10:56 +00:00
committed by Android (Google) Code Review
13 changed files with 47 additions and 34 deletions
@@ -171,7 +171,7 @@ public class InstallSessionHelper implements SafeCloseable {
synchronized (mSessionVerifiedMap) {
if (!mSessionVerifiedMap.containsKey(pkg)) {
boolean hasSystemFlag = DEBUG || mAppContext.getPackageName().equals(pkg)
|| new PackageManagerHelper(mAppContext)
|| PackageManagerHelper.INSTANCE.get(mAppContext)
.getApplicationInfo(pkg, user, ApplicationInfo.FLAG_SYSTEM) != null;
mSessionVerifiedMap.put(pkg, hasSystemFlag);
}
@@ -245,7 +245,7 @@ public class InstallSessionHelper implements SafeCloseable {
&& sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
&& sessionInfo.getAppIcon() != null
&& !TextUtils.isEmpty(sessionInfo.getAppLabel())
&& !new PackageManagerHelper(mAppContext).isAppInstalled(
&& !PackageManagerHelper.INSTANCE.get(mAppContext).isAppInstalled(
sessionInfo.getAppPackageName(), getUserHandle(sessionInfo));
}