Merge "init: Sort the list of flattened APEX folders to avoid variations" am: 0f2c5417c3
am: 570fe2083c
am: 8b40485f58
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1538222 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ie86d99f0e8ff660a3b2fcce76c19590e4f12318c
This commit is contained in:
commit
8957b3267e
1 changed files with 18 additions and 11 deletions
|
@ -115,22 +115,29 @@ 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;
|
||||
const auto apex_manifest = GetApexManifest(apex_path);
|
||||
if (!apex_manifest.ok()) {
|
||||
LOG(ERROR) << apex_path << " is not an APEX directory: " << apex_manifest.error();
|
||||
continue;
|
||||
}
|
||||
const std::string mount_path = to_dir + "/" + apex_manifest->name();
|
||||
if (auto result = MountDir(apex_path, mount_path); !result.ok()) {
|
||||
return result;
|
||||
}
|
||||
on_activate(apex_path, *apex_manifest);
|
||||
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();
|
||||
continue;
|
||||
}
|
||||
const std::string mount_path = to_dir + "/" + apex_manifest->name();
|
||||
if (auto result = MountDir(apex_path, mount_path); !result.ok()) {
|
||||
return result;
|
||||
}
|
||||
on_activate(apex_path, *apex_manifest);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue