From 5069dd69898bd0d9c69ba2bbd37239ec8d1c9dc6 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 30 Sep 2014 16:06:58 -0700 Subject: Fix issue with using locally defined attrs in a shared lib The attribute name resource IDs were never fixed up with the runtime package ID so we weren't finding attributes whenever the runtime package ID was different than the build time one, which happened to be when a shared lib referenced itself (0x00 vs 0x02). Bug:17666947 Change-Id: Icf3e874bcea0e27eebe42d60fbed626a34bf9266 --- libs/androidfw/ResourceTypes.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libs/androidfw') diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 8cef137..61a767c 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -1185,7 +1185,11 @@ uint32_t ResXMLParser::getAttributeNameResID(size_t idx) const { int32_t id = getAttributeNameID(idx); if (id >= 0 && (size_t)id < mTree.mNumResIds) { - return dtohl(mTree.mResIds[id]); + uint32_t resId = dtohl(mTree.mResIds[id]); + if (mTree.mDynamicRefTable == NULL || + mTree.mDynamicRefTable->lookupResourceId(&resId) == NO_ERROR) { + return resId; + } } return 0; } -- cgit v1.1