1// Messages describing APK Set's table of contents (toc.pb entry).
2// Please be advised that the ultimate source is at
3// https://github.com/google/bundletool/tree/master/src/main/proto
4// so you have been warned.
5syntax = "proto3";
6
7package android.bundle;
8
9option go_package = "android_bundle_proto";
10option java_package = "com.android.bundle";
11
12// Targeting on the level of variants.
13message VariantTargeting {
14  SdkVersionTargeting sdk_version_targeting = 1;
15  AbiTargeting abi_targeting = 2;
16  ScreenDensityTargeting screen_density_targeting = 3;
17  MultiAbiTargeting multi_abi_targeting = 4;
18  TextureCompressionFormatTargeting texture_compression_format_targeting = 5;
19}
20
21// Targeting on the level of individual APKs.
22message ApkTargeting {
23  AbiTargeting abi_targeting = 1;
24  GraphicsApiTargeting graphics_api_targeting = 2;
25  LanguageTargeting language_targeting = 3;
26  ScreenDensityTargeting screen_density_targeting = 4;
27  SdkVersionTargeting sdk_version_targeting = 5;
28  TextureCompressionFormatTargeting texture_compression_format_targeting = 6;
29  MultiAbiTargeting multi_abi_targeting = 7;
30  SanitizerTargeting sanitizer_targeting = 8;
31}
32
33// Targeting on the module level.
34// The semantic of the targeting is the "AND" rule on all immediate values.
35message ModuleTargeting {
36  SdkVersionTargeting sdk_version_targeting = 1;
37  repeated DeviceFeatureTargeting device_feature_targeting = 2;
38  UserCountriesTargeting user_countries_targeting = 3;
39}
40
41// User Countries targeting describing an inclusive/exclusive list of country
42// codes that module targets.
43message UserCountriesTargeting {
44  // List of country codes in the two-letter CLDR territory format.
45  repeated string country_codes = 1;
46
47  // Indicates if the list above is exclusive.
48  bool exclude = 2;
49}
50
51message ScreenDensity {
52  enum DensityAlias {
53    DENSITY_UNSPECIFIED = 0;
54    NODPI = 1;
55    LDPI = 2;
56    MDPI = 3;
57    TVDPI = 4;
58    HDPI = 5;
59    XHDPI = 6;
60    XXHDPI = 7;
61    XXXHDPI = 8;
62  }
63
64  oneof density_oneof {
65    DensityAlias density_alias = 1;
66    int32 density_dpi = 2;
67  }
68}
69
70// Wrapper message for `int32`.
71//
72// The JSON representation for `Int32Value` is JSON number.
73message Int32Value {
74  // The int32 value.
75  int32 value = 1;
76}
77
78message SdkVersion {
79  // Inclusive.
80  Int32Value min = 1;
81}
82
83message GraphicsApi {
84  oneof api_oneof {
85    // Inclusive.
86    OpenGlVersion min_open_gl_version = 1;
87    // Inclusive.
88    VulkanVersion min_vulkan_version = 2;
89  }
90}
91
92message VulkanVersion {
93  int32 major = 1;  // VK_VERSION_MAJOR
94  int32 minor = 2;  // VK_VERSION_MINOR
95}
96
97message OpenGlVersion {
98  // e.g. OpenGL ES 3.2 is represented as { major: 3, minor: 2 }
99  int32 major = 1;  // GL_MAJOR_VERSION
100  int32 minor = 2;  // GL_MINOR_VERSION
101}
102
103message TextureCompressionFormat {
104  enum TextureCompressionFormatAlias {
105    UNSPECIFIED_TEXTURE_COMPRESSION_FORMAT = 0;
106    ETC1_RGB8 = 1;
107    PALETTED = 2;
108    THREE_DC = 3;
109    ATC = 4;
110    LATC = 5;
111    DXT1 = 6;
112    S3TC = 7;
113    PVRTC = 8;
114    ASTC = 9;
115    ETC2 = 10;
116  }
117  TextureCompressionFormatAlias alias = 1;
118}
119
120message Abi {
121  enum AbiAlias {
122    UNSPECIFIED_CPU_ARCHITECTURE = 0;
123    ARMEABI = 1;
124    ARMEABI_V7A = 2;
125    ARM64_V8A = 3;
126    X86 = 4;
127    X86_64 = 5;
128    MIPS = 6;
129    MIPS64 = 7;
130  }
131  AbiAlias alias = 1;
132}
133
134message MultiAbi {
135  repeated Abi abi = 1;
136}
137
138message Sanitizer {
139  enum SanitizerAlias {
140    NONE = 0;
141    HWADDRESS = 1;
142  }
143  SanitizerAlias alias = 1;
144}
145
146message DeviceFeature {
147  string feature_name = 1;
148  // Equivalent of android:glEsVersion or android:version in <uses-feature>.
149  int32 feature_version = 2;
150}
151
152// Targeting specific for directories under assets/.
153message AssetsDirectoryTargeting {
154  AbiTargeting abi = 1;
155  GraphicsApiTargeting graphics_api = 2;
156  TextureCompressionFormatTargeting texture_compression_format = 3;
157  LanguageTargeting language = 4;
158}
159
160// Targeting specific for directories under lib/.
161message NativeDirectoryTargeting {
162  Abi abi = 1;
163  GraphicsApi graphics_api = 2;
164  TextureCompressionFormat texture_compression_format = 3;
165  Sanitizer sanitizer = 4;
166}
167
168// Targeting specific for image files under apex/.
169message ApexImageTargeting {
170  MultiAbiTargeting multi_abi = 1;
171}
172
173message AbiTargeting {
174  repeated Abi value = 1;
175  // Targeting of other sibling directories that were in the Bundle.
176  // For master splits this is targeting of other master splits.
177  repeated Abi alternatives = 2;
178}
179
180message MultiAbiTargeting {
181  repeated MultiAbi value = 1;
182  // Targeting of other sibling directories that were in the Bundle.
183  // For master splits this is targeting of other master splits.
184  repeated MultiAbi alternatives = 2;
185}
186
187message ScreenDensityTargeting {
188  repeated ScreenDensity value = 1;
189  // Targeting of other sibling directories that were in the Bundle.
190  // For master splits this is targeting of other master splits.
191  repeated ScreenDensity alternatives = 2;
192}
193
194message LanguageTargeting {
195  // ISO-639: 2 or 3 letter language code.
196  repeated string value = 1;
197  // Targeting of other sibling directories that were in the Bundle.
198  // For master splits this is targeting of other master splits.
199  repeated string alternatives = 2;
200}
201
202message GraphicsApiTargeting {
203  repeated GraphicsApi value = 1;
204  // Targeting of other sibling directories that were in the Bundle.
205  // For master splits this is targeting of other master splits.
206  repeated GraphicsApi alternatives = 2;
207}
208
209message SdkVersionTargeting {
210  repeated SdkVersion value = 1;
211  // Targeting of other sibling directories that were in the Bundle.
212  // For master splits this is targeting of other master splits.
213  repeated SdkVersion alternatives = 2;
214}
215
216message TextureCompressionFormatTargeting {
217  repeated TextureCompressionFormat value = 1;
218  // Targeting of other sibling directories that were in the Bundle.
219  // For master splits this is targeting of other master splits.
220  repeated TextureCompressionFormat alternatives = 2;
221}
222
223message SanitizerTargeting {
224  repeated Sanitizer value = 1;
225}
226
227// Since other atom targeting messages have the "OR" semantic on values
228// the DeviceFeatureTargeting represents only one device feature to retain
229// that convention.
230message DeviceFeatureTargeting {
231  DeviceFeature required_feature = 1;
232}
233