Merge "Add support for /oem/overlay" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b0815b80e8
@@ -163,7 +163,7 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
|
||||
}
|
||||
|
||||
// Generic idmap parameters
|
||||
const char* argv[9];
|
||||
const char* argv[10];
|
||||
int argc = 0;
|
||||
struct stat st;
|
||||
|
||||
@@ -203,6 +203,10 @@ static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
|
||||
argv[argc++] = AssetManager::ODM_OVERLAY_DIR;
|
||||
}
|
||||
|
||||
if (stat(AssetManager::OEM_OVERLAY_DIR, &st) == 0) {
|
||||
argv[argc++] = AssetManager::OEM_OVERLAY_DIR;
|
||||
}
|
||||
|
||||
// Finally, invoke idmap (if any overlay directory exists)
|
||||
if (argc > 5) {
|
||||
execv(AssetManager::IDMAP_BIN, (char* const*)argv);
|
||||
@@ -241,6 +245,10 @@ static jobjectArray NativeCreateIdmapsForStaticOverlaysTargetingAndroid(JNIEnv*
|
||||
input_dirs.push_back(AssetManager::ODM_OVERLAY_DIR);
|
||||
}
|
||||
|
||||
if (stat(AssetManager::OEM_OVERLAY_DIR, &st) == 0) {
|
||||
input_dirs.push_back(AssetManager::OEM_OVERLAY_DIR);
|
||||
}
|
||||
|
||||
if (input_dirs.empty()) {
|
||||
LOG(WARNING) << "no directories for idmap2 to scan";
|
||||
return env->NewObjectArray(0, g_stringClass, nullptr);
|
||||
|
||||
@@ -104,6 +104,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|
||||
static const char* kProductServicesOverlayDir = "/product_services/overlay";
|
||||
static const char* kSystemOdmOverlayDir = "/system/odm/overlay";
|
||||
static const char* kOdmOverlayDir = "/odm/overlay";
|
||||
static const char* kSystemOemOverlayDir = "/system/oem/overlay";
|
||||
static const char* kOemOverlayDir = "/oem/overlay";
|
||||
static const char* kApkSuffix = ".apk";
|
||||
|
||||
if ((android::base::StartsWith(path, kOverlayDir)
|
||||
@@ -114,7 +116,9 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
|
||||
|| android::base::StartsWith(path, kSystemProductServicesOverlayDir)
|
||||
|| android::base::StartsWith(path, kProductServicesOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemOdmOverlayDir)
|
||||
|| android::base::StartsWith(path, kOdmOverlayDir))
|
||||
|| android::base::StartsWith(path, kOdmOverlayDir)
|
||||
|| android::base::StartsWith(path, kSystemOemOverlayDir)
|
||||
|| android::base::StartsWith(path, kOemOverlayDir))
|
||||
&& android::base::EndsWith(path, kApkSuffix)
|
||||
&& path.find("/../") == std::string::npos) {
|
||||
return true;
|
||||
|
||||
@@ -76,6 +76,7 @@ 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::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";
|
||||
const char* AssetManager::TARGET_PACKAGE_NAME = "android";
|
||||
const char* AssetManager::TARGET_APK_PATH = "/system/framework/framework-res.apk";
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
static const char* PRODUCT_OVERLAY_DIR;
|
||||
static const char* PRODUCT_SERVICES_OVERLAY_DIR;
|
||||
static const char* ODM_OVERLAY_DIR;
|
||||
static const char* OEM_OVERLAY_DIR;
|
||||
/*
|
||||
* If OVERLAY_THEME_DIR_PROPERTY is set, search for runtime resource overlay
|
||||
* APKs in VENDOR_OVERLAY_DIR/<value of OVERLAY_THEME_DIR_PROPERTY> in
|
||||
|
||||
@@ -598,6 +598,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
private static final String ODM_OVERLAY_DIR = "/odm/overlay";
|
||||
|
||||
private static final String OEM_OVERLAY_DIR = "/oem/overlay";
|
||||
|
||||
/** Canonical intent used to identify what counts as a "web browser" app */
|
||||
private static final Intent sBrowserIntent;
|
||||
static {
|
||||
@@ -2631,6 +2633,13 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_ODM,
|
||||
0);
|
||||
scanDirTracedLI(new File(OEM_OVERLAY_DIR),
|
||||
mDefParseFlags
|
||||
| PackageParser.PARSE_IS_SYSTEM_DIR,
|
||||
scanFlags
|
||||
| SCAN_AS_SYSTEM
|
||||
| SCAN_AS_OEM,
|
||||
0);
|
||||
|
||||
mParallelPackageParserCallback.findStaticOverlayPackages();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user