Merge "init: Sort the list of flattened APEX folders to avoid variations" am: 0f2c5417c3 am: 570fe2083c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1538222 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I90ee4644f921d6bde03dbaef3f3e86fc080affaa
This commit is contained in:
commit
8b40485f58
1 changed files with 18 additions and 11 deletions
|
|
@ -115,22 +115,29 @@ static Result<void> ActivateFlattenedApexesFrom(const std::string& from_dir,
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
dirent* entry;
|
dirent* entry;
|
||||||
|
std::vector<std::string> entries;
|
||||||
|
|
||||||
while ((entry = readdir(dir.get())) != nullptr) {
|
while ((entry = readdir(dir.get())) != nullptr) {
|
||||||
if (entry->d_name[0] == '.') continue;
|
if (entry->d_name[0] == '.') continue;
|
||||||
if (entry->d_type == DT_DIR) {
|
if (entry->d_type == DT_DIR) {
|
||||||
const std::string apex_path = from_dir + "/" + entry->d_name;
|
entries.push_back(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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue