Switch ResourceName to use ResourceNamedType instead of ResourceType.
DD: go/custom-resource-types-in-aapt2
Bug: b/215108200
Test: Resource_test.cpp
Change-Id: I0b97fc0024523700e01adce788bb934d388da288
diff --git a/tools/aapt2/process/SymbolTable.cpp b/tools/aapt2/process/SymbolTable.cpp
index 2d58cbf..92b45c3 100644
--- a/tools/aapt2/process/SymbolTable.cpp
+++ b/tools/aapt2/process/SymbolTable.cpp
@@ -185,7 +185,7 @@
const ResourceName& name) {
std::optional<ResourceTable::SearchResult> result = table_->FindResource(name);
if (!result) {
- if (name.type == ResourceType::kAttr) {
+ if (name.type.type == ResourceType::kAttr) {
// Recurse and try looking up a private attribute.
return FindByName(ResourceName(name.package, ResourceType::kAttrPrivate, name.entry));
}
@@ -203,7 +203,7 @@
(sr.entry->id.value().package_id() == 0) || sr.entry->visibility.staged_api;
}
- if (name.type == ResourceType::kAttr || name.type == ResourceType::kAttrPrivate) {
+ if (name.type.type == ResourceType::kAttr || name.type.type == ResourceType::kAttrPrivate) {
const ConfigDescription kDefaultConfig;
ResourceConfigValue* config_value = sr.entry->FindValue(kDefaultConfig);
if (config_value) {
@@ -366,7 +366,7 @@
}
std::unique_ptr<SymbolTable::Symbol> s;
- if (real_name.type == ResourceType::kAttr) {
+ if (real_name.type.type == ResourceType::kAttr) {
s = LookupAttributeInTable(asset_manager_, res_id);
} else {
s = util::make_unique<SymbolTable::Symbol>();
@@ -413,7 +413,7 @@
ResourceName& name = maybe_name.value();
std::unique_ptr<SymbolTable::Symbol> s;
- if (name.type == ResourceType::kAttr) {
+ if (name.type.type == ResourceType::kAttr) {
s = LookupAttributeInTable(asset_manager_, id);
} else {
s = util::make_unique<SymbolTable::Symbol>();
diff --git a/tools/aapt2/process/SymbolTable.h b/tools/aapt2/process/SymbolTable.h
index 65ae7be..c17837c 100644
--- a/tools/aapt2/process/SymbolTable.h
+++ b/tools/aapt2/process/SymbolTable.h
@@ -38,7 +38,7 @@
std::hash<std::string> str_hash;
android::hash_t hash = 0;
hash = android::JenkinsHashMix(hash, (uint32_t)str_hash(name.package));
- hash = android::JenkinsHashMix(hash, (uint32_t)name.type);
+ hash = android::JenkinsHashMix(hash, (uint32_t)str_hash(name.type.name));
hash = android::JenkinsHashMix(hash, (uint32_t)str_hash(name.entry));
return hash;
}