summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-02-23 12:38:12 -0800
committerandroid code review <noreply-gerritcodereview@google.com>2012-02-23 12:38:14 -0800
commit63e43ba56a95708c229eec539a544967f1bbb7d7 (patch)
treea43e67d0ff08c1117313101381965ad634f2dcd0
parent69e9c30c2641add74c9a3b02d0959c0ded9e66f7 (diff)
parente348909c1966c3d192841cc131a32be6ed90da18 (diff)
downloadframeworks_base-63e43ba56a95708c229eec539a544967f1bbb7d7.zip
frameworks_base-63e43ba56a95708c229eec539a544967f1bbb7d7.tar.gz
frameworks_base-63e43ba56a95708c229eec539a544967f1bbb7d7.tar.bz2
Merge "Fix for issue 9656 - custom xml attributes in Android Libraries"
-rw-r--r--tools/aapt/XMLNode.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index c0d7427..d9782b0 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -21,6 +21,7 @@
const char* const RESOURCES_ROOT_NAMESPACE = "http://schemas.android.com/apk/res/";
const char* const RESOURCES_ANDROID_NAMESPACE = "http://schemas.android.com/apk/res/android";
+const char* const RESOURCES_AUTO_PACKAGE_NAMESPACE = "http://schemas.android.com/apk/res/auto";
const char* const RESOURCES_ROOT_PRV_NAMESPACE = "http://schemas.android.com/apk/prv/res/";
const char* const XLIFF_XMLNS = "urn:oasis:names:tc:xliff:document:1.2";
@@ -44,15 +45,20 @@ bool isWhitespace(const char16_t* str)
}
static const String16 RESOURCES_PREFIX(RESOURCES_ROOT_NAMESPACE);
+static const String16 RESOURCES_PREFIX_AUTO_PACKAGE(RESOURCES_AUTO_PACKAGE_NAMESPACE);
static const String16 RESOURCES_PRV_PREFIX(RESOURCES_ROOT_PRV_NAMESPACE);
-String16 getNamespaceResourcePackage(String16 namespaceUri, bool* outIsPublic)
+String16 getNamespaceResourcePackage(String16 appPackage, String16 namespaceUri, bool* outIsPublic)
{
//printf("%s starts with %s?\n", String8(namespaceUri).string(),
// String8(RESOURCES_PREFIX).string());
size_t prefixSize;
bool isPublic = true;
- if (namespaceUri.startsWith(RESOURCES_PREFIX)) {
+ if(namespaceUri.startsWith(RESOURCES_PREFIX_AUTO_PACKAGE)) {
+ NOISY(printf("Using default application package: %s -> %s\n", String8(namespaceUri).string(), String8(appPackage).string()));
+ isPublic = true;
+ return appPackage;
+ } else if (namespaceUri.startsWith(RESOURCES_PREFIX)) {
prefixSize = RESOURCES_PREFIX.size();
} else if (namespaceUri.startsWith(RESOURCES_PRV_PREFIX)) {
isPublic = false;
@@ -922,7 +928,7 @@ status_t XMLNode::assignResourceIds(const sp<AaptAssets>& assets,
const attribute_entry& e = mAttributes.itemAt(i);
if (e.ns.size() <= 0) continue;
bool nsIsPublic;
- String16 pkg(getNamespaceResourcePackage(e.ns, &nsIsPublic));
+ String16 pkg(getNamespaceResourcePackage(String16(assets->getPackage()), e.ns, &nsIsPublic));
NOISY(printf("Elem %s %s=\"%s\": namespace(%s) %s ===> %s\n",
String8(getElementName()).string(),
String8(e.name).string(),