Add namespace handling in attribute values
Previously, you could only reference namespace prefixes in attribute names:
<View xmlns:appcompat="http://schemas.android.com/apk/res/android.support.v7.appcompat"
appcompat:name="hey"
...
Now you can also reference them in resource names within an attribute value:
...
android:text="@appcompat:string/confirm"
...
Which will be treated as "@android.support.v7.appcompat:string/confirm".
Change-Id: Ib076e867a990c80cf877a704eb77cd1ef0b23b52
diff --git a/tools/aapt2/Util.h b/tools/aapt2/Util.h
index 9f9707c..6015d825 100644
--- a/tools/aapt2/Util.h
+++ b/tools/aapt2/Util.h
@@ -18,6 +18,7 @@
#define AAPT_UTIL_H
#include "BigBuffer.h"
+#include "Maybe.h"
#include "StringPiece.h"
#include <androidfw/ResourceTypes.h>
@@ -277,6 +278,15 @@
mEnd(str, sep, BasicStringPiece<Char>(str.end(), 0)) {
}
+/**
+ * Returns a package name if the namespace URI is of the form:
+ * http://schemas.android.com/apk/res/<package>
+ *
+ * Special case: if namespaceUri is http://schemas.android.com/apk/res-auto,
+ * returns an empty package name.
+ */
+Maybe<std::u16string> extractPackageFromNamespace(const std::u16string& namespaceUri);
+
} // namespace util
/**