AAPT2: Fix resource table load time regression
A previous change (deee395) caused duplicate entries to be created for
entries eith entry ids greater than 0x0ff. This is because the wrong
data type was used (uint8_t instead of uint16_t). This made loading in
resources slower as well since more entries had to be iterated over.
Bug: 36051266
Test: Dumping all resources in 700 apks found in the android tree took 1
minute instead of 5 minutes. Created a test in aapt2_tests.
Change-Id: I1c3d830da517a56ac3496221dbe605c72e0c6014
diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h
index c40323c..5a43a2d 100644
--- a/tools/aapt2/ResourceTable.h
+++ b/tools/aapt2/ResourceTable.h
@@ -146,9 +146,10 @@
explicit ResourceTableType(const ResourceType type) : type(type) {}
- ResourceEntry* FindEntry(const android::StringPiece& name, Maybe<uint8_t> id = Maybe<uint8_t>());
+ ResourceEntry* FindEntry(const android::StringPiece& name,
+ Maybe<uint16_t> id = Maybe<uint16_t>());
ResourceEntry* FindOrCreateEntry(const android::StringPiece& name,
- Maybe<uint8_t> id = Maybe<uint8_t>());
+ Maybe<uint16_t> id = Maybe<uint16_t>());
private:
DISALLOW_COPY_AND_ASSIGN(ResourceTableType);