Consider overlay in system_ext as system's
When there is overlay package in system_ext, turn on POLICY_SYSTEM_PARTITION.
In other words, overlay pacakge in /system_ext is considered as system's one
Test: mv vendor/overlay/framework-res__auto_generated_rro.apk system_ext/overlay
and then check if it works properly.
Bug: 136715327
Change-Id: Ib225368eae41203a8630f4310d26e9cf1afa706a
This commit is contained in:
@@ -103,6 +103,7 @@ std::vector<std::string> PoliciesForPath(const std::string& apk_path) {
|
||||
{"/oem/", kPolicyOem},
|
||||
{"/product/", kPolicyProduct},
|
||||
{"/system/", kPolicySystem},
|
||||
{"/system_ext/", kPolicySystem},
|
||||
{"/vendor/", kPolicyVendor},
|
||||
};
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
|
||||
}
|
||||
|
||||
// Generic idmap parameters
|
||||
const char* argv[10];
|
||||
const char* argv[11];
|
||||
int argc = 0;
|
||||
struct stat st;
|
||||
|
||||
@@ -193,8 +193,8 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
|
||||
argv[argc++] = AssetManager::PRODUCT_OVERLAY_DIR;
|
||||
}
|
||||
|
||||
if (stat(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR, &st) == 0) {
|
||||
argv[argc++] = AssetManager::PRODUCT_SERVICES_OVERLAY_DIR;
|
||||
if (stat(AssetManager::SYSTEM_EXT_OVERLAY_DIR, &st) == 0) {
|
||||
argv[argc++] = AssetManager::SYSTEM_EXT_OVERLAY_DIR;
|
||||
}
|
||||
|
||||
if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
|
||||
@@ -235,8 +235,8 @@ static jobjectArray NativeCreateIdmapsForStaticOverlaysTargetingAndroid(JNIEnv*
|
||||
input_dirs.push_back(AssetManager::PRODUCT_OVERLAY_DIR);
|
||||
}
|
||||
|
||||
if (stat(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR, &st) == 0) {
|
||||
input_dirs.push_back(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR);
|
||||
if (stat(AssetManager::SYSTEM_EXT_OVERLAY_DIR, &st) == 0) {
|
||||
input_dirs.push_back(AssetManager::SYSTEM_EXT_OVERLAY_DIR);
|
||||
}
|
||||
|
||||
if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
|
||||
|
||||
@@ -100,8 +100,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|
||||
static const char* kVendorOverlaySubdir = "/system/vendor/overlay-subdir/";
|
||||
static const char* kSystemProductOverlayDir = "/system/product/overlay/";
|
||||
static const char* kProductOverlayDir = "/product/overlay";
|
||||
static const char* kSystemProductServicesOverlayDir = "/system/product_services/overlay/";
|
||||
static const char* kProductServicesOverlayDir = "/product_services/overlay";
|
||||
static const char* kSystemSystemExtOverlayDir = "/system/system_ext/overlay/";
|
||||
static const char* kSystemExtOverlayDir = "/system_ext/overlay";
|
||||
static const char* kSystemOdmOverlayDir = "/system/odm/overlay";
|
||||
static const char* kOdmOverlayDir = "/odm/overlay";
|
||||
static const char* kSystemOemOverlayDir = "/system/oem/overlay";
|
||||
@@ -113,8 +113,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|
||||
|| android::base::StartsWith(path, kVendorOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemProductOverlayDir)
|
||||
|| android::base::StartsWith(path, kProductOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemProductServicesOverlayDir)
|
||||
|| android::base::StartsWith(path, kProductServicesOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemSystemExtOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemExtOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemOdmOverlayDir)
|
||||
|| android::base::StartsWith(path, kOdmOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemOemOverlayDir)
|
||||
|
||||
@@ -74,7 +74,7 @@ const char* AssetManager::RESOURCES_FILENAME = "resources.arsc";
|
||||
const char* AssetManager::IDMAP_BIN = "/system/bin/idmap";
|
||||
const char* AssetManager::VENDOR_OVERLAY_DIR = "/vendor/overlay";
|
||||
const char* AssetManager::PRODUCT_OVERLAY_DIR = "/product/overlay";
|
||||
const char* AssetManager::PRODUCT_SERVICES_OVERLAY_DIR = "/product_services/overlay";
|
||||
const char* AssetManager::SYSTEM_EXT_OVERLAY_DIR = "/system_ext/overlay";
|
||||
const char* AssetManager::ODM_OVERLAY_DIR = "/odm/overlay";
|
||||
const char* AssetManager::OEM_OVERLAY_DIR = "/oem/overlay";
|
||||
const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "ro.boot.vendor.overlay.theme";
|
||||
@@ -575,7 +575,7 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
|
||||
mZipSet.setZipResourceTableAsset(ap.path, ass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nextEntryIdx == 0 && ass != NULL) {
|
||||
// If this is the first resource table in the asset
|
||||
// manager, then we are going to cache it so that we
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
static const char* IDMAP_BIN;
|
||||
static const char* VENDOR_OVERLAY_DIR;
|
||||
static const char* PRODUCT_OVERLAY_DIR;
|
||||
static const char* PRODUCT_SERVICES_OVERLAY_DIR;
|
||||
static const char* SYSTEM_EXT_OVERLAY_DIR;
|
||||
static const char* ODM_OVERLAY_DIR;
|
||||
static const char* OEM_OVERLAY_DIR;
|
||||
/*
|
||||
|
||||
@@ -237,14 +237,9 @@ class IdmapManager {
|
||||
return fulfilledPolicies | IIdmap2.POLICY_OEM_PARTITION;
|
||||
}
|
||||
|
||||
// Check partitions for which there exists no policy so overlays on these partitions will
|
||||
// not fulfill the system policy.
|
||||
if (ai.isSystemExt()) {
|
||||
return fulfilledPolicies;
|
||||
}
|
||||
|
||||
// System_ext partition (/system_ext) is considered as system
|
||||
// Check this last since every partition except for data is scanned as system in the PMS.
|
||||
if (ai.isSystemApp()) {
|
||||
if (ai.isSystemApp() || ai.isSystemExt()) {
|
||||
return fulfilledPolicies | IIdmap2.POLICY_SYSTEM_PARTITION;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user