aboutsummaryrefslogtreecommitdiff
path: root/cmd/extract_apks/bundle_proto/config.proto
blob: 946bd9af0ea5281f10407e8962af672ae8d5a6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
// Messages describing APK Set's table of contents (toc.pb entry).
// Please be advised that the ultimate source is at
// https://github.com/google/bundletool/tree/master/src/main/proto
// so you have been warned.
syntax = "proto3";

package android.bundle;

option go_package = "android/soong/cmd/extract_apks/bundle_proto";
option java_package = "com.android.bundle";

message BundleConfig {
  Bundletool bundletool = 1;
  Optimizations optimizations = 2;
  Compression compression = 3;
  // Resources to be always kept in the master split.
  MasterResources master_resources = 4;
  ApexConfig apex_config = 5;
  // APKs to be signed with the same key as generated APKs.
  repeated UnsignedEmbeddedApkConfig unsigned_embedded_apk_config = 6;
  AssetModulesConfig asset_modules_config = 7;

  enum BundleType {
    REGULAR = 0;
    APEX = 1;
    ASSET_ONLY = 2;
  }
  BundleType type = 8;

  // Configuration for locales.
  Locales locales = 9;
}

message Bundletool {
  reserved 1;
  // Version of BundleTool used to build the Bundle.
  string version = 2;
}

message Compression {
  // Glob matching the list of files to leave uncompressed in the APKs.
  // The matching is done against the path of files in the APK, thus excluding
  // the name of the modules, and using forward slash ("/") as a name separator.
  // Examples: "res/raw/**", "assets/**/*.uncompressed", etc.
  repeated string uncompressed_glob = 1;

  enum AssetModuleCompression {
    UNSPECIFIED = 0;
    // Assets are left uncompressed in the generated asset module.
    UNCOMPRESSED = 1;
    // Assets are compressed in the generated asset module.
    // This option can be overridden at a finer granularity by specifying
    // files or folders to keep uncompressed in `uncompressed_glob`.
    // This option should only be used if the app is able to handle compressed
    // asset module content at runtime (some runtime APIs may misbehave).
    COMPRESSED = 2;
  }

  // Default compression strategy for install-time asset modules.
  // If the compression strategy indicates to compress a file and the same file
  // matches one of the `uncompressed_glob` values, the `uncompressed_glob`
  // takes precedence (the file is left uncompressed in the generated APK).
  //
  // If unspecified, asset module content is left uncompressed in the
  // generated asset modules.
  //
  // Note: this flag only configures the compression strategy for install-time
  // asset modules; the content of on-demand and fast-follow asset modules is
  // always kept uncompressed.
  AssetModuleCompression install_time_asset_module_default_compression = 2;

  enum ApkCompressionAlgorithm {
    // Default in the current version of bundletool is zlib deflate algorithm
    // with compression level 9 for the application's resources and compression
    // level 6 for other entries.
    //
    // This is a good trade-off between size of final APK and size of patches
    // which are used to update the application from previous to next version.
    DEFAULT_APK_COMPRESSION_ALGORITHM = 0;

    // 7zip implementation of deflate algorithm which gives smaller APK size
    // but size of patches required to update the application are larger.
    P7ZIP = 1;
  }

  // Compression algorithm which is used to compress entries in final APKs.
  ApkCompressionAlgorithm apk_compression_algorithm = 3;
}

// Resources to keep in the master split.
message MasterResources {
  // Resource IDs to be kept in master split.
  repeated int32 resource_ids = 1;
  // Resource names to be kept in master split.
  repeated string resource_names = 2;
}

message Optimizations {
  SplitsConfig splits_config = 1;
  // This is for uncompressing native libraries on M+ devices (L+ devices on
  // instant apps).
  UncompressNativeLibraries uncompress_native_libraries = 2;
  // This is for uncompressing dex files.
  UncompressDexFiles uncompress_dex_files = 3;
  // Configuration for the generation of standalone APKs.
  // If no StandaloneConfig is set, the configuration is inherited from
  // splits_config.
  StandaloneConfig standalone_config = 4;

  // Optimizations that are applied to resources.
  ResourceOptimizations resource_optimizations = 5;

  // Configuration for archiving the app.
  StoreArchive store_archive = 6;
}

message ResourceOptimizations {
  // Whether to use sparse encoding for resource tables.
  // Resources in sparse resource table are accessed using a binary search tree.
  // This decreases APK size at the cost of resource retrieval performance.
  SparseEncoding sparse_encoding = 1;

  enum SparseEncoding {
    // Previously 'ENFORCED'. This option is deprecated because of issues found
    // in Android O up to Android Sv2 and causes segfaults in
    // Resources#getIdentifier.
    reserved 1;
    reserved "ENFORCED";

    // Disables sparse encoding.
    UNSPECIFIED = 0;
    // Generates special APKs for Android SDK +32 with sparse resource tables.
    // Devices with Android SDK below 32 will still receive APKs with regular
    // resource tables.
    VARIANT_FOR_SDK_32 = 2;
  }
}

message UncompressNativeLibraries {
  bool enabled = 1;
}

message UncompressDexFiles {
  //  A new variant with uncompressed dex will be generated. The sdk targeting
  //  of the variant is determined by 'uncompressed_dex_target_sdk'.
  bool enabled = 1;

  //  If 'enabled' field is set, this will determine the sdk targeting of the
  //  generated variant.
  UncompressedDexTargetSdk uncompressed_dex_target_sdk = 2;

  enum UncompressedDexTargetSdk {
    // Q+ variant will be generated.
    UNSPECIFIED = 0;
    // S+ variant will be generated.
    SDK_31 = 1;
  }
}

message StoreArchive {
  // Archive is an app state that allows an official app store to reclaim device
  // storage and disable app functionality temporarily until the user interacts
  // with the app again. Upon interaction the latest available version of the
  // app will be restored while leaving user data unaffected.
  // Enabled by default.
  bool enabled = 1;
}

message Locales {
  // Instructs bundletool to generate locale config and inject it into
  // AndroidManifest.xml. A locale is marked as supported by the application if
  // there is at least one resource value in this locale. Be very careful with
  // this setting because if some of your libraries expose resources in some
  // locales which are not actually supported by your application it will mark
  // this locale as supported. Disabled by default.
  bool inject_locale_config = 1;
}

// Optimization configuration used to generate Split APKs.
message SplitsConfig {
  repeated SplitDimension split_dimension = 1;
}

// Optimization configuration used to generate Standalone APKs.
message StandaloneConfig {
  // Device targeting dimensions to shard.
  repeated SplitDimension split_dimension = 1;
  // Whether 64 bit libraries should be stripped from Standalone APKs.
  bool strip_64_bit_libraries = 2;
  // Dex merging strategy that should be applied to produce Standalone APKs.
  DexMergingStrategy dex_merging_strategy = 3;

  enum DexMergingStrategy {
    // Strategy that does dex merging for applications that have minimum SDK
    // below 21 to ensure dex files from all modules are merged into one or
    // mainDexList is applied when merging into one dex is not possible. For
    // applications with minSdk >= 21 dex files from all modules are copied into
    // standalone APK as is because Android supports multiple dex files natively
    // starting from Android 5.0.
    MERGE_IF_NEEDED = 0;
    // Requires to copy dex files from all modules into standalone APK as is.
    // If an application supports SDKs below 21 this strategy puts
    // responsibility of providing dex files compatible with legacy multidex on
    // application developers.
    NEVER_MERGE = 1;
  }
}

// BEGIN-INTERNAL
// LINT.IfChange
// END-INTERNAL
message SplitDimension {
  enum Value {
    UNSPECIFIED_VALUE = 0;
    ABI = 1;
    SCREEN_DENSITY = 2;
    LANGUAGE = 3;
    TEXTURE_COMPRESSION_FORMAT = 4;
    // BEGIN-INTERNAL
    GRAPHICS_API = 5 [deprecated = true];
    // END-INTERNAL
    DEVICE_TIER = 6;
  }
  Value value = 1;

  // If set to 'true', indicates that APKs should *not* be split by this
  // dimension.
  bool negate = 2;

  // Optional transformation to be applied to asset directories where
  // the targeting is encoded in the directory name (e.g: assets/foo#tcf_etc1)
  SuffixStripping suffix_stripping = 3;
}
// BEGIN-INTERNAL
// LINT.ThenChange(//depot/google3/wireless/android/vending/developer/proto/storage/app/apk_bundle.proto)
// END-INTERNAL

message SuffixStripping {
  // If set to 'true', indicates that the targeting suffix should be removed
  // from assets paths for this dimension when splits (e.g: "asset packs") or
  // standalone/universal APKs are generated.
  // This only applies to assets.
  // For example a folder with path "assets/level1_textures#tcf_etc1"
  // would be outputted to "assets/level1_textures". File contents are
  // unchanged.
  bool enabled = 1;

  // The default suffix to be used for the cases where separate slices can't
  // be generated for this dimension - typically for standalone or universal
  // APKs.
  // This default suffix defines the directories to retain. The others are
  // discarded: standalone/universal APKs will contain only directories
  // targeted at this value for the dimension.
  //
  // If not set or empty, the fallback directory in each directory group will be
  // used (for example, if both "assets/level1_textures#tcf_etc1" and
  // "assets/level1_textures" are present and the default suffix is empty,
  // then only "assets/level1_textures" will be used).
  string default_suffix = 2;
}

// Configuration for processing APEX bundles.
// https://source.android.com/devices/tech/ota/apex
message ApexConfig {
  // Configuration for processing of APKs embedded in an APEX image.
  repeated ApexEmbeddedApkConfig apex_embedded_apk_config = 1;

  // Explicit list of supported ABIs.
  // Default: See ApexBundleValidator.REQUIRED_ONE_OF_ABI_SETS
  repeated SupportedAbiSet supported_abi_set = 2;
}

// Represents a set of ABIs which must be supported by a single APEX image.
message SupportedAbiSet {
  repeated string abi = 1;
}

message ApexEmbeddedApkConfig {
  // Android package name of the APK.
  string package_name = 1;

  // Path to the APK within the APEX system image.
  string path = 2;
}

message UnsignedEmbeddedApkConfig {
  // Path to the APK inside the module (e.g. if the path inside the bundle
  // is split/assets/example.apk, this will be assets/example.apk).
  string path = 1;
}

message AssetModulesConfig {
  // App versionCodes that will be updated with these asset modules.
  // Only relevant for asset-only bundles.
  repeated int64 app_version = 1;

  // Version tag for the asset upload.
  // Only relevant for asset-only bundles.
  string asset_version_tag = 2;
}