Package com.android.manifmerger
Class ManifestMerger2
java.lang.Object
com.android.manifmerger.ManifestMerger2
merges android manifest files, idempotent.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines a property that can add or override itself into an XML document.static classA ManifestMerger2.FileStreamProvider provides (buffered, if necessary)InputStreaminstances for a givenFilehandle.static classThis class will hold all invocation parameters for the manifest merging tool.static interfaceA ManifestMerger2.ManifestDocumentProvider provides the merged manifest XMLDocumentinstance for the project a givenFilebelongs to.static classHelper class for map based placeholders key value pairs.static classstatic enumDefines the merging type expected from the tool.static interfacestatic classImplementation aKeyResolvercapable of resolving all selectors value in the context of the passed libraries to this merging activities. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableList<Element>getChildElementsByName(Element element, String name) Returns a list of elements which are the immediate children of the given element and have the given name.Returns theManifestMerger2.FileStreamProviderused by this manifest merger.static ManifestMerger2.InvokernewMerger(File mainManifestFile, com.android.utils.ILogger logger, ManifestMerger2.MergeType mergeType) Creates a newManifestMerger2.Invokerinstance to invoke the merging tool to merge manifest files for an application.protected voidperformSystemPropertiesInjection(MergingReport.Builder mergingReport, XmlDocument xmlDocument) PerformManifestSystemPropertyinjection.static voidsetAndroidAttribute(XmlElement node, String localName, String value) Set an Android-namespaced XML attribute on the given node.static StringsetManifestAndroidAttribute(XmlDocument document, String attribute, String value) Set an android namespaced attribute for the manifest element.
-
Field Details
-
COMPATIBLE_SCREENS_SUB_MANIFEST
- See Also:
-
WEAR_APP_SUB_MANIFEST
- See Also:
-
-
Method Details
-
setManifestAndroidAttribute
public static String setManifestAndroidAttribute(@NonNull XmlDocument document, @NonNull String attribute, @NonNull String value) Set an android namespaced attribute for the manifest element.- Parameters:
document- the document whose attributes will be modifiedattribute- the new attribute to be setvalue- the new value of the attribute- Returns:
- the previous value of the attribute or null if the attribute was not set.
-
setAndroidAttribute
Set an Android-namespaced XML attribute on the given node.- Parameters:
node- Node in which to set the attribute; must be part of a documentlocalName- Non-prefixed attribute namevalue- value of the attribute
-
getChildElementsByName
@NonNull public static com.google.common.collect.ImmutableList<Element> getChildElementsByName(@NonNull Element element, @NonNull String name) Returns a list of elements which are the immediate children of the given element and have the given name.- Parameters:
element- the immediate parent of any elements in the returned listname- the name of any elements in the returned list- Returns:
- the list (possibly empty) of children elements with the given name
-
getFileStreamProvider
Returns theManifestMerger2.FileStreamProviderused by this manifest merger. Use this to read files if you need to access the content of aXmlDocument. -
newMerger
@NonNull public static ManifestMerger2.Invoker newMerger(@NonNull File mainManifestFile, @NonNull com.android.utils.ILogger logger, @NonNull ManifestMerger2.MergeType mergeType) Creates a newManifestMerger2.Invokerinstance to invoke the merging tool to merge manifest files for an application.- Parameters:
mainManifestFile- application main manifest file.logger- the logger interface to use.- Returns:
- an
ManifestMerger2.Invokerinstance that will allow further customization and trigger the merging tool.
-
performSystemPropertiesInjection
protected void performSystemPropertiesInjection(@NonNull MergingReport.Builder mergingReport, @NonNull XmlDocument xmlDocument) PerformManifestSystemPropertyinjection.- Parameters:
mergingReport- to log actions and errors.xmlDocument- the xml document to inject into.
-