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

Commit 0989e386 authored by Jiyong Park's avatar Jiyong Park
Browse files

Allow apps in /odm/app and /odm/priv-app (2/2)

/odm is another vendor partition other than /vendor. So,
duplicating remaining code fragments about /vendor/[app|priv-app] for /odm.

Bug: 71366495
Test: m -j
Change-Id: Ic0db416a02e3fa9a8ae03348449f68062e3d73b3
Teet: cd frameworks/base/tests/OdmApps; atest .
parent 0dba1eec
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -2877,7 +2877,8 @@ public class PackageManagerService extends IPackageManager.Stub
                            rescanFlags =
                                    scanFlags
                                    | SCAN_AS_SYSTEM;
                        } else if (FileUtils.contains(privilegedVendorAppDir, scanFile)) {
                        } else if (FileUtils.contains(privilegedVendorAppDir, scanFile)
                                || FileUtils.contains(privilegedOdmAppDir, scanFile)) {
                            reparseFlags =
                                    mDefParseFlags |
                                    PackageParser.PARSE_IS_SYSTEM_DIR;
@@ -2886,7 +2887,8 @@ public class PackageManagerService extends IPackageManager.Stub
                                    | SCAN_AS_SYSTEM
                                    | SCAN_AS_VENDOR
                                    | SCAN_AS_PRIVILEGED;
                        } else if (FileUtils.contains(vendorAppDir, scanFile)) {
                        } else if (FileUtils.contains(vendorAppDir, scanFile)
                                || FileUtils.contains(odmAppDir, scanFile)) {
                            reparseFlags =
                                    mDefParseFlags |
                                    PackageParser.PARSE_IS_SYSTEM_DIR;
@@ -11788,6 +11790,8 @@ public class PackageManagerService extends IPackageManager.Stub
            codeRoot = Environment.getOemDirectory();
        } else if (FileUtils.contains(Environment.getVendorDirectory(), codePath)) {
            codeRoot = Environment.getVendorDirectory();
        } else if (FileUtils.contains(Environment.getOdmDirectory(), codePath)) {
            codeRoot = Environment.getOdmDirectory();
        } else if (FileUtils.contains(Environment.getProductDirectory(), codePath)) {
            codeRoot = Environment.getProductDirectory();
        } else {
@@ -18217,9 +18221,11 @@ public class PackageManagerService extends IPackageManager.Stub
        try {
            final File privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app");
            final File privilegedVendorAppDir = new File(Environment.getVendorDirectory(), "priv-app");
            final File privilegedOdmAppDir = new File(Environment.getOdmDirectory(), "priv-app");
            final File privilegedProductAppDir = new File(Environment.getProductDirectory(), "priv-app");
            return path.startsWith(privilegedAppDir.getCanonicalPath())
                    || path.startsWith(privilegedVendorAppDir.getCanonicalPath())
                    || path.startsWith(privilegedOdmAppDir.getCanonicalPath())
                    || path.startsWith(privilegedProductAppDir.getCanonicalPath());
        } catch (IOException e) {
            Slog.e(TAG, "Unable to access code path " + path);
@@ -18238,7 +18244,8 @@ public class PackageManagerService extends IPackageManager.Stub
    static boolean locationIsVendor(String path) {
        try {
            return path.startsWith(Environment.getVendorDirectory().getCanonicalPath());
            return path.startsWith(Environment.getVendorDirectory().getCanonicalPath())
                    || path.startsWith(Environment.getOdmDirectory().getCanonicalPath());
        } catch (IOException e) {
            Slog.e(TAG, "Unable to access code path " + path);
        }
+4 −0
Original line number Diff line number Diff line
@@ -1240,6 +1240,10 @@ public final class DefaultPermissionGrantPolicy {
        if (dir.isDirectory() && dir.canRead()) {
            Collections.addAll(ret, dir.listFiles());
        }
        dir = new File(Environment.getOdmDirectory(), "etc/default-permissions");
        if (dir.isDirectory() && dir.canRead()) {
            Collections.addAll(ret, dir.listFiles());
        }
        dir = new File(Environment.getProductDirectory(), "etc/default-permissions");
        if (dir.isDirectory() && dir.canRead()) {
            Collections.addAll(ret, dir.listFiles());