Set scan flags correctly for preloaded applications

Folowing scenario was observed:
1. Application build and installed without any native library
built inside it
2. In the next SW update the same application is built with
a native library bundled inside the apk.
When upgrading the SW, because SW update was not detected,
primaryCpuAbi was not set. This resulted in the system
not looking into the path derived from the ABI for native
libraries.

This happens becase of two reasons:
1. SCAN_FIRST_BOOT_OR_UPGRADE is not set because
PackageManagerService does not detect correctly update scenario.
2. SCAN_FIRST_BOOT_OR_UPGRADE is not added to mSystemScanFlags

Bug: 239073616
Test: will add ota test
Change-Id: I2ba73fcfcc46d7ddf14c2fb4dbf877f3252e7a50
Merged-In: I2ba73fcfcc46d7ddf14c2fb4dbf877f3252e7a50
This commit is contained in:
Sebastian Achim
2022-07-08 13:48:32 +02:00
committed by Songchun Fan
parent 8a09c9a244
commit 73d448687c
2 changed files with 4 additions and 3 deletions

View File

@@ -113,7 +113,7 @@ final class InitAppsHelper {
mScanFlags = scanFlags;
}
mSystemParseFlags = mPm.getDefParseFlags() | ParsingPackageUtils.PARSE_IS_SYSTEM_DIR;
mSystemScanFlags = scanFlags | SCAN_AS_SYSTEM;
mSystemScanFlags = mScanFlags | SCAN_AS_SYSTEM;
mExecutorService = ParallelPackageParser.makeExecutorService();
}

View File

@@ -1836,8 +1836,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService
mAppDataHelper = new AppDataHelper(this);
mInstallPackageHelper = new InstallPackageHelper(this, mAppDataHelper);
mRemovePackageHelper = new RemovePackageHelper(this, mAppDataHelper);
mInitAppsHelper = new InitAppsHelper(this, mApexManager, mInstallPackageHelper,
mInjector.getSystemPartitions());
mDeletePackageHelper = new DeletePackageHelper(this, mRemovePackageHelper,
mAppDataHelper);
mSharedLibraries.setDeletePackageHelper(mDeletePackageHelper);
@@ -1958,6 +1956,9 @@ public class PackageManagerService implements PackageSender, TestUtilityService
+ ver.fingerprint + " to " + PackagePartitions.FINGERPRINT);
}
mInitAppsHelper = new InitAppsHelper(this, mApexManager, mInstallPackageHelper,
mInjector.getSystemPartitions());
// when upgrading from pre-M, promote system app permissions from install to runtime
mPromoteSystemApps =
mIsUpgrade && ver.sdkVersion <= Build.VERSION_CODES.LOLLIPOP_MR1;