blob: 12cf65be05c7eeeafaff9afc4c09e74cbadf5a5e [file] [log] [blame]
Adam Lesinski59e04c62016-02-04 15:59:23 -08001/*
2 * Copyright (C) 2016 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
Adam Lesinski5bd44232017-09-07 09:39:07 -070017syntax = "proto3";
18
Adam Lesinskib58c3ef2017-09-12 17:39:52 -070019import "frameworks/base/tools/aapt2/Configuration.proto";
20
Adam Lesinski5bd44232017-09-07 09:39:07 -070021package aapt.pb;
Adam Lesinski59e04c62016-02-04 15:59:23 -080022
Adam Lesinski4ffea042017-08-10 15:37:28 -070023option java_package = "com.android.aapt";
Adam Lesinski59e04c62016-02-04 15:59:23 -080024option optimize_for = LITE_RUNTIME;
25
Adam Lesinski0c808952017-07-10 05:40:39 -070026// A string pool that wraps the binary form of the C++ class android::ResStringPool.
Adam Lesinski59e04c62016-02-04 15:59:23 -080027message StringPool {
Adam Lesinski5bd44232017-09-07 09:39:07 -070028 bytes data = 1;
Adam Lesinski59e04c62016-02-04 15:59:23 -080029}
30
Adam Lesinski4ffea042017-08-10 15:37:28 -070031// The position of a declared entity within a file.
32message SourcePosition {
Adam Lesinski5bd44232017-09-07 09:39:07 -070033 uint32 line_number = 1;
34 uint32 column_number = 2;
Adam Lesinski4ffea042017-08-10 15:37:28 -070035}
36
Adam Lesinski0c808952017-07-10 05:40:39 -070037// Developer friendly source file information for an entity in the resource table.
Adam Lesinski59e04c62016-02-04 15:59:23 -080038message Source {
Adam Lesinski0c808952017-07-10 05:40:39 -070039 // The index of the string path within the source string pool of a ResourceTable.
Adam Lesinski5bd44232017-09-07 09:39:07 -070040 uint32 path_idx = 1;
41 SourcePosition position = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -070042}
43
44// Top level message representing a resource table.
45message ResourceTable {
Adam Lesinski0c808952017-07-10 05:40:39 -070046 // The string pool containing source paths referenced throughout the resource table. This does
47 // not end up in the final binary ARSC file.
Adam Lesinski5bd44232017-09-07 09:39:07 -070048 StringPool source_pool = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -070049
50 // Resource definitions corresponding to an Android package.
Adam Lesinski4ffea042017-08-10 15:37:28 -070051 repeated Package package = 2;
Ryan Mitchell54237ff2018-12-13 15:44:29 -080052
53 // The <overlayable> declarations within the resource table.
54 repeated Overlayable overlayable = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -070055}
56
Adam Lesinski5bd44232017-09-07 09:39:07 -070057// A package ID in the range [0x00, 0xff].
58message PackageId {
59 uint32 id = 1;
60}
61
Adam Lesinski0c808952017-07-10 05:40:39 -070062// Defines resources for an Android package.
63message Package {
64 // The package ID of this package, in the range [0x00, 0xff].
Adam Lesinski5bd44232017-09-07 09:39:07 -070065 // - ID 0x00 is reserved for shared libraries, or when the ID is assigned at run-time.
66 // - ID 0x01 is reserved for the 'android' package (framework).
67 // - ID range [0x02, 0x7f) is reserved for auto-assignment to shared libraries at run-time.
68 // - ID 0x7f is reserved for the application package.
69 // - IDs > 0x7f are reserved for the application as well and are treated as feature splits.
70 // This may not be set if no ID was assigned.
71 PackageId package_id = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -070072
73 // The Java compatible Android package name of the app.
Adam Lesinski5bd44232017-09-07 09:39:07 -070074 string package_name = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -070075
76 // The series of types defined by the package.
Adam Lesinski4ffea042017-08-10 15:37:28 -070077 repeated Type type = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -070078}
79
Adam Lesinski5bd44232017-09-07 09:39:07 -070080// A type ID in the range [0x01, 0xff].
81message TypeId {
82 uint32 id = 1;
83}
84
Adam Lesinski0c808952017-07-10 05:40:39 -070085// A set of resources grouped under a common type. Such types include string, layout, xml, dimen,
86// attr, etc. This maps to the second part of a resource identifier in Java (R.type.entry).
87message Type {
Adam Lesinski5bd44232017-09-07 09:39:07 -070088 // The ID of the type. This may not be set if no ID was assigned.
89 TypeId type_id = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -070090
91 // The name of the type. This corresponds to the 'type' part of a full resource name of the form
92 // package:type/entry. The set of legal type names is listed in Resource.cpp.
Adam Lesinski5bd44232017-09-07 09:39:07 -070093 string name = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -070094
95 // The entries defined for this type.
Adam Lesinski4ffea042017-08-10 15:37:28 -070096 repeated Entry entry = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -070097}
98
Adam Lesinski71be7052017-12-12 16:48:07 -080099// The Visibility of a symbol/entry (public, private, undefined).
100message Visibility {
Adam Lesinski0c808952017-07-10 05:40:39 -0700101 // The visibility of the resource outside of its package.
Adam Lesinski71be7052017-12-12 16:48:07 -0800102 enum Level {
Adam Lesinski0c808952017-07-10 05:40:39 -0700103 // No visibility was explicitly specified. This is typically treated as private.
104 // The distinction is important when two separate R.java files are generated: a public and
105 // private one. An unknown visibility, in this case, would cause the resource to be omitted
106 // from either R.java.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700107 UNKNOWN = 0;
Adam Lesinski0c808952017-07-10 05:40:39 -0700108
109 // A resource was explicitly marked as private. This means the resource can not be accessed
110 // outside of its package unless the @*package:type/entry notation is used (the asterisk being
111 // the private accessor). If two R.java files are generated (private + public), the resource
112 // will only be emitted to the private R.java file.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700113 PRIVATE = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700114
115 // A resource was explicitly marked as public. This means the resource can be accessed
116 // from any package, and is emitted into all R.java files, public and private.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700117 PUBLIC = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700118 }
119
Adam Lesinski71be7052017-12-12 16:48:07 -0800120 Level level = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700121
122 // The path at which this entry's visibility was defined (eg. public.xml).
Adam Lesinski5bd44232017-09-07 09:39:07 -0700123 Source source = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700124
125 // The comment associated with the <public> tag.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700126 string comment = 3;
Adam Lesinski71be7052017-12-12 16:48:07 -0800127}
Adam Lesinski0c808952017-07-10 05:40:39 -0700128
Adam Lesinski71be7052017-12-12 16:48:07 -0800129// Whether a resource comes from a compile-time overlay and is explicitly allowed to not overlay an
130// existing resource.
131message AllowNew {
132 // Where this was defined in source.
133 Source source = 1;
134
135 // Any comment associated with the declaration.
136 string comment = 2;
137}
138
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800139// Represents a set of overlayable resources.
Adam Lesinski71be7052017-12-12 16:48:07 -0800140message Overlayable {
Winsonb2d7f532019-02-04 16:32:43 -0800141 // The name of the <overlayable>.
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800142 string name = 1;
143
Winsonb2d7f532019-02-04 16:32:43 -0800144 // The location of the <overlayable> declaration in the source.
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800145 Source source = 2;
146
147 // The component responsible for enabling and disabling overlays targeting this <overlayable>.
148 string actor = 3;
149}
150
151// Represents an overlayable <item> declaration within an <overlayable> tag.
152message OverlayableItem {
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700153 enum Policy {
Winson6bee4252019-02-13 07:57:24 -0800154 NONE = 0;
155 PUBLIC = 1;
156 SYSTEM = 2;
157 VENDOR = 3;
158 PRODUCT = 4;
159 SIGNATURE = 5;
Ryan Mitchell939df092019-04-09 17:13:50 -0700160 ODM = 6;
161 OEM = 7;
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700162 }
163
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800164 // The location of the <item> declaration in source.
Adam Lesinski71be7052017-12-12 16:48:07 -0800165 Source source = 1;
166
167 // Any comment associated with the declaration.
168 string comment = 2;
Ryan Mitchelle4e989c2018-10-29 02:21:50 -0700169
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800170 // The policy defined by the enclosing <policy> tag of this <item>.
Ryan Mitchell1bb1fe02018-11-16 11:21:41 -0800171 repeated Policy policy = 3;
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800172
173 // The index into overlayable list that points to the <overlayable> tag that contains
174 // this <item>.
175 uint32 overlayable_idx = 4;
Adam Lesinski5bd44232017-09-07 09:39:07 -0700176}
177
178// An entry ID in the range [0x0000, 0xffff].
179message EntryId {
180 uint32 id = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700181}
182
183// An entry declaration. An entry has a full resource ID that is the combination of package ID,
184// type ID, and its own entry ID. An entry on its own has no value, but values are defined for
185// various configurations/variants.
186message Entry {
187 // The ID of this entry. Together with the package ID and type ID, this forms a full resource ID
188 // of the form 0xPPTTEEEE, where PP is the package ID, TT is the type ID, and EEEE is the entry
189 // ID.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700190 // This may not be set if no ID was assigned.
191 EntryId entry_id = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700192
193 // The name of this entry. This corresponds to the 'entry' part of a full resource name of the
194 // form package:type/entry.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700195 string name = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700196
Adam Lesinski71be7052017-12-12 16:48:07 -0800197 // The visibility of this entry (public, private, undefined).
198 Visibility visibility = 3;
199
200 // Whether this resource, when originating from a compile-time overlay, is allowed to NOT overlay
201 // any existing resources.
202 AllowNew allow_new = 4;
203
204 // Whether this resource can be overlaid by a runtime resource overlay (RRO).
Ryan Mitchell54237ff2018-12-13 15:44:29 -0800205 OverlayableItem overlayable_item = 5;
Adam Lesinski0c808952017-07-10 05:40:39 -0700206
207 // The set of values defined for this entry, each corresponding to a different
208 // configuration/variant.
Adam Lesinski71be7052017-12-12 16:48:07 -0800209 repeated ConfigValue config_value = 6;
Adam Lesinski0c808952017-07-10 05:40:39 -0700210}
211
212// A Configuration/Value pair.
213message ConfigValue {
Adam Lesinskib58c3ef2017-09-12 17:39:52 -0700214 Configuration config = 1;
Adam Lesinski5bd44232017-09-07 09:39:07 -0700215 Value value = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700216}
217
218// The generic meta-data for every value in a resource table.
219message Value {
220 // Where the value was defined.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700221 Source source = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700222
223 // Any comment associated with the value.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700224 string comment = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700225
226 // Whether the value can be overridden.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700227 bool weak = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700228
Adam Lesinski5bd44232017-09-07 09:39:07 -0700229 // The value is either an Item or a CompoundValue.
230 oneof value {
231 Item item = 4;
232 CompoundValue compound_value = 5;
233 }
Adam Lesinski0c808952017-07-10 05:40:39 -0700234}
235
236// An Item is an abstract type. It represents a value that can appear inline in many places, such
237// as XML attribute values or on the right hand side of style attribute definitions. The concrete
238// type is one of the types below. Only one can be set.
239message Item {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700240 oneof value {
241 Reference ref = 1;
242 String str = 2;
243 RawString raw_str = 3;
244 StyledString styled_str = 4;
245 FileReference file = 5;
246 Id id = 6;
247 Primitive prim = 7;
248 }
Adam Lesinski0c808952017-07-10 05:40:39 -0700249}
250
251// A CompoundValue is an abstract type. It represents a value that is a made of other values.
252// These can only usually appear as top-level resources. The concrete type is one of the types
253// below. Only one can be set.
254message CompoundValue {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700255 oneof value {
256 Attribute attr = 1;
257 Style style = 2;
258 Styleable styleable = 3;
259 Array array = 4;
260 Plural plural = 5;
261 }
Adam Lesinski0c808952017-07-10 05:40:39 -0700262}
263
264// A value that is a reference to another resource. This reference can be by name or resource ID.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800265message Reference {
Adam Lesinski0c808952017-07-10 05:40:39 -0700266 enum Type {
267 // A plain reference (@package:type/entry).
Adam Lesinski4ffea042017-08-10 15:37:28 -0700268 REFERENCE = 0;
Adam Lesinski0c808952017-07-10 05:40:39 -0700269
270 // A reference to a theme attribute (?package:type/entry).
Adam Lesinski4ffea042017-08-10 15:37:28 -0700271 ATTRIBUTE = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700272 }
273
Adam Lesinski5bd44232017-09-07 09:39:07 -0700274 Type type = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700275
Adam Lesinski5bd44232017-09-07 09:39:07 -0700276 // The resource ID (0xPPTTEEEE) of the resource being referred. This is optional.
277 uint32 id = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700278
Adam Lesinski5bd44232017-09-07 09:39:07 -0700279 // The name of the resource being referred. This is optional if the resource ID is set.
280 string name = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700281
282 // Whether this reference is referencing a private resource (@*package:type/entry).
Adam Lesinski5bd44232017-09-07 09:39:07 -0700283 bool private = 4;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800284}
285
Adam Lesinski0c808952017-07-10 05:40:39 -0700286// A value that represents an ID. This is just a placeholder, as ID values are used to occupy a
287// resource ID (0xPPTTEEEE) as a unique identifier. Their value is unimportant.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800288message Id {
289}
290
Adam Lesinski0c808952017-07-10 05:40:39 -0700291// A value that is a string.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800292message String {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700293 string value = 1;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800294}
295
Adam Lesinski0c808952017-07-10 05:40:39 -0700296// A value that is a raw string, which is unescaped/uninterpreted. This is typically used to
297// represent the value of a style attribute before the attribute is compiled and the set of
298// allowed values is known.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800299message RawString {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700300 string value = 1;
Adam Lesinski08535002017-08-04 16:15:17 -0700301}
302
303// A string with styling information, like html tags that specify boldness, italics, etc.
304message StyledString {
305 // The raw text of the string.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700306 string value = 1;
Adam Lesinski08535002017-08-04 16:15:17 -0700307
308 // A Span marks a region of the string text that is styled.
309 message Span {
310 // The name of the tag, and its attributes, encoded as follows:
311 // tag_name;attr1=value1;attr2=value2;[...]
Adam Lesinski5bd44232017-09-07 09:39:07 -0700312 string tag = 1;
Adam Lesinski08535002017-08-04 16:15:17 -0700313
314 // The first character position this span applies to, in UTF-16 offset.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700315 uint32 first_char = 2;
Adam Lesinski08535002017-08-04 16:15:17 -0700316
317 // The last character position this span applies to, in UTF-16 offset.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700318 uint32 last_char = 3;
Adam Lesinski08535002017-08-04 16:15:17 -0700319 }
320
321 repeated Span span = 2;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800322}
323
Adam Lesinski0c808952017-07-10 05:40:39 -0700324// A value that is a reference to an external entity, like an XML file or a PNG.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800325message FileReference {
Adam Lesinskie59f0d82017-10-13 09:36:53 -0700326 enum Type {
327 UNKNOWN = 0;
328 PNG = 1;
329 BINARY_XML = 2;
330 PROTO_XML = 3;
331 }
332
Adam Lesinski08535002017-08-04 16:15:17 -0700333 // Path to a file within the APK (typically res/type-config/entry.ext).
Adam Lesinski5bd44232017-09-07 09:39:07 -0700334 string path = 1;
Adam Lesinskie59f0d82017-10-13 09:36:53 -0700335
336 // The type of file this path points to. For UAM bundle, this cannot be
337 // BINARY_XML.
338 Type type = 2;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800339}
340
Adam Lesinski0c808952017-07-10 05:40:39 -0700341// A value that represents a primitive data type (float, int, boolean, etc.).
Michael Wachenschwanz8b749272018-04-18 18:52:47 -0700342// Refer to Res_value in ResourceTypes.h for info on types and formatting
Adam Lesinski59e04c62016-02-04 15:59:23 -0800343message Primitive {
Michael Wachenschwanzd06f1f32018-01-11 18:36:22 -0800344 message NullType {
345 }
346 message EmptyType {
347 }
348 oneof oneof_value {
349 NullType null_value = 1;
350 EmptyType empty_value = 2;
351 float float_value = 3;
Michael Wachenschwanz8b749272018-04-18 18:52:47 -0700352 uint32 dimension_value = 13;
353 uint32 fraction_value = 14;
Michael Wachenschwanzd06f1f32018-01-11 18:36:22 -0800354 int32 int_decimal_value = 6;
Dave Ingram22ed4122018-01-30 16:11:52 -0800355 uint32 int_hexadecimal_value = 7;
Michael Wachenschwanzd06f1f32018-01-11 18:36:22 -0800356 bool boolean_value = 8;
357 uint32 color_argb8_value = 9;
358 uint32 color_rgb8_value = 10;
359 uint32 color_argb4_value = 11;
360 uint32 color_rgb4_value = 12;
Michael Wachenschwanz8b749272018-04-18 18:52:47 -0700361 float dimension_value_deprecated = 4 [deprecated=true];
362 float fraction_value_deprecated = 5 [deprecated=true];
Michael Wachenschwanzd06f1f32018-01-11 18:36:22 -0800363 }
Adam Lesinski59e04c62016-02-04 15:59:23 -0800364}
365
Adam Lesinski0c808952017-07-10 05:40:39 -0700366// A value that represents an XML attribute and what values it accepts.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800367message Attribute {
Adam Lesinski0c808952017-07-10 05:40:39 -0700368 // A Symbol used to represent an enum or a flag.
369 message Symbol {
370 // Where the enum/flag item was defined.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700371 Source source = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700372
373 // Any comments associated with the enum or flag.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700374 string comment = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700375
376 // The name of the enum/flag as a reference. Enums/flag items are generated as ID resource
377 // values.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700378 Reference name = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700379
380 // The value of the enum/flag.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700381 uint32 value = 4;
Adam Lesinski0c808952017-07-10 05:40:39 -0700382 }
383
Adam Lesinski4ffea042017-08-10 15:37:28 -0700384 // Bitmask of formats allowed for an attribute.
385 enum FormatFlags {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700386 NONE = 0x0; // Proto3 requires a default of 0.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700387 ANY = 0x0000ffff; // Allows any type except ENUM and FLAGS.
388 REFERENCE = 0x01; // Allows Reference values.
389 STRING = 0x02; // Allows String/StyledString values.
390 INTEGER = 0x04; // Allows any integer BinaryPrimitive values.
391 BOOLEAN = 0x08; // Allows any boolean BinaryPrimitive values.
392 COLOR = 0x010; // Allows any color BinaryPrimitive values.
393 FLOAT = 0x020; // Allows any float BinaryPrimitive values.
394 DIMENSION = 0x040; // Allows any dimension BinaryPrimitive values.
395 FRACTION = 0x080; // Allows any fraction BinaryPrimitive values.
396 ENUM = 0x00010000; // Allows enums that are defined in the Attribute's symbols.
397 // ENUM and FLAGS cannot BOTH be set.
398 FLAGS = 0x00020000; // Allows flags that are defined in the Attribute's symbols.
399 // ENUM and FLAGS cannot BOTH be set.
400 }
401
402 // A bitmask of types that this XML attribute accepts. Corresponds to the flags in the
403 // enum FormatFlags.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700404 uint32 format_flags = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700405
406 // The smallest integer allowed for this XML attribute. Only makes sense if the format includes
Adam Lesinski4ffea042017-08-10 15:37:28 -0700407 // FormatFlags::INTEGER.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700408 int32 min_int = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700409
410 // The largest integer allowed for this XML attribute. Only makes sense if the format includes
Adam Lesinski4ffea042017-08-10 15:37:28 -0700411 // FormatFlags::INTEGER.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700412 int32 max_int = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700413
414 // The set of enums/flags defined in this attribute. Only makes sense if the format includes
Adam Lesinski4ffea042017-08-10 15:37:28 -0700415 // either FormatFlags::ENUM or FormatFlags::FLAGS. Having both is an error.
416 repeated Symbol symbol = 4;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800417}
418
Adam Lesinski0c808952017-07-10 05:40:39 -0700419// A value that represents a style.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800420message Style {
Adam Lesinski0c808952017-07-10 05:40:39 -0700421 // An XML attribute/value pair defined in the style.
422 message Entry {
423 // Where the entry was defined.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700424 Source source = 1;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800425
Adam Lesinski0c808952017-07-10 05:40:39 -0700426 // Any comments associated with the entry.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700427 string comment = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700428
429 // A reference to the XML attribute.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700430 Reference key = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700431
432 // The Item defined for this XML attribute.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700433 Item item = 4;
Adam Lesinski0c808952017-07-10 05:40:39 -0700434 }
435
436 // The optinal style from which this style inherits attributes.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700437 Reference parent = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700438
439 // The source file information of the parent inheritance declaration.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700440 Source parent_source = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700441
442 // The set of XML attribute/value pairs for this style.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700443 repeated Entry entry = 3;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800444}
445
Adam Lesinski0c808952017-07-10 05:40:39 -0700446// A value that represents a <declare-styleable> XML resource. These are not real resources and
447// only end up as Java fields in the generated R.java. They do not end up in the binary ARSC file.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800448message Styleable {
Adam Lesinski0c808952017-07-10 05:40:39 -0700449 // An attribute defined for this styleable.
450 message Entry {
451 // Where the attribute was defined within the <declare-styleable> block.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700452 Source source = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700453
454 // Any comments associated with the declaration.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700455 string comment = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700456
457 // The reference to the attribute.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700458 Reference attr = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700459 }
460
461 // The set of attribute declarations.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700462 repeated Entry entry = 1;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800463}
464
Adam Lesinski0c808952017-07-10 05:40:39 -0700465// A value that represents an array of resource values.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800466message Array {
Adam Lesinski0c808952017-07-10 05:40:39 -0700467 // A single element of the array.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700468 message Element {
Adam Lesinski0c808952017-07-10 05:40:39 -0700469 // Where the element was defined.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700470 Source source = 1;
Adam Lesinski0c808952017-07-10 05:40:39 -0700471
472 // Any comments associated with the element.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700473 string comment = 2;
Adam Lesinski0c808952017-07-10 05:40:39 -0700474
475 // The value assigned to this element.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700476 Item item = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700477 }
478
479 // The list of array elements.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700480 repeated Element element = 1;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800481}
482
Adam Lesinski0c808952017-07-10 05:40:39 -0700483// A value that represents a string and its many variations based on plurality.
Adam Lesinski59e04c62016-02-04 15:59:23 -0800484message Plural {
Adam Lesinski0c808952017-07-10 05:40:39 -0700485 // The arity of the plural.
486 enum Arity {
Adam Lesinski4ffea042017-08-10 15:37:28 -0700487 ZERO = 0;
488 ONE = 1;
489 TWO = 2;
490 FEW = 3;
491 MANY = 4;
492 OTHER = 5;
Adam Lesinski0c808952017-07-10 05:40:39 -0700493 }
Adam Lesinski59e04c62016-02-04 15:59:23 -0800494
Adam Lesinski0c808952017-07-10 05:40:39 -0700495 // The plural value for a given arity.
496 message Entry {
497 // Where the plural was defined.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700498 Source source = 1;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800499
Adam Lesinski0c808952017-07-10 05:40:39 -0700500 // Any comments associated with the plural.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700501 string comment = 2;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800502
Adam Lesinski0c808952017-07-10 05:40:39 -0700503 // The arity of the plural.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700504 Arity arity = 3;
Adam Lesinski0c808952017-07-10 05:40:39 -0700505
506 // The value assigned to this plural.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700507 Item item = 4;
Adam Lesinski0c808952017-07-10 05:40:39 -0700508 }
509
510 // The set of arity/plural mappings.
Adam Lesinski4ffea042017-08-10 15:37:28 -0700511 repeated Entry entry = 1;
512}
513
514// Defines an abstract XmlNode that must be either an XmlElement, or
515// a text node represented by a string.
516message XmlNode {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700517 oneof node {
518 XmlElement element = 1;
519 string text = 2;
520 }
Adam Lesinski4ffea042017-08-10 15:37:28 -0700521
522 // Source line and column info.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700523 SourcePosition source = 3;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700524}
525
526// An <element> in an XML document.
527message XmlElement {
528 // Namespaces defined on this element.
529 repeated XmlNamespace namespace_declaration = 1;
530
531 // The namespace URI of this element.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700532 string namespace_uri = 2;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700533
534 // The name of this element.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700535 string name = 3;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700536
537 // The attributes of this element.
538 repeated XmlAttribute attribute = 4;
539
540 // The children of this element.
541 repeated XmlNode child = 5;
542}
543
544// A namespace declaration on an XmlElement (xmlns:android="http://...").
545message XmlNamespace {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700546 string prefix = 1;
547 string uri = 2;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700548
549 // Source line and column info.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700550 SourcePosition source = 3;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700551}
552
553// An attribute defined on an XmlElement (android:text="...").
554message XmlAttribute {
Adam Lesinski5bd44232017-09-07 09:39:07 -0700555 string namespace_uri = 1;
556 string name = 2;
557 string value = 3;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700558
559 // Source line and column info.
Adam Lesinski5bd44232017-09-07 09:39:07 -0700560 SourcePosition source = 4;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700561
Adam Lesinski5bd44232017-09-07 09:39:07 -0700562 // The optional resource ID (0xPPTTEEEE) of the attribute.
563 uint32 resource_id = 5;
Adam Lesinski4ffea042017-08-10 15:37:28 -0700564
Adam Lesinski5bd44232017-09-07 09:39:07 -0700565 // The optional interpreted/compiled version of the `value` string.
566 Item compiled_item = 6;
Adam Lesinski59e04c62016-02-04 15:59:23 -0800567}