public Optional<XmlAttribute> getPackage() { Optional<XmlAttribute> packageAttribute = getRootNode().getAttribute(XmlNode.fromXmlName("package")); return packageAttribute.isPresent() ? packageAttribute : getRootNode().getAttribute(XmlNode.fromNSName( SdkConstants.ANDROID_URI, "android", "package")); }
/** * Returns a constant Nodekey that can be used throughout the lifecycle of the xml element. * The {@link #getId} can return different values over time as the key of the element can be * for instance, changed through placeholder replacement. */ @NonNull public synchronized NodeKey getOriginalId() { if (mOriginalId == null) { mOriginalId = getId(); } return mOriginalId; }
/** * Returns the element's document xml source file location. */ @NonNull public SourceFilePosition getSourceFilePosition() { return new SourceFilePosition(getSourceFile(), getPosition()); }
/** * Build an immutable {@link com.android.manifmerger.AttributeModel} */ @NonNull AttributeModel build() { return new AttributeModel( XmlNode.fromXmlName("android:" + mName), mIsPackageDependent, mDefaultValue, mOnReadValidator, mOnWriteValidator, mMergingPolicy); } }
/** * Returns the attribute's name, providing isolation from details like namespaces handling. */ @NonNull @Override public NodeName getName() { return XmlNode.unwrapName(mXml); }
/** * Returns the position of this attribute in the original xml file. This may return an invalid * location as this xml fragment does not exist in any xml file but is the temporary result * of the merging process. * @return a human readable position. */ @NonNull public String printPosition() { return getSourceFilePosition().print(true /*shortFormat*/); }
/** * Returns the position of the specified {@link XmlNode}. */ @NonNull static SourcePosition getNodePosition(@NonNull XmlNode node) { return getNodePosition(node.getXml()); }
/** * Returns the minSdk version specified in the uses_sdk element if present or the * default value. */ @NonNull private String getRawMinSdkVersion() { Optional<XmlElement> usesSdk = getByTypeAndKey( ManifestModel.NodeTypes.USES_SDK, null); if (usesSdk.isPresent()) { Optional<XmlAttribute> minSdkVersion = usesSdk.get() .getAttribute(XmlNode.fromXmlName("android:minSdkVersion")); if (minSdkVersion.isPresent()) { return minSdkVersion.get().getValue(); } } return DEFAULT_SDK_VERSION; }
@NonNull @Override public NodeName getName() { return XmlNode.unwrapName(mXml); }
/** * Returns the targetSdk version specified in the uses_sdk element if present or the * default value. */ @NonNull private String getRawTargetSdkVersion() { Optional<XmlElement> usesSdk = getByTypeAndKey( ManifestModel.NodeTypes.USES_SDK, null); if (usesSdk.isPresent()) { Optional<XmlAttribute> targetSdkVersion = usesSdk.get() .getAttribute(XmlNode.fromXmlName("android:targetSdkVersion")); if (targetSdkVersion.isPresent()) { return targetSdkVersion.get().getValue(); } } return getRawMinSdkVersion(); }
"tools:node=\"%1$s\" not allowed on top level %2$s element", attribute.getNodeValue(), XmlNode.unwrapName(element))); return ERROR; } else {
NodeName nodeName = XmlNode.fromXmlName(attributeName); attributeOperationTypeBuilder.put(nodeName, attributeOperationType); Node attribute = namedNodeMap.item(i); XmlAttribute xmlAttribute = new XmlAttribute( this, (Attr) attribute, getType().getAttributeModel(XmlNode.fromXmlName( ((Attr) attribute).getName()))); attributesListBuilder.add(xmlAttribute);
AndroidManifest.ATTRIBUTE_GLESVERSION); mergingReport.getActionRecorder().recordAttributeAction( glEsVersionDeclaration.getValue().getAttribute(XmlNode.fromXmlName( "android:" + AndroidManifest.ATTRIBUTE_GLESVERSION)).get(), Actions.ActionType.REJECTED,