blob: 778b43adb50b0325a6fd8ea234f1ed8bef87a120 [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 Lesinski458b8772016-04-25 14:20:21 -070020#include <functional>
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080021#include <map>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080022#include <memory>
23#include <string>
24#include <tuple>
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080025#include <unordered_map>
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080026#include <vector>
27
Jeremy Meyer56f36e82022-05-20 20:35:42 +000028#include "Resource.h"
29#include "ResourceValues.h"
30#include "android-base/macros.h"
31#include "androidfw/ConfigDescription.h"
32#include "androidfw/IDiagnostics.h"
33#include "androidfw/Source.h"
34#include "androidfw/StringPiece.h"
35#include "androidfw/StringPool.h"
36#include "io/File.h"
37
Winson62ac8b52019-12-04 08:36:48 -080038using PolicyFlags = android::ResTable_overlayable_policy_header::PolicyFlags;
39
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080040namespace aapt {
41
Adam Lesinski71be7052017-12-12 16:48:07 -080042// The Public status of a resource.
43struct Visibility {
44 enum class Level {
45 kUndefined,
46 kPrivate,
47 kPublic,
48 };
49
50 Level level = Level::kUndefined;
Jeremy Meyer56f36e82022-05-20 20:35:42 +000051 android::Source source;
Adam Lesinski71be7052017-12-12 16:48:07 -080052 std::string comment;
Ryan Mitchell2e9bec12021-03-22 09:31:00 -070053
54 // Indicates that the resource id may change across builds and that the public R.java identifier
55 // for this resource should not be final. This is set to `true` for resources in `staging-group`
56 // tags.
57 bool staged_api = false;
Adam Lesinski9e10ac72015-10-16 14:37:48 -070058};
59
Adam Lesinski71be7052017-12-12 16:48:07 -080060// Represents <add-resource> in an overlay.
61struct AllowNew {
Jeremy Meyer56f36e82022-05-20 20:35:42 +000062 android::Source source;
Adam Lesinski71be7052017-12-12 16:48:07 -080063 std::string comment;
64};
Adam Lesinski4488f1c2017-05-26 17:33:38 -070065
Ryan Mitchell2fedba92021-04-23 07:47:38 -070066// Represents the staged resource id of a finalized resource.
67struct StagedId {
68 ResourceId id;
Jeremy Meyer56f36e82022-05-20 20:35:42 +000069 android::Source source;
Ryan Mitchell2fedba92021-04-23 07:47:38 -070070};
71
Adam Lesinski71be7052017-12-12 16:48:07 -080072struct Overlayable {
Ryan Mitchell54237ff2018-12-13 15:44:29 -080073 Overlayable() = default;
Yurii Zubrytskyia5775142022-11-02 17:49:49 -070074 Overlayable(android::StringPiece name, android::StringPiece actor) : name(name), actor(actor) {
75 }
76 Overlayable(android::StringPiece name, android::StringPiece actor, const android::Source& source)
77 : name(name), actor(actor), source(source) {
78 }
Ryan Mitchell54237ff2018-12-13 15:44:29 -080079
80 static const char* kActorScheme;
81 std::string name;
82 std::string actor;
Jeremy Meyer56f36e82022-05-20 20:35:42 +000083 android::Source source;
Ryan Mitchell54237ff2018-12-13 15:44:29 -080084};
85
86// Represents a declaration that a resource is overlayable at runtime.
87struct OverlayableItem {
88 explicit OverlayableItem(const std::shared_ptr<Overlayable>& overlayable)
89 : overlayable(overlayable) {}
Ryan Mitchell54237ff2018-12-13 15:44:29 -080090 std::shared_ptr<Overlayable> overlayable;
Winson62ac8b52019-12-04 08:36:48 -080091 PolicyFlags policies = PolicyFlags::NONE;
Adam Lesinskicacb28f2016-10-19 12:18:14 -070092 std::string comment;
Jeremy Meyer56f36e82022-05-20 20:35:42 +000093 android::Source source;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -080094};
95
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -080096class ResourceConfigValue {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070097 public:
Adam Lesinski71be7052017-12-12 16:48:07 -080098 // The configuration for which this value is defined.
MÃ¥rten Kongstad24c9aa62018-06-20 08:46:41 +020099 const android::ConfigDescription config;
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800100
Adam Lesinski71be7052017-12-12 16:48:07 -0800101 // The product for which this value is defined.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700102 const std::string product;
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800103
Adam Lesinski71be7052017-12-12 16:48:07 -0800104 // The actual Value.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700105 std::unique_ptr<Value> value;
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800106
Jeremy Meyer08c54a72025-02-24 11:01:49 -0800107 // Whether the value uses read/write feature flags
108 bool uses_readwrite_feature_flags = false;
109
Yurii Zubrytskyia5775142022-11-02 17:49:49 -0700110 ResourceConfigValue(const android::ConfigDescription& config, android::StringPiece product)
111 : config(config), product(product) {
112 }
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800113
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700114 private:
115 DISALLOW_COPY_AND_ASSIGN(ResourceConfigValue);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800116};
117
Adam Lesinski73bff1e2017-12-08 16:06:10 -0800118// Represents a resource entry, which may have varying values for each defined configuration.
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800119class ResourceEntry {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700120 public:
Adam Lesinski71be7052017-12-12 16:48:07 -0800121 // The name of the resource. Immutable, as this determines the order of this resource
122 // when doing lookups.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700123 const std::string name;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800124
Adam Lesinski71be7052017-12-12 16:48:07 -0800125 // The entry ID for this resource (the EEEE in 0xPPTTEEEE).
Ryan Mitchell4382e442021-07-14 12:53:01 -0700126 std::optional<ResourceId> id;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800127
Adam Lesinski71be7052017-12-12 16:48:07 -0800128 // Whether this resource is public (and must maintain the same entry ID across builds).
129 Visibility visibility;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800130
Ryan Mitchell4382e442021-07-14 12:53:01 -0700131 std::optional<AllowNew> allow_new;
Adam Lesinski71be7052017-12-12 16:48:07 -0800132
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700133 // The declarations of this resource as overlayable for RROs
Ryan Mitchell4382e442021-07-14 12:53:01 -0700134 std::optional<OverlayableItem> overlayable_item;
Adam Lesinski71be7052017-12-12 16:48:07 -0800135
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700136 // The staged resource id for a finalized resource.
Ryan Mitchell4382e442021-07-14 12:53:01 -0700137 std::optional<StagedId> staged_id;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700138
Adam Lesinski71be7052017-12-12 16:48:07 -0800139 // The resource's values for each configuration.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700140 std::vector<std::unique_ptr<ResourceConfigValue>> values;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800141
Jeremy Meyer3d8d4a12024-08-23 17:29:03 -0700142 // The resource's values that are behind disabled flags.
143 std::vector<std::unique_ptr<ResourceConfigValue>> flag_disabled_values;
144
Yurii Zubrytskyia5775142022-11-02 17:49:49 -0700145 explicit ResourceEntry(android::StringPiece name) : name(name) {
146 }
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800147
MÃ¥rten Kongstad24c9aa62018-06-20 08:46:41 +0200148 ResourceConfigValue* FindValue(const android::ConfigDescription& config,
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700149 android::StringPiece product = {});
150 const ResourceConfigValue* FindValue(const android::ConfigDescription& config,
151 android::StringPiece product = {}) const;
Adam Lesinski34a16872018-02-23 16:18:10 -0800152
MÃ¥rten Kongstad24c9aa62018-06-20 08:46:41 +0200153 ResourceConfigValue* FindOrCreateValue(const android::ConfigDescription& config,
Yurii Zubrytskyia5775142022-11-02 17:49:49 -0700154 android::StringPiece product);
MÃ¥rten Kongstad24c9aa62018-06-20 08:46:41 +0200155 std::vector<ResourceConfigValue*> FindAllValues(const android::ConfigDescription& config);
Adam Lesinski34a16872018-02-23 16:18:10 -0800156
Jeremy Meyer3d8d4a12024-08-23 17:29:03 -0700157 // Either returns the existing ResourceConfigValue in the disabled list with the given flag,
158 // config, and product or creates a new one and returns that. In either case the returned value
159 // does not have the flag set on the value so it must be set by the caller.
160 ResourceConfigValue* FindOrCreateFlagDisabledValue(const FeatureFlagAttribute& flag,
161 const android::ConfigDescription& config,
162 android::StringPiece product = {});
163
Adam Lesinski34a16872018-02-23 16:18:10 -0800164 template <typename Func>
165 std::vector<ResourceConfigValue*> FindValuesIf(Func f) {
166 std::vector<ResourceConfigValue*> results;
167 for (auto& config_value : values) {
168 if (f(config_value.get())) {
169 results.push_back(config_value.get());
170 }
171 }
172 return results;
173 }
174
175 bool HasDefaultValue() const;
Adam Lesinski458b8772016-04-25 14:20:21 -0700176
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700177 private:
178 DISALLOW_COPY_AND_ASSIGN(ResourceEntry);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800179};
180
Adam Lesinski71be7052017-12-12 16:48:07 -0800181// Represents a resource type (eg. string, drawable, layout, etc.) containing resource entries.
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800182class ResourceTableType {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700183 public:
Adam Lesinski71be7052017-12-12 16:48:07 -0800184 // The logical type of resource (string, drawable, layout, etc.).
Iurii Makhnof0c5ff42022-02-22 13:31:02 +0000185 const ResourceNamedType named_type;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800186
Adam Lesinski71be7052017-12-12 16:48:07 -0800187 // Whether this type is public (and must maintain the same type ID across builds).
188 Visibility::Level visibility_level = Visibility::Level::kUndefined;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800189
Adam Lesinski71be7052017-12-12 16:48:07 -0800190 // List of resources for this type.
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700191 std::vector<std::unique_ptr<ResourceEntry>> entries;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800192
Iurii Makhnof0c5ff42022-02-22 13:31:02 +0000193 explicit ResourceTableType(const ResourceNamedTypeRef& type)
194 : named_type(type.ToResourceNamedType()) {
195 }
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700196
Yurii Zubrytskyia5775142022-11-02 17:49:49 -0700197 ResourceEntry* CreateEntry(android::StringPiece name);
198 ResourceEntry* FindEntry(android::StringPiece name) const;
199 ResourceEntry* FindOrCreateEntry(android::StringPiece name);
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800200
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700201 private:
202 DISALLOW_COPY_AND_ASSIGN(ResourceTableType);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700203};
204
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800205class ResourceTablePackage {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700206 public:
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700207 std::string name;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700208
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700209 std::vector<std::unique_ptr<ResourceTableType>> types;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700210
Yurii Zubrytskyia5775142022-11-02 17:49:49 -0700211 explicit ResourceTablePackage(android::StringPiece name) : name(name) {
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700212 }
213
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700214 ResourceTablePackage() = default;
Iurii Makhnof0c5ff42022-02-22 13:31:02 +0000215 ResourceTableType* FindTypeWithDefaultName(const ResourceType type) const;
216 ResourceTableType* FindType(const ResourceNamedTypeRef& type) const;
217 ResourceTableType* FindOrCreateType(const ResourceNamedTypeRef& type);
Adam Lesinskie4bb9eb2016-02-12 22:18:51 -0800218
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700219 private:
220 DISALLOW_COPY_AND_ASSIGN(ResourceTablePackage);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800221};
222
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700223struct ResourceTableEntryView {
224 std::string name;
Ryan Mitchell4382e442021-07-14 12:53:01 -0700225 std::optional<uint16_t> id;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700226 Visibility visibility;
Ryan Mitchell4382e442021-07-14 12:53:01 -0700227 std::optional<AllowNew> allow_new;
228 std::optional<OverlayableItem> overlayable_item;
229 std::optional<StagedId> staged_id;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700230 std::vector<const ResourceConfigValue*> values;
Jeremy Meyer3d8d4a12024-08-23 17:29:03 -0700231 std::vector<const ResourceConfigValue*> flag_disabled_values;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700232
233 const ResourceConfigValue* FindValue(const android::ConfigDescription& config,
234 android::StringPiece product = {}) const;
Jeremy Meyer3d8d4a12024-08-23 17:29:03 -0700235
236 const ResourceConfigValue* FindFlagDisabledValue(const FeatureFlagAttribute& flag,
237 const android::ConfigDescription& config,
238 android::StringPiece product = {}) const;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700239};
240
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700241struct ResourceTableTypeView {
Iurii Makhnof0c5ff42022-02-22 13:31:02 +0000242 ResourceNamedType named_type;
Ryan Mitchell4382e442021-07-14 12:53:01 -0700243 std::optional<uint8_t> id;
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700244 Visibility::Level visibility_level = Visibility::Level::kUndefined;
245
246 // Entries sorted in ascending entry id order. If ids have not been assigned, the entries are
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700247 // sorted lexicographically.
248 std::vector<ResourceTableEntryView> entries;
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700249};
250
251struct ResourceTablePackageView {
252 std::string name;
Ryan Mitchell4382e442021-07-14 12:53:01 -0700253 std::optional<uint8_t> id;
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700254 // Types sorted in ascending type id order. If ids have not been assigned, the types are sorted by
255 // their declaration order in the ResourceType enum.
256 std::vector<ResourceTableTypeView> types;
257};
258
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700259struct ResourceTableViewOptions {
260 bool create_alias_entries = false;
261};
262
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700263struct ResourceTableView {
264 // Packages sorted in ascending package id order. If ids have not been assigned, the packages are
265 // sorted lexicographically.
266 std::vector<ResourceTablePackageView> packages;
267};
268
269enum class OnIdConflict {
270 // If the resource entry already exists but has a different resource id, the resource value will
271 // not be added to the table.
272 ERROR,
273
274 // If the resource entry already exists but has a different resource id, create a new resource
275 // with this resource name and id combination.
276 CREATE_ENTRY,
277};
278
279struct NewResource {
280 ResourceName name;
281 std::unique_ptr<Value> value;
282 android::ConfigDescription config;
283 std::string product;
284 std::optional<std::pair<ResourceId, OnIdConflict>> id;
285 std::optional<Visibility> visibility;
286 std::optional<OverlayableItem> overlayable;
287 std::optional<AllowNew> allow_new;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700288 std::optional<StagedId> staged_id;
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700289 bool allow_mangled = false;
Jeremy Meyer08c54a72025-02-24 11:01:49 -0800290 bool uses_readwrite_feature_flags = false;
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700291};
292
293struct NewResourceBuilder {
294 explicit NewResourceBuilder(const ResourceNameRef& name);
295 explicit NewResourceBuilder(const std::string& name);
296 NewResourceBuilder& SetValue(std::unique_ptr<Value> value, android::ConfigDescription config = {},
297 std::string product = {});
298 NewResourceBuilder& SetId(ResourceId id, OnIdConflict on_conflict = OnIdConflict::ERROR);
299 NewResourceBuilder& SetVisibility(Visibility id);
300 NewResourceBuilder& SetOverlayable(OverlayableItem overlayable);
301 NewResourceBuilder& SetAllowNew(AllowNew allow_new);
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700302 NewResourceBuilder& SetStagedId(StagedId id);
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700303 NewResourceBuilder& SetAllowMangled(bool allow_mangled);
Jeremy Meyer08c54a72025-02-24 11:01:49 -0800304 NewResourceBuilder& SetUsesReadWriteFeatureFlags(bool uses_feature_flags);
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700305 NewResource Build();
306
307 private:
308 NewResource res_;
309};
310
Adam Lesinski71be7052017-12-12 16:48:07 -0800311// The container and index for all resources defined for an app.
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800312class ResourceTable {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700313 public:
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700314 enum class Validation {
315 kEnabled,
316 kDisabled,
317 };
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800318
Ryan Mitchell83a37ad2018-08-06 16:32:24 -0700319 enum class CollisionResult { kKeepBoth, kKeepOriginal, kConflict, kTakeNew };
Adam Lesinski5c3464c2016-08-24 16:03:48 -0700320
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700321 ResourceTable() = default;
322 explicit ResourceTable(Validation validation);
Adam Lesinski5c3464c2016-08-24 16:03:48 -0700323
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000324 bool AddResource(NewResource&& res, android::IDiagnostics* diag);
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800325
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700326 // Retrieves a sorted a view of the packages, types, and entries sorted in ascending resource id
327 // order.
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700328 ResourceTableView GetPartitionedView(const ResourceTableViewOptions& options = {}) const;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800329
Yurii Zubrytskyicf91ab82023-04-24 18:34:13 -0700330 using ReferencedPackages = std::map<uint8_t, std::string>;
331 const ReferencedPackages& GetReferencedPackages() const {
332 return included_packages_;
333 }
334
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700335 struct SearchResult {
336 ResourceTablePackage* package;
337 ResourceTableType* type;
338 ResourceEntry* entry;
339 };
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700340
Ryan Mitchell4382e442021-07-14 12:53:01 -0700341 std::optional<SearchResult> FindResource(const ResourceNameRef& name) const;
342 std::optional<SearchResult> FindResource(const ResourceNameRef& name, ResourceId id) const;
Ryan Mitchell2fedba92021-04-23 07:47:38 -0700343 bool RemoveResource(const ResourceNameRef& name, ResourceId id) const;
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700344
Adam Lesinski71be7052017-12-12 16:48:07 -0800345 // Returns the package struct with the given name, or nullptr if such a package does not
346 // exist. The empty string is a valid package and typically is used to represent the
347 // 'current' package before it is known to the ResourceTable.
Yurii Zubrytskyia5775142022-11-02 17:49:49 -0700348 ResourceTablePackage* FindPackage(android::StringPiece name) const;
349 ResourceTablePackage* FindOrCreatePackage(android::StringPiece name);
David Chaloupkae3c1a4a2018-01-18 13:44:36 +0000350
Shane Farmer0a5b2012017-06-22 12:24:12 -0700351 std::unique_ptr<ResourceTable> Clone() const;
352
Jeremy Meyer211bec22024-06-04 14:22:03 -0700353 // When a collision of resources occurs, these methods decide which value to keep.
354 static CollisionResult ResolveFlagCollision(FlagStatus existing, FlagStatus incoming);
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700355 static CollisionResult ResolveValueCollision(Value* existing, Value* incoming);
356
Adam Lesinski71be7052017-12-12 16:48:07 -0800357 // The string pool used by this resource table. Values that reference strings must use
358 // this pool to create their strings.
359 // NOTE: `string_pool` must come before `packages` so that it is destroyed after.
360 // When `string_pool` references are destroyed (as they will be when `packages` is destroyed),
361 // they decrement a refCount, which would cause invalid memory access if the pool was already
362 // destroyed.
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000363 android::StringPool string_pool;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800364
David Chaloupkae3c1a4a2018-01-18 13:44:36 +0000365 // The list of packages in this table, sorted alphabetically by package name and increasing
366 // package ID (missing ID being the lowest).
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700367 std::vector<std::unique_ptr<ResourceTablePackage>> packages;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800368
Adam Lesinskiceb9b2f2017-02-16 12:05:42 -0800369 // Set of dynamic packages that this table may reference. Their package names get encoded
370 // into the resources.arsc along with their compile-time assigned IDs.
Yurii Zubrytskyicf91ab82023-04-24 18:34:13 -0700371 ReferencedPackages included_packages_;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700372
373 private:
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700374 DISALLOW_COPY_AND_ASSIGN(ResourceTable);
Ryan Mitchell9634efb2021-03-19 14:53:17 -0700375
376 Validation validation_ = Validation::kEnabled;
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800377};
378
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700379} // namespace aapt
Adam Lesinski6f6ceb72014-11-14 14:48:12 -0800380
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700381#endif // AAPT_RESOURCE_TABLE_H