use of com.android.manifmerger.XmlNode.NodeKey in project buck by facebook.
the class ActionRecorder method getAttributeRecords.
@NonNull
private synchronized List<Actions.AttributeRecord> getAttributeRecords(@NonNull XmlAttribute attribute) {
XmlElement originElement = attribute.getOwnerElement();
NodeKey storageKey = originElement.getOriginalId();
@Nullable Actions.DecisionTreeRecord nodeDecisionTree = mRecords.get(storageKey);
// by now the node should have been added for this element.
Preconditions.checkNotNull(nodeDecisionTree, "No record for key [%s]", storageKey);
List<Actions.AttributeRecord> attributeRecords = nodeDecisionTree.mAttributeRecords.get(attribute.getName());
if (attributeRecords == null) {
attributeRecords = new ArrayList<Actions.AttributeRecord>();
nodeDecisionTree.mAttributeRecords.put(attribute.getName(), attributeRecords);
}
return attributeRecords;
}
use of com.android.manifmerger.XmlNode.NodeKey in project buck by facebook.
the class ActionRecorder method recordImpliedNodeAction.
/**
* Record a node that was added due to an implicit presence in earlier SDK release but requires
* an explicit declaration in the application targeted SDK.
* @param xmlElement the implied element that was added to the resulting xml.
* @param reason optional contextual information whey the implied element was added.
*/
synchronized void recordImpliedNodeAction(@NonNull XmlElement xmlElement, @Nullable String reason) {
NodeKey storageKey = xmlElement.getOriginalId();
Actions.DecisionTreeRecord nodeDecisionTree = mRecords.get(storageKey);
if (nodeDecisionTree == null) {
nodeDecisionTree = new Actions.DecisionTreeRecord();
mRecords.put(storageKey, nodeDecisionTree);
}
Actions.NodeRecord record = new Actions.NodeRecord(Actions.ActionType.IMPLIED, new SourceFilePosition(xmlElement.getDocument().getSourceFile(), xmlElement.getDocument().getRootNode().getPosition()), xmlElement.getOriginalId(), reason, xmlElement.getOperationType());
nodeDecisionTree.addNodeRecord(record);
}
use of com.android.manifmerger.XmlNode.NodeKey in project buck by facebook.
the class ActionRecorder method recordNodeAction.
/**
* Records a {@link com.android.manifmerger.Actions.NodeRecord} action on a xml element.
* @param mergedElement the target element of the action.
* @param nodeRecord the record of the action.
*/
synchronized void recordNodeAction(@NonNull XmlElement mergedElement, @NonNull Actions.NodeRecord nodeRecord) {
NodeKey storageKey = mergedElement.getOriginalId();
Actions.DecisionTreeRecord nodeDecisionTree = mRecords.get(storageKey);
if (nodeDecisionTree == null) {
nodeDecisionTree = new Actions.DecisionTreeRecord();
mRecords.put(storageKey, nodeDecisionTree);
}
nodeDecisionTree.addNodeRecord(nodeRecord);
}
Aggregations