Merge "Add requiredSystemPropertyValue support in idmap2"
This commit is contained in:
@@ -176,6 +176,17 @@ Result<Unit> Scan(const std::vector<std::string>& args) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note that conditional property enablement/exclusion only applies if
|
||||||
|
// the attribute is present. In its absence, all overlays are presumed enabled.
|
||||||
|
if (!overlay_info->requiredSystemPropertyName.empty()
|
||||||
|
&& !overlay_info->requiredSystemPropertyValue.empty()) {
|
||||||
|
// if property set & equal to value, then include overlay - otherwise skip
|
||||||
|
if (android::base::GetProperty(overlay_info->requiredSystemPropertyName, "")
|
||||||
|
!= overlay_info->requiredSystemPropertyValue) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> fulfilled_policies;
|
std::vector<std::string> fulfilled_policies;
|
||||||
if (!override_policies.empty()) {
|
if (!override_policies.empty()) {
|
||||||
fulfilled_policies = override_policies;
|
fulfilled_policies = override_policies;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace android::idmap2::utils {
|
|||||||
struct OverlayManifestInfo {
|
struct OverlayManifestInfo {
|
||||||
std::string target_package; // NOLINT(misc-non-private-member-variables-in-classes)
|
std::string target_package; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
std::string target_name; // NOLINT(misc-non-private-member-variables-in-classes)
|
std::string target_name; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
std::string requiredSystemPropertyName; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
std::string requiredSystemPropertyValue; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
bool is_static; // NOLINT(misc-non-private-member-variables-in-classes)
|
bool is_static; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
int priority = -1; // NOLINT(misc-non-private-member-variables-in-classes)
|
int priority = -1; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -103,6 +103,16 @@ Result<OverlayManifestInfo> ExtractOverlayManifestInfo(const std::string& path,
|
|||||||
info.priority = std::stoi(iter->second);
|
info.priority = std::stoi(iter->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iter = tag->find("requiredSystemPropertyName");
|
||||||
|
if (iter != tag->end()) {
|
||||||
|
info.requiredSystemPropertyName = iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
iter = tag->find("requiredSystemPropertyValue");
|
||||||
|
if (iter != tag->end()) {
|
||||||
|
info.requiredSystemPropertyValue = iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user