Parse "vendor/priv-app" to find privileged applications

Change-Id: Icbbafba96b7880f51ca3afcee53d5f3dd5b86a45
Signed-off-by: Jeremie GARCIA <jeremie.garcia@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
This commit is contained in:
Jeremie GARCIA
2015-11-05 18:27:59 +01:00
committed by Zhiquan Liu
parent d1c469e876
commit 904134c97d

View File

@@ -2084,8 +2084,14 @@ public class PackageManagerService extends IPackageManager.Stub {
scanDirLI(systemAppDir, PackageParser.PARSE_IS_SYSTEM
| 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.
File vendorAppDir = new File("/vendor/app");
File vendorAppDir = new File(Environment.getVendorDirectory(), "app");
try {
vendorAppDir = vendorAppDir.getCanonicalFile();
} catch (IOException e) {
@@ -12881,7 +12887,10 @@ public class PackageManagerService extends IPackageManager.Stub {
try {
final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app")
.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) {
Slog.e(TAG, "Unable to access code path " + path);
}