AAPT2: Add support to strip namespaces from XML

The --no-xml-namespaces flag will strip namespace information from
compiled binary XML files in res/* (excluding res/raw/*) and
AndroidManifest.xml. It will also strip URI information from compiled
binary XML files in res/* (excluding res/raw/* and AndroidManifest.xml).

AndroidManifest.xml URI information is retained due to PackageParser, which
requires the Android URI for intent filters.

Bug: 29115919
Change-Id: I90cad6ed39ce02a69776f55314c1d4f38ad1aabe
diff --git a/tools/aapt2/link/Linkers.h b/tools/aapt2/link/Linkers.h
index 43b8fb4..82e2868 100644
--- a/tools/aapt2/link/Linkers.h
+++ b/tools/aapt2/link/Linkers.h
@@ -86,6 +86,23 @@
 };
 
 /**
+ * Removes namespace nodes and URI information from the XmlResource.
+ *
+ * Once an XmlResource is processed by this consumer, it is no longer able to have its attributes
+ * parsed. As such, this XmlResource must have already been processed by XmlReferenceLinker.
+ */
+class XmlNamespaceRemover : public IXmlResourceConsumer {
+private:
+    bool mKeepUris;
+
+public:
+    XmlNamespaceRemover(bool keepUris = false) : mKeepUris(keepUris) {
+    };
+
+    bool consume(IAaptContext* context, xml::XmlResource* resource) override;
+};
+
+/**
  * Resolves attributes in the XmlResource and compiles string values to resource values.
  * Once an XmlResource is processed by this linker, it is ready to be flattened.
  */