blob: 3dd0a769d944a2c2e63bdeb15937b760f8cf7def [file] [log] [blame]
Adam Lesinski6f6ceb72014-11-14 14:48:12 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef AAPT_RESOURCE_TABLE_H
18#define AAPT_RESOURCE_TABLE_H
19
Adam Lesinski1ab598f2015-08-14 14:26:04 -070020#include "Diagnostics.h"
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080021#include "Resource.h"
22#include "ResourceValues.h"
23#include "Source.h"
24#include "StringPool.h"
Adam Lesinski355f2852016-02-13 20:26:45 -080025#include "io/File.h"
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080026
Adam Lesinskid5083f62017-01-16 15:07:21 -080027#include "android-base/macros.h"
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020028#include "androidfw/ConfigDescription.h"
Adam Lesinskid5083f62017-01-16 15:07:21 -080029#include "androidfw/StringPiece.h"
30
Adam Lesinski458b8772016-04-25 14:20:21 -070031#include <functional>
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080032#include <map>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080033#include <memory>
34#include <string>
35#include <tuple>
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080036#include <unordered_map>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080037#include <vector>
38
39namespace aapt {
40
Adam Lesinski71be7052017-12-12 16:48:07 -080041// The Public status of a resource.
42struct Visibility {
43 enum class Level {
44 kUndefined,
45 kPrivate,
46 kPublic,
47 };
48
49 Level level = Level::kUndefined;
50 Source source;
51 std::string comment;
Adam Lesinski9e10ac72015-10-16 14:37:48 -070052};
53
Adam Lesinski71be7052017-12-12 16:48:07 -080054// Represents <add-resource> in an overlay.
55struct AllowNew {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070056 Source source;
Adam Lesinski71be7052017-12-12 16:48:07 -080057 std::string comment;
58};
Adam Lesinski4488f1c2017-05-26 17:33:38 -070059
Ryan Mitchelle4e989c2018-10-29 02:21:50 -070060// Represents a declaration that a resource is overayable at runtime.
Adam Lesinski71be7052017-12-12 16:48:07 -080061struct Overlayable {
Ryan Mitchelle4e989c2018-10-29 02:21:50 -070062 // Represents the types overlays that are allowed to overlay the resource.
63 enum class Policy {
64 // The resource can be overlaid by any overlay.
65 kPublic,
66
67 // The resource can be overlaid by any overlay on the system partition.
68 kSystem,
69
70 // The resource can be overlaid by any overlay on the vendor partition.
71 kVendor,
72
73 // The resource can be overlaid by any overlay on the product partition.
74 kProduct,
75
76 // The resource can be overlaid by any overlay on the product services partition.
77 kProductServices,
78 };
79
80 Maybe<Policy> policy;
Adam Lesinski71be7052017-12-12 16:48:07 -080081 Source source;
Adam Lesinskicacb28f2016-10-19 12:18:14 -070082 std::string comment;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080083};
84
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080085class ResourceConfigValue {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070086 public:
Adam Lesinski71be7052017-12-12 16:48:07 -080087 // The configuration for which this value is defined.
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020088 const android::ConfigDescription config;
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080089
Adam Lesinski71be7052017-12-12 16:48:07 -080090 // The product for which this value is defined.
Adam Lesinskicacb28f2016-10-19 12:18:14 -070091 const std::string product;
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080092
Adam Lesinski71be7052017-12-12 16:48:07 -080093 // The actual Value.
Adam Lesinskicacb28f2016-10-19 12:18:14 -070094 std::unique_ptr<Value> value;
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080095
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020096 ResourceConfigValue(const android::ConfigDescription& config, const android::StringPiece& product)
Adam Lesinskid5083f62017-01-16 15:07:21 -080097 : config(config), product(product.to_string()) {}
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080098
Adam Lesinskicacb28f2016-10-19 12:18:14 -070099 private:
100 DISALLOW_COPY_AND_ASSIGN(ResourceConfigValue);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800101};
102
Adam Lesinski73bff1e2017-12-08 16:06:10 -0800103// Represents a resource entry, which may have varying values for each defined configuration.
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800104class ResourceEntry {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700105 public:
Adam Lesinski71be7052017-12-12 16:48:07 -0800106 // The name of the resource. Immutable, as this determines the order of this resource
107 // when doing lookups.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700108 const std::string name;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800109
Adam Lesinski71be7052017-12-12 16:48:07 -0800110 // The entry ID for this resource (the EEEE in 0xPPTTEEEE).
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700111 Maybe<uint16_t> id;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800112
Adam Lesinski71be7052017-12-12 16:48:07 -0800113 // Whether this resource is public (and must maintain the same entry ID across builds).
114 Visibility visibility;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800115
Adam Lesinski71be7052017-12-12 16:48:07 -0800116 Maybe<AllowNew> allow_new;
117
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700118 // The declarations of this resource as overlayable for RROs
119 std::vector<Overlayable> overlayable_declarations;
Adam Lesinski71be7052017-12-12 16:48:07 -0800120
121 // The resource's values for each configuration.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700122 std::vector<std::unique_ptr<ResourceConfigValue>> values;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800123
Adam Lesinskid5083f62017-01-16 15:07:21 -0800124 explicit ResourceEntry(const android::StringPiece& name) : name(name.to_string()) {}
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800125
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200126 ResourceConfigValue* FindValue(const android::ConfigDescription& config);
Adam Lesinski34a16872018-02-23 16:18:10 -0800127
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200128 ResourceConfigValue* FindValue(const android::ConfigDescription& config,
Adam Lesinskid5083f62017-01-16 15:07:21 -0800129 const android::StringPiece& product);
Adam Lesinski34a16872018-02-23 16:18:10 -0800130
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200131 ResourceConfigValue* FindOrCreateValue(const android::ConfigDescription& config,
Adam Lesinskid5083f62017-01-16 15:07:21 -0800132 const android::StringPiece& product);
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200133 std::vector<ResourceConfigValue*> FindAllValues(const android::ConfigDescription& config);
Adam Lesinski34a16872018-02-23 16:18:10 -0800134
135 template <typename Func>
136 std::vector<ResourceConfigValue*> FindValuesIf(Func f) {
137 std::vector<ResourceConfigValue*> results;
138 for (auto& config_value : values) {
139 if (f(config_value.get())) {
140 results.push_back(config_value.get());
141 }
142 }
143 return results;
144 }
145
146 bool HasDefaultValue() const;
Adam Lesinski458b8772016-04-25 14:20:21 -0700147
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700148 private:
149 DISALLOW_COPY_AND_ASSIGN(ResourceEntry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800150};
151
Adam Lesinski71be7052017-12-12 16:48:07 -0800152// Represents a resource type (eg. string, drawable, layout, etc.) containing resource entries.
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800153class ResourceTableType {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700154 public:
Adam Lesinski71be7052017-12-12 16:48:07 -0800155 // The logical type of resource (string, drawable, layout, etc.).
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700156 const ResourceType type;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800157
Adam Lesinski71be7052017-12-12 16:48:07 -0800158 // The type ID for this resource (the TT in 0xPPTTEEEE).
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700159 Maybe<uint8_t> id;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800160
Adam Lesinski71be7052017-12-12 16:48:07 -0800161 // Whether this type is public (and must maintain the same type ID across builds).
162 Visibility::Level visibility_level = Visibility::Level::kUndefined;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800163
Adam Lesinski71be7052017-12-12 16:48:07 -0800164 // List of resources for this type.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700165 std::vector<std::unique_ptr<ResourceEntry>> entries;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800166
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700167 explicit ResourceTableType(const ResourceType type) : type(type) {}
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700168
Ryan Mitchell8d4ee972018-08-27 11:24:04 -0700169 ResourceEntry* FindEntry(const android::StringPiece& name,
170 Maybe<uint16_t> id = Maybe<uint16_t>());
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700171 ResourceEntry* FindOrCreateEntry(const android::StringPiece& name,
Ryan Mitchell8d4ee972018-08-27 11:24:04 -0700172 Maybe<uint16_t> id = Maybe<uint16_t>());
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800173
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700174 private:
175 DISALLOW_COPY_AND_ASSIGN(ResourceTableType);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700176};
177
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800178class ResourceTablePackage {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700179 public:
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700180 std::string name;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700181
Adam Lesinski71be7052017-12-12 16:48:07 -0800182 // The package ID (the PP in 0xPPTTEEEE).
183 Maybe<uint8_t> id;
184
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700185 std::vector<std::unique_ptr<ResourceTableType>> types;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700186
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700187 ResourceTablePackage() = default;
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700188 ResourceTableType* FindType(ResourceType type, Maybe<uint8_t> id = Maybe<uint8_t>());
189 ResourceTableType* FindOrCreateType(const ResourceType type,
190 Maybe<uint8_t> id = Maybe<uint8_t>());
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800191
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700192 private:
193 DISALLOW_COPY_AND_ASSIGN(ResourceTablePackage);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800194};
195
Adam Lesinski71be7052017-12-12 16:48:07 -0800196// The container and index for all resources defined for an app.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800197class ResourceTable {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700198 public:
199 ResourceTable() = default;
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700200 explicit ResourceTable(bool validate_resources) : validate_resources_(validate_resources) {}
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800201
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700202 enum class CollisionResult { kKeepBoth, kKeepOriginal, kConflict, kTakeNew };
Adam Lesinski5c3464c2016-08-24 16:03:48 -0700203
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700204 using CollisionResolverFunc = std::function<CollisionResult(Value*, Value*)>;
Adam Lesinski5c3464c2016-08-24 16:03:48 -0700205
Adam Lesinski71be7052017-12-12 16:48:07 -0800206 // When a collision of resources occurs, this method decides which value to keep.
Adam Lesinskib1afa072017-03-29 13:52:38 -0700207 static CollisionResult ResolveValueCollision(Value* existing, Value* incoming);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800208
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700209 // When a collision of resources occurs, this method keeps both values
210 static CollisionResult IgnoreCollision(Value* existing, Value* incoming);
211
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200212 bool AddResource(const ResourceNameRef& name, const android::ConfigDescription& config,
Adam Lesinskid5083f62017-01-16 15:07:21 -0800213 const android::StringPiece& product, std::unique_ptr<Value> value,
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700214 IDiagnostics* diag);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700215
Adam Lesinski71be7052017-12-12 16:48:07 -0800216 bool AddResourceWithId(const ResourceNameRef& name, const ResourceId& res_id,
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200217 const android::ConfigDescription& config,
218 const android::StringPiece& product, std::unique_ptr<Value> value,
219 IDiagnostics* diag);
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800220
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200221 bool AddFileReference(const ResourceNameRef& name, const android::ConfigDescription& config,
Adam Lesinskid5083f62017-01-16 15:07:21 -0800222 const Source& source, const android::StringPiece& path, IDiagnostics* diag);
Adam Lesinskifb48d292015-11-07 15:52:13 -0800223
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200224 bool AddFileReferenceMangled(const ResourceNameRef& name, const android::ConfigDescription& config,
Adam Lesinski71be7052017-12-12 16:48:07 -0800225 const Source& source, const android::StringPiece& path,
226 io::IFile* file, IDiagnostics* diag);
Adam Lesinskie78fd612015-10-22 12:48:43 -0700227
Adam Lesinski71be7052017-12-12 16:48:07 -0800228 // Same as AddResource, but doesn't verify the validity of the name. This is used
229 // when loading resources from an existing binary resource table that may have mangled names.
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200230 bool AddResourceMangled(const ResourceNameRef& name, const android::ConfigDescription& config,
Adam Lesinski71be7052017-12-12 16:48:07 -0800231 const android::StringPiece& product, std::unique_ptr<Value> value,
232 IDiagnostics* diag);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800233
Adam Lesinski71be7052017-12-12 16:48:07 -0800234 bool AddResourceWithIdMangled(const ResourceNameRef& name, const ResourceId& id,
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200235 const android::ConfigDescription& config,
Adam Lesinski71be7052017-12-12 16:48:07 -0800236 const android::StringPiece& product, std::unique_ptr<Value> value,
237 IDiagnostics* diag);
Adam Lesinski769de982015-04-10 19:43:55 -0700238
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700239 bool GetValidateResources();
240
Adam Lesinski71be7052017-12-12 16:48:07 -0800241 bool SetVisibility(const ResourceNameRef& name, const Visibility& visibility, IDiagnostics* diag);
242 bool SetVisibilityMangled(const ResourceNameRef& name, const Visibility& visibility,
243 IDiagnostics* diag);
244 bool SetVisibilityWithId(const ResourceNameRef& name, const Visibility& visibility,
245 const ResourceId& res_id, IDiagnostics* diag);
246 bool SetVisibilityWithIdMangled(const ResourceNameRef& name, const Visibility& visibility,
247 const ResourceId& res_id, IDiagnostics* diag);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800248
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700249 bool AddOverlayable(const ResourceNameRef& name, const Overlayable& overlayable,
Adam Lesinski71be7052017-12-12 16:48:07 -0800250 IDiagnostics* diag);
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700251 bool AddOverlayableMangled(const ResourceNameRef& name, const Overlayable& overlayable,
Adam Lesinski71be7052017-12-12 16:48:07 -0800252 IDiagnostics* diag);
253
254 bool SetAllowNew(const ResourceNameRef& name, const AllowNew& allow_new, IDiagnostics* diag);
255 bool SetAllowNewMangled(const ResourceNameRef& name, const AllowNew& allow_new,
256 IDiagnostics* diag);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800257
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700258 struct SearchResult {
259 ResourceTablePackage* package;
260 ResourceTableType* type;
261 ResourceEntry* entry;
262 };
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700263
Adam Lesinski71be7052017-12-12 16:48:07 -0800264 Maybe<SearchResult> FindResource(const ResourceNameRef& name) const;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700265
Adam Lesinski71be7052017-12-12 16:48:07 -0800266 // Returns the package struct with the given name, or nullptr if such a package does not
267 // exist. The empty string is a valid package and typically is used to represent the
268 // 'current' package before it is known to the ResourceTable.
269 ResourceTablePackage* FindPackage(const android::StringPiece& name) const;
Adam Lesinskiceb9b2f2017-02-16 12:05:42 -0800270
Adam Lesinski71be7052017-12-12 16:48:07 -0800271 ResourceTablePackage* FindPackageById(uint8_t id) const;
Adam Lesinskiceb9b2f2017-02-16 12:05:42 -0800272
273 ResourceTablePackage* CreatePackage(const android::StringPiece& name, Maybe<uint8_t> id = {});
274
David Chaloupkae3c1a4a2018-01-18 13:44:36 +0000275 // Attempts to find a package having the specified name and ID. If not found, a new package
276 // of the specified parameters is created and returned.
277 ResourceTablePackage* CreatePackageAllowingDuplicateNames(const android::StringPiece& name,
278 const Maybe<uint8_t> id);
279
Shane Farmer0a5b2012017-06-22 12:24:12 -0700280 std::unique_ptr<ResourceTable> Clone() const;
281
Adam Lesinski71be7052017-12-12 16:48:07 -0800282 // The string pool used by this resource table. Values that reference strings must use
283 // this pool to create their strings.
284 // NOTE: `string_pool` must come before `packages` so that it is destroyed after.
285 // When `string_pool` references are destroyed (as they will be when `packages` is destroyed),
286 // they decrement a refCount, which would cause invalid memory access if the pool was already
287 // destroyed.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700288 StringPool string_pool;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800289
David Chaloupkae3c1a4a2018-01-18 13:44:36 +0000290 // The list of packages in this table, sorted alphabetically by package name and increasing
291 // package ID (missing ID being the lowest).
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700292 std::vector<std::unique_ptr<ResourceTablePackage>> packages;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800293
Adam Lesinskiceb9b2f2017-02-16 12:05:42 -0800294 // Set of dynamic packages that this table may reference. Their package names get encoded
295 // into the resources.arsc along with their compile-time assigned IDs.
296 std::map<size_t, std::string> included_packages_;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700297
298 private:
Adam Lesinskib1afa072017-03-29 13:52:38 -0700299 // The function type that validates a symbol name. Returns a non-empty StringPiece representing
300 // the offending character (which may be more than one byte in UTF-8). Returns an empty string
301 // if the name was valid.
302 using NameValidator = android::StringPiece(const android::StringPiece&);
303
Adam Lesinskid5083f62017-01-16 15:07:21 -0800304 ResourceTablePackage* FindOrCreatePackage(const android::StringPiece& name);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700305
Adam Lesinski71be7052017-12-12 16:48:07 -0800306 bool ValidateName(NameValidator validator, const ResourceNameRef& name, const Source& source,
307 IDiagnostics* diag);
308
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700309 bool AddResourceImpl(const ResourceNameRef& name, const ResourceId& res_id,
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200310 const android::ConfigDescription& config,
311 const android::StringPiece& product, std::unique_ptr<Value> value,
312 NameValidator name_validator, const CollisionResolverFunc& conflict_resolver,
313 IDiagnostics* diag);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700314
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200315 bool AddFileReferenceImpl(const ResourceNameRef& name, const android::ConfigDescription& config,
Adam Lesinskid5083f62017-01-16 15:07:21 -0800316 const Source& source, const android::StringPiece& path, io::IFile* file,
Adam Lesinskib1afa072017-03-29 13:52:38 -0700317 NameValidator name_validator, IDiagnostics* diag);
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800318
Adam Lesinski71be7052017-12-12 16:48:07 -0800319 bool SetVisibilityImpl(const ResourceNameRef& name, const Visibility& visibility,
320 const ResourceId& res_id, NameValidator name_validator,
321 IDiagnostics* diag);
322
323 bool SetAllowNewImpl(const ResourceNameRef& name, const AllowNew& allow_new,
324 NameValidator name_validator, IDiagnostics* diag);
325
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700326 bool AddOverlayableImpl(const ResourceNameRef& name, const Overlayable& overlayable,
Adam Lesinski71be7052017-12-12 16:48:07 -0800327 NameValidator name_validator, IDiagnostics* diag);
328
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700329 bool SetSymbolStateImpl(const ResourceNameRef& name, const ResourceId& res_id,
Adam Lesinski71be7052017-12-12 16:48:07 -0800330 const Visibility& symbol, NameValidator name_validator,
331 IDiagnostics* diag);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700332
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700333 // Controls whether the table validates resource names and prevents duplicate resource names
334 bool validate_resources_ = true;
335
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700336 DISALLOW_COPY_AND_ASSIGN(ResourceTable);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800337};
338
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700339} // namespace aapt
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800340
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700341#endif // AAPT_RESOURCE_TABLE_H