AAPT2: Ignore namespaced elements in AndroidManifest.xml
Some third party stores/tools expect manifest elements
under their namespace, and AAPT2 shouldn't fail if these
are present.
Bug: 37943705
Test: make aapt2_tests
Change-Id: I87b7500c7da5e8e79fc2a78b30e8e4334124af3d
diff --git a/tools/aapt2/link/ManifestFixer_test.cpp b/tools/aapt2/link/ManifestFixer_test.cpp
index ce84993..064d365 100644
--- a/tools/aapt2/link/ManifestFixer_test.cpp
+++ b/tools/aapt2/link/ManifestFixer_test.cpp
@@ -402,4 +402,22 @@
EXPECT_EQ(nullptr, Verify(input));
}
+TEST_F(ManifestFixerTest, IgnoreNamespacedElements) {
+ std::string input = R"EOF(
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android">
+ <special:tag whoo="true" xmlns:special="http://google.com" />
+ </manifest>)EOF";
+ EXPECT_NE(nullptr, Verify(input));
+}
+
+TEST_F(ManifestFixerTest, DoNotIgnoreNonNamespacedElements) {
+ std::string input = R"EOF(
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android">
+ <tag whoo="true" />
+ </manifest>)EOF";
+ EXPECT_EQ(nullptr, Verify(input));
+}
+
} // namespace aapt