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

Commit 8b40485f authored by Jiyong Park's avatar Jiyong Park Committed by Automerger Merge Worker
Browse files

Merge "init: Sort the list of flattened APEX folders to avoid variations" am:...

Merge "init: Sort the list of flattened APEX folders to avoid variations" am: 0f2c5417 am: 570fe208

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1538222

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I90ee4644f921d6bde03dbaef3f3e86fc080affaa
parents 7ffd5b79 570fe208
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -115,10 +115,18 @@ static Result<void> ActivateFlattenedApexesFrom(const std::string& from_dir,
        return {};
    }
    dirent* entry;
    std::vector<std::string> entries;

    while ((entry = readdir(dir.get())) != nullptr) {
        if (entry->d_name[0] == '.') continue;
        if (entry->d_type == DT_DIR) {
            const std::string apex_path = from_dir + "/" + entry->d_name;
            entries.push_back(entry->d_name);
        }
    }

    std::sort(entries.begin(), entries.end());
    for (const auto& name : entries) {
        const std::string apex_path = from_dir + "/" + name;
        const auto apex_manifest = GetApexManifest(apex_path);
        if (!apex_manifest.ok()) {
            LOG(ERROR) << apex_path << " is not an APEX directory: " << apex_manifest.error();
@@ -130,7 +138,6 @@ static Result<void> ActivateFlattenedApexesFrom(const std::string& from_dir,
        }
        on_activate(apex_path, *apex_manifest);
    }
    }
    return {};
}