Merge "[pm] do not call prepareAppDataAfterInstallLIF from inside mLock" into tm-dev

This commit is contained in:
Songchun Fan
2022-03-04 17:04:23 +00:00
committed by Android (Google) Code Review

View File

@@ -2988,7 +2988,6 @@ final class InstallPackageHelper {
* APK will be installed and the package will be disabled. To recover from this situation, * APK will be installed and the package will be disabled. To recover from this situation,
* the user will need to go into system settings and re-enable the package. * the user will need to go into system settings and re-enable the package.
*/ */
@GuardedBy({"mPm.mLock", "mPm.mInstallLock"})
boolean enableCompressedPackage(AndroidPackage stubPkg, boolean enableCompressedPackage(AndroidPackage stubPkg,
@NonNull PackageSetting stubPkgSetting) { @NonNull PackageSetting stubPkgSetting) {
final int parseFlags = mPm.getDefParseFlags() | ParsingPackageUtils.PARSE_CHATTY final int parseFlags = mPm.getDefParseFlags() | ParsingPackageUtils.PARSE_CHATTY
@@ -2998,8 +2997,8 @@ final class InstallPackageHelper {
try (PackageFreezer freezer = try (PackageFreezer freezer =
mPm.freezePackage(stubPkg.getPackageName(), "setEnabledSetting")) { mPm.freezePackage(stubPkg.getPackageName(), "setEnabledSetting")) {
pkg = installStubPackageLI(stubPkg, parseFlags, 0 /*scanFlags*/); pkg = installStubPackageLI(stubPkg, parseFlags, 0 /*scanFlags*/);
synchronized (mPm.mLock) {
mAppDataHelper.prepareAppDataAfterInstallLIF(pkg); mAppDataHelper.prepareAppDataAfterInstallLIF(pkg);
synchronized (mPm.mLock) {
try { try {
mSharedLibraries.updateSharedLibrariesLPw( mSharedLibraries.updateSharedLibrariesLPw(
pkg, stubPkgSetting, null, null, pkg, stubPkgSetting, null, null,
@@ -3056,7 +3055,7 @@ final class InstallPackageHelper {
return true; return true;
} }
@GuardedBy({"mPm.mLock", "mPm.mInstallLock"}) @GuardedBy("mPm.mInstallLock")
private AndroidPackage installStubPackageLI(AndroidPackage stubPkg, private AndroidPackage installStubPackageLI(AndroidPackage stubPkg,
@ParsingPackageUtils.ParseFlags int parseFlags, @ParsingPackageUtils.ParseFlags int parseFlags,
@PackageManagerService.ScanFlags int scanFlags) @PackageManagerService.ScanFlags int scanFlags)
@@ -3149,7 +3148,7 @@ final class InstallPackageHelper {
mPm.mSettings.enableSystemPackageLPw(disabledPs.getPkg().getPackageName()); mPm.mSettings.enableSystemPackageLPw(disabledPs.getPkg().getPackageName());
// Remove any native libraries from the upgraded package. // Remove any native libraries from the upgraded package.
PackageManagerServiceUtils.removeNativeBinariesLI(deletedPs); PackageManagerServiceUtils.removeNativeBinariesLI(deletedPs);
}
// Install the system package // Install the system package
if (DEBUG_REMOVE) Slog.d(TAG, "Re-installing system package: " + disabledPs); if (DEBUG_REMOVE) Slog.d(TAG, "Re-installing system package: " + disabledPs);
try { try {
@@ -3170,6 +3169,7 @@ final class InstallPackageHelper {
// We've re-installed the stub; make sure it's disabled here. If package was // We've re-installed the stub; make sure it's disabled here. If package was
// originally enabled, we'll install the compressed version of the application // originally enabled, we'll install the compressed version of the application
// and re-enable it afterward. // and re-enable it afterward.
synchronized (mPm.mLock) {
disableStubPackage(action, deletedPs, allUserHandles); disableStubPackage(action, deletedPs, allUserHandles);
} }
} }
@@ -3197,7 +3197,7 @@ final class InstallPackageHelper {
/** /**
* Installs a package that's already on the system partition. * Installs a package that's already on the system partition.
*/ */
@GuardedBy({"mPm.mLock", "mPm.mInstallLock"}) @GuardedBy("mPm.mInstallLock")
private void installPackageFromSystemLIF(@NonNull String codePathString, private void installPackageFromSystemLIF(@NonNull String codePathString,
@NonNull int[] allUserHandles, @Nullable int[] origUserHandles, @NonNull int[] allUserHandles, @Nullable int[] origUserHandles,
boolean writeSettings, int previousAppId) boolean writeSettings, int previousAppId)