summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2016-08-03 15:40:19 -0700
committerAdam Lesinski <adamlesinski@google.com>2016-08-03 16:54:15 -0700
commit4d219da3c43f12ff000e685ae069374b618b30fc (patch)
treed9653ade178f9bbd605d7bfb399f24c8800e809d
parent76af60554ca5c74a8327774fdc4bf758f7eb518f (diff)
AAPT: Fix feature split generation of ID resources
ID resources that get generated on demand with the notation @+id/name were previously not given the appropriate type ID offset when being built as feature splits. This change declares an ID type ahead of time so that the type ID offset is applied before IDs can be generated. Bug:30607637 Change-Id: I122a9133cb01b35e9892103ec52fc228dc65bf1a
-rw-r--r--tools/aapt/ResourceTable.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 6d80a69b7444..4d5bb312aaf1 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2623,6 +2623,14 @@ status_t ResourceTable::assignResourceIds()
const SourcePos unknown(String8("????"), 0);
sp<Type> attr = p->getType(String16("attr"), unknown);
+ // Force creation of ID if we are building feature splits.
+ // Auto-generated ID resources won't apply the type ID offset correctly unless
+ // the offset is applied here first.
+ // b/30607637
+ if (mPackageType == AppFeature && p->getName() == mAssetsPackage) {
+ sp<Type> id = p->getType(String16("id"), unknown);
+ }
+
// Assign indices...
const size_t typeCount = p->getOrderedTypes().size();
for (size_t ti = 0; ti < typeCount; ti++) {