Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abf29541 authored by Dario Freni's avatar Dario Freni
Browse files

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
parent 392062ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -152,7 +152,7 @@ final class InitAndSystemPackageHelper {
        for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
        for (int i = 0, size = SYSTEM_PARTITIONS.size(); i < size; i++) {
            ScanPartition sp = SYSTEM_PARTITIONS.get(i);
            ScanPartition sp = SYSTEM_PARTITIONS.get(i);
            if (apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
            if (apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
                    sp.getFolder().getAbsolutePath())) {
                    sp.getFolder().getAbsolutePath() + File.separator)) {
                return new ScanPartition(apexInfo.apexDirectory, sp, SCAN_AS_APK_IN_APEX);
                return new ScanPartition(apexInfo.apexDirectory, sp, SCAN_AS_APK_IN_APEX);
            }
            }
        }
        }