use of com.android.aapt.Resources.XmlElement in project bundletool by google.
the class ModuleSplitterTest method nonInstantActivityRemovedForInstantManifest.
@Test
public void nonInstantActivityRemovedForInstantManifest() throws Exception {
XmlNode manifest = androidManifest("com.test.app", withMainActivity("MainActivity"), withSplitNameActivity("FooActivity", "onDemandModule"));
BundleModule bundleModule = new BundleModuleBuilder("onDemandModule").setManifest(manifest).build();
ImmutableList<ModuleSplit> moduleSplits = ModuleSplitter.createNoStamp(bundleModule, BUNDLETOOL_VERSION, APP_BUNDLE, ApkGenerationConfiguration.builder().setForInstantAppVariants(true).build(), lPlusVariantTargeting(), ImmutableSet.of()).splitModule();
assertThat(moduleSplits).hasSize(1);
ModuleSplit masterSplit = moduleSplits.get(0);
ImmutableList<XmlElement> activities = masterSplit.getAndroidManifest().getManifestRoot().getElement().getChildElement("application").getChildrenElements(ACTIVITY_ELEMENT_NAME).map(XmlProtoElement::getProto).collect(toImmutableList());
assertThat(activities).hasSize(1);
XmlElement activityElement = activities.get(0);
assertThat(activityElement.getAttributeList()).containsExactly(xmlAttribute(ANDROID_NAMESPACE_URI, "name", NAME_RESOURCE_ID, "MainActivity"));
}
use of com.android.aapt.Resources.XmlElement in project bundletool by google.
the class ManifestProtoUtilsTest method splitNameAttributeAddedToProvider.
@Test
public void splitNameAttributeAddedToProvider() {
AndroidManifest manifest = AndroidManifest.create(androidManifest("com.test.app", withSplitNameProvider("FooProvider", "foo")));
ImmutableList<XmlElement> providers = manifest.getManifestRoot().getElement().getChildElement("application").getChildrenElements(PROVIDER_ELEMENT_NAME).map(XmlProtoElement::getProto).collect(toImmutableList());
assertThat(providers).hasSize(1);
XmlElement providerElement = Iterables.getOnlyElement(providers);
assertThat(providerElement.getAttributeList()).containsExactly(xmlAttribute(ANDROID_NAMESPACE_URI, NAME_ATTRIBUTE_NAME, NAME_RESOURCE_ID, "FooProvider"), xmlAttribute(ANDROID_NAMESPACE_URI, SPLIT_NAME_ATTRIBUTE_NAME, SPLIT_NAME_RESOURCE_ID, "foo"));
}
Aggregations