summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceUtils.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2019-12-18 15:20:48 -0800
committerRyan Mitchell <rtmitchell@google.com>2019-12-19 18:22:45 +0000
commitcd78febeac2956525931b1f0f15ad507bec6a24c (patch)
treef56e8c7ca35d738b7bfe654bbc2cbf1f3f01dadd /tools/aapt2/ResourceUtils.cpp
parent0cf243eafd3f8a5f1768d5353fc3bcba8a5fe771 (diff)
Recognize dynamic res ids as valid
Shared libraries are assigned package id 0. Resource ids that start with 0x00 are not invalid. This change changes is_valid to accept dynamic resource ids and adds an is_valid_static method for when an id must have a non-zero package id. This also fixes an issue that made layouts in shared libraries that use internal attributes exclude compiled resource ids from the binay xml output. Bug: 146491000 Test: Build a shared library with a layout that uses app attributes as well as android attribute and verify that all attributes have assigned resource ids using `aapt2 dump xmltree` Change-Id: Ibc0407c610ffc98d7aaf233c37c065912ab0d516
Diffstat (limited to 'tools/aapt2/ResourceUtils.cpp')
-rw-r--r--tools/aapt2/ResourceUtils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp
index 03009aaeead2..3623b1112bc6 100644
--- a/tools/aapt2/ResourceUtils.cpp
+++ b/tools/aapt2/ResourceUtils.cpp
@@ -516,7 +516,7 @@ Maybe<ResourceId> ParseResourceId(const StringPiece& str) {
if (android::ResTable::stringToInt(str16.data(), str16.size(), &value)) {
if (value.dataType == android::Res_value::TYPE_INT_HEX) {
ResourceId id(value.data);
- if (id.is_valid_dynamic()) {
+ if (id.is_valid()) {
return id;
}
}