Detect system_ext provenance for APKs-in-APEX

The previous code mistakenly attributes APKs contained in an APEX loaded
to the system_ext partition as coming from the system partition. This
affects, for example, where PackageManager expects the permission
allowlist to be read from (e.g. /system_ext/etc/permissions/*.xml).

Test: atest ApkInApexTests (in
I4cec3fdf05f2ab1a3b5032870a74562aed53cb95)

Change-Id: I690618727ebf9a61f07b3925b30e7631d33c4e8e
This commit is contained in:
Dario Freni
2021-11-08 13:58:33 +00:00
parent 392062ab44
commit abf29541e5

View File

@@ -152,7 +152,7 @@ final class InitAndSystemPackageHelper {
for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
ScanPartition sp = SYSTEM_PARTITIONS.get(i);
if (apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
sp.getFolder().getAbsolutePath())) {
sp.getFolder().getAbsolutePath() + File.separator)) {
return new ScanPartition(apexInfo.apexDirectory, sp, SCAN_AS_APK_IN_APEX);
}
}