summaryrefslogtreecommitdiff
path: root/tools/aapt2/StringPool.h
diff options
context:
space:
mode:
author Ryan Mitchell <rtmitchell@google.com> 2018-11-13 10:40:07 -0800
committer Ryan Mitchell <rtmitchell@google.com> 2018-11-15 11:37:01 -0800
commit4e9a922ede24f7f7bfe793321f7328623ee2a061 (patch)
treeb74d2ecefc7e6902ff37c1be7798adc5861ae13d /tools/aapt2/StringPool.h
parent67dd91e6a301c9dd15f4f95ac715064534296a53 (diff)
Fix loaded apk string pool order
Loading in an APk changed the ordering of strings in the string pool. When loading an apk, assign the strings to the same index as they are in the ResStringPool. Bug: 118831219 Test: "aapt2 dump strings left.apk" prints in the correct order, "aapt2 convert left.apk --output-format binary -o left_binary.apk" has entries in the correct order, and aapt2_tests Change-Id: I00014c02195f39c1152a110e90083d9b14e9216e
Diffstat (limited to 'tools/aapt2/StringPool.h')
-rw-r--r--tools/aapt2/StringPool.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/aapt2/StringPool.h b/tools/aapt2/StringPool.h
index 1006ca970dc5..115d5d315b8f 100644
--- a/tools/aapt2/StringPool.h
+++ b/tools/aapt2/StringPool.h
@@ -166,7 +166,8 @@ class StringPool {
// Adds a string to the pool, unless it already exists, with a context object that can be used
// when sorting the string pool. Returns a reference to the string in the pool.
- Ref MakeRef(const android::StringPiece& str, const Context& context);
+ Ref MakeRef(const android::StringPiece& str, const Context& context,
+ Maybe<size_t> index = {});
// Adds a string from another string pool. Returns a reference to the string in the string pool.
Ref MakeRef(const Ref& ref);
@@ -210,7 +211,8 @@ class StringPool {
static bool Flatten(BigBuffer* out, const StringPool& pool, bool utf8, IDiagnostics* diag);
- Ref MakeRefImpl(const android::StringPiece& str, const Context& context, bool unique);
+ Ref MakeRefImpl(const android::StringPiece& str, const Context& context, bool unique,
+ Maybe<size_t> index = {});
void ReAssignIndices();
std::vector<std::unique_ptr<Entry>> strings_;