Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c03d9483 authored by Jakub Adamek's avatar Jakub Adamek
Browse files

Change name of overlay subdir property to sku.

Also move the SKU subdirectories directly under /vendor/overlay.

Bug: 31692079
Change-Id: I68c712b13918cc99629534580ee4f77d9e5b3823
parent c350547d
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -186,18 +186,19 @@ static void verifySystemIdmaps()
                argv[argc++] = AssetManager::TARGET_APK_PATH;
                argv[argc++] = AssetManager::IDMAP_DIR;

                // Directories to scan for overlays: if OVERLAY_SUBDIR_PROPERTY is defined,
                // use OVERLAY_SUBDIR/<value of OVERLAY_SUBDIR_PROPERTY>/ if exists, otherwise
                // Directories to scan for overlays: if OVERLAY_SKU_DIR_PROPERTY is defined,
                // use OVERLAY_DIR/<value of OVERLAY_SKU_DIR_PROPERTY> if exists, otherwise
                // use OVERLAY_DIR if exists.
                char subdir[PROP_VALUE_MAX];
                int len = __system_property_get(AssetManager::OVERLAY_SUBDIR_PROPERTY, subdir);
                int len = __system_property_get(AssetManager::OVERLAY_SKU_DIR_PROPERTY, subdir);
                String8 overlayPath;
                if (len > 0) {
                    String8 subdirPath = String8(AssetManager::OVERLAY_SUBDIR) + "/" + subdir;
                    if (stat(subdirPath.string(), &st) == 0) {
                        argv[argc++] = subdirPath.string();
                    overlayPath = String8(AssetManager::OVERLAY_DIR) + "/" + subdir;
                } else {
                    overlayPath = String8(AssetManager::OVERLAY_DIR);
                }
                } else if (stat(AssetManager::OVERLAY_DIR, &st) == 0) {
                    argv[argc++] = AssetManager::OVERLAY_DIR;
                if (stat(overlayPath.string(), &st) == 0) {
                    argv[argc++] = overlayPath.string();
                }

                // Finally, invoke idmap (if any overlay directory exists)
+3 −6
Original line number Diff line number Diff line
@@ -260,16 +260,13 @@ class FileDescriptorInfo {

    // Whitelist files needed for Runtime Resource Overlay, like these:
    // /system/vendor/overlay/framework-res.apk
    // /system/vendor/overlay-subdir/pg/framework-res.apk
    // /system/vendor/overlay/PG/android-framework-runtime-resource-overlay.apk
    // /data/resource-cache/system@vendor@overlay@framework-res.apk@idmap
    // /data/resource-cache/system@vendor@overlay-subdir@pg@framework-res.apk@idmap
    // See AssetManager.cpp for more details on overlay-subdir.
    // /data/resource-cache/system@vendor@overlay@PG@framework-res.apk@idmap
    static const char* kOverlayDir = "/system/vendor/overlay/";
    static const char* kOverlaySubdir = "/system/vendor/overlay-subdir/";
    static const char* kApkSuffix = ".apk";

    if ((android::base::StartsWith(path, kOverlayDir)
            || android::base::StartsWith(path, kOverlaySubdir))
    if (android::base::StartsWith(path, kOverlayDir)
        && android::base::EndsWith(path, kApkSuffix)
        && path.find("/../") == std::string::npos) {
      return true;
+3 −4
Original line number Diff line number Diff line
@@ -73,12 +73,11 @@ public:
    static const char* IDMAP_BIN;
    static const char* OVERLAY_DIR;
    /*
     * If OVERLAY_SUBDIR_PROPERTY is set, search for runtime resource overlay
     * APKs in OVERLAY_SUBDIR/<value of OVERLAY_SUBDIR_PROPERTY>/ rather than in
     * If OVERLAY_SKU_DIR_PROPERTY is set, search for runtime resource overlay
     * APKs in OVERLAY_DIR/<value of OVERLAY_SKU_DIR_PROPERTY> rather than in
     * OVERLAY_DIR.
     */
    static const char* OVERLAY_SUBDIR;
    static const char* OVERLAY_SUBDIR_PROPERTY;
    static const char* OVERLAY_SKU_DIR_PROPERTY;
    static const char* TARGET_PACKAGE_NAME;
    static const char* TARGET_APK_PATH;
    static const char* IDMAP_DIR;
+1 −2
Original line number Diff line number Diff line
@@ -76,10 +76,9 @@ static volatile int32_t gCount = 0;
const char* AssetManager::RESOURCES_FILENAME = "resources.arsc";
const char* AssetManager::IDMAP_BIN = "/system/bin/idmap";
const char* AssetManager::OVERLAY_DIR = "/vendor/overlay";
const char* AssetManager::OVERLAY_SKU_DIR_PROPERTY = "ro.boot.vendor.overlay.sku";
const char* AssetManager::TARGET_PACKAGE_NAME = "android";
const char* AssetManager::TARGET_APK_PATH = "/system/framework/framework-res.apk";
const char* AssetManager::OVERLAY_SUBDIR = "/system/vendor/overlay-subdir";
const char* AssetManager::OVERLAY_SUBDIR_PROPERTY = "ro.boot.vendor.overlay.subdir";
const char* AssetManager::IDMAP_DIR = "/data/resource-cache";

namespace {