Add support for /odm/overlay
Add support for runtime resource overlay (RRO) APKs in /odm/overlay.
Bug: 121033532
Test: manual (adb push apk to /odm/overlay, reboot, cmd overlay list)
Change-Id: I0918d276dfa6a43054068d3f84ecd0d1639f1d0b
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index bf56ef4..d3f9196 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -163,7 +163,7 @@
}
// Generic idmap parameters
- const char* argv[8];
+ const char* argv[9];
int argc = 0;
struct stat st;
@@ -199,6 +199,10 @@
argv[argc++] = AssetManager::PRODUCT_SERVICES_OVERLAY_DIR;
}
+ if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
+ argv[argc++] = AssetManager::ODM_OVERLAY_DIR;
+ }
+
// Finally, invoke idmap (if any overlay directory exists)
if (argc > 5) {
execv(AssetManager::IDMAP_BIN, (char* const*)argv);
@@ -233,6 +237,10 @@
input_dirs.push_back(AssetManager::PRODUCT_SERVICES_OVERLAY_DIR);
}
+ if (stat(AssetManager::ODM_OVERLAY_DIR, &st) == 0) {
+ input_dirs.push_back(AssetManager::ODM_OVERLAY_DIR);
+ }
+
if (input_dirs.empty()) {
LOG(WARNING) << "no directories for idmap2 to scan";
return env->NewObjectArray(0, g_stringClass, nullptr);