/** * Records an attribute action taken by the merging tool * * @param attribute the attribute in question. * @param actionType the action's type * @param attributeOperationType the original tool annotation leading to the merging tool * decision. */ synchronized void recordAttributeAction( @NonNull XmlAttribute attribute, @NonNull Actions.ActionType actionType, @Nullable AttributeOperationType attributeOperationType) { recordAttributeAction( attribute, attribute.getPosition(), actionType, attributeOperationType); }
} else { mergingReportBuilder.getActionRecorder().recordAttributeAction( xmlAttribute, SourcePosition.UNKNOWN,
/** * When the first xml file is loaded, there is nothing to merge with, however, each xml element * and attribute added to the initial merged file need to be recorded. * * @param xmlElement xml element added to the initial merged document. */ synchronized void recordDefaultNodeAction(@NonNull XmlElement xmlElement) { if (!mRecords.containsKey(xmlElement.getOriginalId())) { recordNodeAction(xmlElement, Actions.ActionType.ADDED); for (XmlAttribute xmlAttribute : xmlElement.getAttributes()) { AttributeOperationType attributeOperation = xmlElement .getAttributeOperationType(xmlAttribute.getName()); recordAttributeAction( xmlAttribute, Actions.ActionType.ADDED, attributeOperation); } for (XmlElement childNode : xmlElement.getMergeableElements()) { recordDefaultNodeAction(childNode); } } }
private static void addToElement( @NonNull ManifestSystemProperty manifestSystemProperty, @NonNull ActionRecorder actionRecorder, String value, @NonNull XmlElement to) { to.getXml().setAttribute(manifestSystemProperty.toCamelCase(), value); XmlAttribute xmlAttribute = new XmlAttribute(to, to.getXml().getAttributeNode(manifestSystemProperty.toCamelCase()), null); actionRecorder.recordAttributeAction(xmlAttribute, new Actions.AttributeRecord( Actions.ActionType.INJECTED, new SourceFilePosition(to.getSourceFile(), SourcePosition.UNKNOWN), xmlAttribute.getId(), null, /* reason */ null /* attributeOperationType */)); }
glEsVersionDeclaration.getValue().getXml().removeAttributeNS(ANDROID_URI, AndroidManifest.ATTRIBUTE_GLESVERSION); mergingReport.getActionRecorder().recordAttributeAction( glEsVersionDeclaration.getValue().getAttribute(XmlNode.fromXmlName( "android:" + AndroidManifest.ATTRIBUTE_GLESVERSION)).get(),
report.getActionRecorder().recordAttributeAction( this, Actions.ActionType.REJECTED,
mergingReport.getActionRecorder().recordAttributeAction( this, Actions.ActionType.REJECTED, mergingReport.getActionRecorder().recordAttributeAction( this, Actions.ActionType.ADDED,
private static void addToElementInAndroidNS( @NonNull ManifestSystemProperty manifestSystemProperty, @NonNull ActionRecorder actionRecorder, String value, @NonNull XmlElement to) { String toolsPrefix = getAndroidPrefix(to.getXml()); to.getXml().setAttributeNS(SdkConstants.ANDROID_URI, toolsPrefix + XmlUtils.NS_SEPARATOR + manifestSystemProperty.toCamelCase(), value); Attr attr = to.getXml().getAttributeNodeNS(SdkConstants.ANDROID_URI, manifestSystemProperty.toCamelCase()); XmlAttribute xmlAttribute = new XmlAttribute(to, attr, null); actionRecorder.recordAttributeAction(xmlAttribute, new Actions.AttributeRecord( Actions.ActionType.INJECTED, new SourceFilePosition(to.getSourceFile(), SourcePosition.UNKNOWN), xmlAttribute.getId(), null, /* reason */ null /* attributeOperationType */ ) ); }
/** * Records an attribute action taken by the merging tool * * @param attribute the attribute in question. * @param attributePosition the attribute's position. * @param actionType the action's type * @param attributeOperationType the original tool annotation leading to the merging tool * decision. */ synchronized void recordAttributeAction( @NonNull XmlAttribute attribute, @NonNull SourcePosition attributePosition, @NonNull Actions.ActionType actionType, @Nullable AttributeOperationType attributeOperationType) { XmlElement originElement = attribute.getOwnerElement(); Actions.AttributeRecord attributeRecord = new Actions.AttributeRecord( actionType, new SourceFilePosition( originElement.getDocument().getSourceFile(), attributePosition), attribute.getOriginalId(), null, /* reason */ attributeOperationType ); recordAttributeAction(attribute, attributeRecord); }
} else { getXml().setValue(mergedValue); mergingReport.getActionRecorder().recordAttributeAction( this, Actions.ActionType.MERGED,