use of com.android.tools.build.bundletool.model.AndroidManifest.DISTRIBUTION_NAMESPACE_URI in project bundletool by google.
the class ManifestProtoUtils method withUserCountriesConditionInternal.
private static ManifestMutator withUserCountriesConditionInternal(ImmutableList<String> codes, Optional<Boolean> exclude) {
XmlProtoElementBuilder userCountries = XmlProtoElementBuilder.create(DISTRIBUTION_NAMESPACE_URI, "user-countries");
exclude.ifPresent(excludeValue -> userCountries.addAttribute(XmlProtoAttributeBuilder.create(DISTRIBUTION_NAMESPACE_URI, "exclude").setValueAsBoolean(excludeValue)));
for (String countryCode : codes) {
userCountries.addChildElement(XmlProtoElementBuilder.create(DISTRIBUTION_NAMESPACE_URI, "country").addAttribute(XmlProtoAttributeBuilder.create(DISTRIBUTION_NAMESPACE_URI, "code").setValueAsString(countryCode)));
}
return manifestElement -> manifestElement.getOrCreateChildElement(DISTRIBUTION_NAMESPACE_URI, "module").getOrCreateChildElement(DISTRIBUTION_NAMESPACE_URI, "delivery").getOrCreateChildElement(DISTRIBUTION_NAMESPACE_URI, "install-time").getOrCreateChildElement(DISTRIBUTION_NAMESPACE_URI, "conditions").addChildElement(userCountries);
}
Aggregations