summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeongik Cha <jeongik@google.com> 2019-07-09 23:58:01 +0900
committer Justin Yun <justinyun@google.com> 2019-09-23 22:01:29 +0000
commit3e725f2224a14df061ec9352633d8a8f4ff87ebe (patch)
treee6b319357281d2f08035913f80cc7f61d0256114
parentf6629839d1c10f3df70c8565e5a18f03f9b076e1 (diff)
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 Merged-In: Ib225368eae41203a8630f4310d26e9cf1afa706a (cherry picked from commit cba9579158cc70bf8eadb6e8a239e0ab2dc073d2)
-rw-r--r--cmds/idmap2/idmap2/Scan.cpp1
-rw-r--r--core/jni/android_util_AssetManager.cpp10
-rw-r--r--core/jni/fd_utils.cpp8
-rw-r--r--libs/androidfw/AssetManager.cpp4
-rw-r--r--libs/androidfw/include/androidfw/AssetManager.h2
-rw-r--r--services/core/java/com/android/server/om/IdmapManager.java9
6 files changed, 15 insertions, 19 deletions
diff --git a/cmds/idmap2/idmap2/Scan.cpp b/cmds/idmap2/idmap2/Scan.cpp
index cfac5f31e2e6..0b349e10a118 100644
--- a/cmds/idmap2/idmap2/Scan.cpp
+++ b/cmds/idmap2/idmap2/Scan.cpp
@@ -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},
};
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 2b471fec9c8f..9342088cef3f 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -163,7 +163,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;
@@ -195,8 +195,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) {
@@ -237,8 +237,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) {
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index 18448d20ed71..bb5780558bdf 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -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)
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 4755cb866310..f7c83371f79c 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -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
diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h
index 66fba26b7289..ce0985b38986 100644
--- a/libs/androidfw/include/androidfw/AssetManager.h
+++ b/libs/androidfw/include/androidfw/AssetManager.h
@@ -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;
/*
diff --git a/services/core/java/com/android/server/om/IdmapManager.java b/services/core/java/com/android/server/om/IdmapManager.java
index b22b33cdf5fe..1f20968ca0c8 100644
--- a/services/core/java/com/android/server/om/IdmapManager.java
+++ b/services/core/java/com/android/server/om/IdmapManager.java
@@ -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;
}