use of com.android.manifmerger.Actions in project android by JetBrains.
the class ManifestUtils method getRecords.
@NotNull
static List<? extends Actions.Record> getRecords(@NotNull MergedManifest manifest, @NotNull Node item) {
Actions actions = manifest.getActions();
if (actions != null) {
if (item instanceof Element) {
Element element = (Element) item;
XmlNode.NodeKey key = getNodeKey(manifest, element);
return actions.getNodeRecords(key);
} else if (item instanceof Attr) {
Attr attribute = (Attr) item;
Element element = attribute.getOwnerElement();
XmlNode.NodeKey key = getNodeKey(manifest, element);
XmlNode.NodeName name = XmlNode.fromXmlName(attribute.getName());
List<? extends Actions.Record> attributeRecords = actions.getAttributeRecords(key, name);
if (!attributeRecords.isEmpty()) {
return attributeRecords;
}
return actions.getNodeRecords(key);
}
}
return Collections.emptyList();
}
use of com.android.manifmerger.Actions in project android by JetBrains.
the class MergedManifest method getNodeKey.
@Nullable
public XmlNode.NodeKey getNodeKey(String name) {
sync();
if (myNodeKeys == null) {
HashMap<String, XmlNode.NodeKey> nodeKeys = new HashMap<>();
Actions actions = getActions();
if (actions != null) {
Set<XmlNode.NodeKey> keys = actions.getNodeKeys();
for (XmlNode.NodeKey key : keys) {
nodeKeys.put(key.toString(), key);
}
}
myNodeKeys = nodeKeys;
}
return myNodeKeys.get(name);
}