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

Commit 826ef948 authored by Jeremie GARCIA's avatar Jeremie GARCIA Committed by android-build-merger
Browse files

Merge "Parse "vendor/priv-app" to find privileged applications" am: 8560d210

am: 5094996c

* commit '5094996c':
  Parse "vendor/priv-app" to find privileged applications
parents d93476b4 5094996c
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -2231,8 +2231,14 @@ public class PackageManagerService extends IPackageManager.Stub {
            scanDirTracedLI(systemAppDir, PackageParser.PARSE_IS_SYSTEM
            scanDirTracedLI(systemAppDir, PackageParser.PARSE_IS_SYSTEM
                    | PackageParser.PARSE_IS_SYSTEM_DIR, scanFlags, 0);
                    | PackageParser.PARSE_IS_SYSTEM_DIR, scanFlags, 0);
            // Collected privileged vendor packages.
            final File privilegedVendorAppDir = new File(Environment.getVendorDirectory(), "priv-app");
            scanDirLI(privilegedVendorAppDir, PackageParser.PARSE_IS_SYSTEM
                    | PackageParser.PARSE_IS_SYSTEM_DIR
                    | PackageParser.PARSE_IS_PRIVILEGED, scanFlags, 0);
            // Collect all vendor packages.
            // Collect all vendor packages.
            File vendorAppDir = new File("/vendor/app");
            File vendorAppDir = new File(Environment.getVendorDirectory(), "app");
            try {
            try {
                vendorAppDir = vendorAppDir.getCanonicalFile();
                vendorAppDir = vendorAppDir.getCanonicalFile();
            } catch (IOException e) {
            } catch (IOException e) {
@@ -14601,7 +14607,10 @@ public class PackageManagerService extends IPackageManager.Stub {
        try {
        try {
            final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app")
            final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app")
                    .getCanonicalPath();
                    .getCanonicalPath();
            return path.getCanonicalPath().startsWith(privilegedAppDir);
            final String privilegedAppVendorDir = new File(Environment.getVendorDirectory(), "priv-app")
                    .getCanonicalPath();
            return (path.getCanonicalPath().startsWith(privilegedAppDir)
                    || path.getCanonicalPath().startsWith(privilegedAppVendorDir));
        } catch (IOException e) {
        } catch (IOException e) {
            Slog.e(TAG, "Unable to access code path " + path);
            Slog.e(TAG, "Unable to access code path " + path);
        }
        }