summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2016-10-21 13:38:42 -0700
committerAdam Lesinski <adamlesinski@google.com>2016-10-21 13:51:59 -0700
commitb54ef10f55ab9f11fdc73b0436b708e518fb5029 (patch)
tree52b1225899d166dd1f65a576bdf7fcc6796f0224 /tools/aapt2/ResourceParser.cpp
parent011cef54ee0a8260f6b4381c7ea28a450cd3cbce (diff)
AAPT2: Ensure string pool ordering is compact
Keep styledstrings at the beginning of the StringPool to reduce the padding in the StyledString array. Bug:32336940 Test: manual Change-Id: Iec820c21a54daac40ecc3b2f87517a0f1efc9d3d
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 51aed135a39e..7d50e1d38816 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -533,7 +533,8 @@ std::unique_ptr<Item> ResourceParser::parseXml(xml::XmlPullParser* parser,
if (!styleString.spans.empty()) {
// This can only be a StyledString.
return util::make_unique<StyledString>(mTable->stringPool.makeRef(
- styleString, StringPool::Context{1, mConfig}));
+ styleString,
+ StringPool::Context(StringPool::Context::kStylePriority, mConfig)));
}
auto onCreateReference = [&](const ResourceName& name) {
@@ -559,13 +560,13 @@ std::unique_ptr<Item> ResourceParser::parseXml(xml::XmlPullParser* parser,
if (typeMask & android::ResTable_map::TYPE_STRING) {
// Use the trimmed, escaped string.
return util::make_unique<String>(mTable->stringPool.makeRef(
- styleString.str, StringPool::Context{1, mConfig}));
+ styleString.str, StringPool::Context(mConfig)));
}
if (allowRawValue) {
// We can't parse this so return a RawString if we are allowed.
return util::make_unique<RawString>(
- mTable->stringPool.makeRef(rawValue, StringPool::Context{1, mConfig}));
+ mTable->stringPool.makeRef(rawValue, StringPool::Context(mConfig)));
}
return {};
}