1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// [START declaration]
16syntax = "proto3";
17package com_android_cts_releaseparser;
18// [END declaration]
19
20// [START java_declaration]
21option java_package = "com.android.cts.releaseparser";
22option java_outer_classname = "ReleaseProto";
23// [END java_declaration]
24
25// [START messages]
26message Option {
27    string name = 1;
28    string key = 2;
29    string value =3;
30}
31
32message TestModuleConfig {
33    string module_name = 1;
34    string component = 2;
35    string description = 3;
36    repeated Option options = 4;
37
38    message TargetPreparer {
39        string test_class = 1;
40        repeated Option options = 2;
41    }
42    repeated TargetPreparer target_preparers = 5;
43    repeated string test_file_names = 6;
44
45    message TestClass {
46        string test_class = 1;
47        string package = 2;
48        repeated Option options = 3;
49    }
50    repeated TestClass test_classes = 7;
51    repeated string test_jars = 8;
52}
53
54message Element {
55    string name = 1;
56    string value = 2;
57}
58
59message ApiAnnotation {
60    int32 visibility = 1;
61    string type = 2;
62
63    repeated Element elements = 3;
64}
65
66message ApiField {
67    string defining_class = 1;
68    string name = 2;
69    string type = 3;
70    int32 access_flags = 4;
71    string initial_value = 5;
72    repeated ApiAnnotation annotations = 6;
73    string value = 7;
74}
75
76message ApiMethod {
77    string defining_class = 1;
78    string name = 2;
79    repeated string parameters = 3;
80    string return_type = 4;
81    int32 access_flags = 5;
82    string known_failure_filter = 6;
83    repeated ApiAnnotation annotations = 7;
84}
85
86message ApiClass {
87    string name = 1;
88    string type = 2;
89    string super_class = 3;
90    repeated string interfaces = 4;
91    TestClassType test_class_type = 5;
92    int32 access_flags = 6;
93    repeated ApiAnnotation annotations = 7;
94    repeated ApiMethod methods = 8;
95    repeated ApiField fields = 9;
96}
97
98message ApiPackage {
99    string name = 1;
100    string package_file = 2;
101    string content_id = 3;
102    string op_codes = 4;
103
104    repeated ApiClass classes = 5;
105    string error = 6;
106}
107
108enum TestClassType {
109    UNKNOWN = 0;
110    JUNIT3 = 1;
111    JUNIT4 = 2;
112    PARAMETERIZED = 3;
113    JAVAHOST = 4;
114}
115
116message TestSuite {
117    string name = 1;
118    // Version
119    string version = 2;
120    // Build Number
121    string build_number = 3;
122    // Content ID
123    string content_id = 4;
124
125    enum TestType {
126        UNKNOWN = 0;
127        ANDROIDJUNIT = 1;
128        JAVAHOST = 2;
129        GTEST = 3;
130        LIBCORE = 4;
131        DALVIK = 5;
132        DEQP = 6;
133    }
134
135    message Module {
136        string name = 1;
137        string config_file = 2;
138        TestType test_type = 3;
139        string test_class = 4;
140        repeated ApiPackage packages = 5;
141    }
142    repeated Module modules = 5;
143}
144
145message Service {
146    string name = 1;
147    string file = 2;
148    repeated string arguments = 3;
149    string clazz = 4;
150    string user = 5;
151    string group = 6;
152    string writepid = 7;
153    repeated string options = 8;
154}
155
156message Api {
157    string name = 1;
158    string version = 2;
159    // map of Package Name & Package Message
160    map<string, ApiPackage> packages = 3;
161}
162
163message UsesFeature {
164    string name = 1;
165    string required = 2;
166}
167
168message UsesLibrary {
169    string name = 1;
170    string required = 2;
171}
172
173message AppInfo {
174    string package_name = 1;
175    string version_code = 2;
176    string version_name = 3;
177    string sdk_version = 4;
178    string target_sdk_version = 5;
179    repeated UsesFeature uses_features = 6;
180    repeated UsesLibrary uses_libraries = 7;
181    repeated string native_code = 8;
182    repeated string uses_permissions = 9;
183    repeated string activities = 10;
184    repeated string services = 11;
185    repeated string providers = 12;
186    map<string, string> properties = 13;
187    repeated ApiPackage external_api_packages = 14;
188    repeated ApiPackage internal_api_packages = 15;
189    PackageFileContent package_file_content = 16;
190    string package_signature = 17;
191}
192
193message ImageSection {
194    uint32 offset = 1;
195    uint32 size = 2;
196}
197
198// art/runtime/image.h
199message ArtInfo {
200    bool valid = 1;
201    // skip magic_[4]
202    string version = 2;
203    uint32 image_begin = 3;
204    uint32 image_size = 4;
205    uint32 oat_checksum = 5;
206    uint32 oat_file_begin = 6;
207    uint32 oat_data_begin = 7;
208    uint32 oat_data_end = 8;
209    uint32 oat_file_end = 9;
210
211    // app image headers only
212    uint32 boot_image_begin = 10;
213    uint32 boot_image_size = 11;
214    uint32 boot_oat_begin = 12;
215    uint32 boot_oat_size = 13;
216
217    int32 patch_delta = 14;
218    uint32 image_roots = 15;
219    uint32 pointer_size = 16;
220    uint32 compile_pic = 17;
221    uint32 is_pic = 18;
222
223    repeated ImageSection image_sections = 19;
224    repeated uint64 image_methods = 20;
225
226    uint32 storage_mode = 21;
227    uint32 data_size = 22;
228}
229
230// art/dex2oat/linker/oat_writer.cc OatDexFile
231message OatDexInfo {
232    string dex_file_location_data = 1;
233    // The checksum of the dex file.
234    uint32 dex_file_location_checksum = 2;
235    // Offset of the dex file in the vdex file.
236    uint32 dex_file_offset = 3;
237    // The lookup table offset in the oat file. Set in WriteTypeLookupTables.
238    uint32 lookup_table_offset = 4;
239    // Class and BSS offsets set in PrepareLayout.
240    uint32 class_offsets_offset = 5;
241    uint32 method_bss_mapping_offset = 6;
242    uint32 type_bss_mapping_offset = 7;
243    uint32 string_bss_mapping_offset = 8;
244    // Offset of dex sections that will have different runtime madvise states.
245    uint32 dex_sections_layout_offset = 9;
246}
247
248// art/runtime/oat.h
249message OatInfo {
250    // skip magic_[4]
251    string version = 1;
252    uint32 adler32_checksum = 2;
253    // art/libartbase/arch/instruction_set.h
254
255    uint32 instruction_set = 3;
256    uint32 instruction_set_features_bitmap = 4;
257    uint32 dex_file_count = 5;
258    uint32 oat_dex_files_offset = 6;
259    uint32 executable_offset = 7;
260    uint32 interpreter_to_interpreter_bridge_offset = 8;
261    uint32 interpreter_to_compiled_code_bridge_offset = 9;
262    uint32 jni_dlsym_lookup_offset = 10;
263    uint32 quick_generic_jni_trampoline_offset = 11;
264    uint32 quick_imt_conflict_trampoline_offset = 12;
265    uint32 quick_resolution_trampoline_offset = 13;
266    uint32 quick_to_interpreter_bridge_offset = 14;
267
268    // for backward compatibility, removed from version 162, see aosp/e0669326c0282b5b645aba75160425eef9d57617
269    uint32 image_patch_delta = 15;
270
271    uint32 image_file_location_oat_checksum = 16;
272    // for backward compatibility, removed from version 162, see aosp/e0669326c0282b5b645aba75160425eef9d57617
273    uint32 image_file_location_oat_data_begin = 17;
274
275    uint32 key_value_store_size = 18;
276
277    // int8_t key_value_store_[0];
278    map<string, string> key_value_store = 19;
279    repeated OatDexInfo oat_dex_info = 20;
280    bool valid = 21;
281    int32 bits = 22;
282    string architecture = 23;
283}
284
285message DexSectionHeader {
286    uint32 dex_size = 1;
287    uint32 dex_shared_data_size = 2;
288    uint32 quickening_info_size = 3;
289}
290
291// art/runtime/vdex_file.h
292message VdexInfo {
293    bool valid = 1;
294
295    // skip magic_[4]
296    string verifier_deps_version = 2;
297    string dex_section_version = 3;
298    uint32 number_of_dex_files = 4;
299    uint32 verifier_deps_size = 5;
300    repeated uint32 checksums = 6;
301    repeated DexSectionHeader dex_section_headers = 7;
302}
303
304message Permission {
305    string name = 1;
306    repeated Element elements = 2;
307}
308
309message PermissionList {
310    string name = 1;
311    repeated Permission permissions = 2;
312}
313
314message PackageFileContent {
315    map<string, Entry> entries = 1;
316}
317
318// An entry in a release
319message Entry {
320    // Name
321    string name = 1;
322
323    enum EntryType {
324        FOLDER = 0;
325        FILE = 1;
326        TEST_MODULE_CONFIG = 2;
327        JAR = 3;
328        APK = 4;
329        EXE = 5;
330        SO = 6;
331        OAT = 7;
332        ODEX = 8;
333        VDEX = 9;
334        TEST_SUITE_TRADEFED = 10;
335        BUILD_PROP = 11;
336        SYMBOLIC_LINK = 12;
337        RC = 13;
338        ART = 14;
339        XML = 15;
340        IMG = 16;
341    }
342    // Type
343    EntryType type = 2;
344
345    // Size
346    int64 size = 3;
347    // Content ID
348    string content_id = 4;
349    // code_id
350    string code_id = 5;
351    // Parent folder
352    string abi_architecture = 6;
353    int32 abi_bits = 7;
354    string parent_folder = 8;
355    // Relative path
356    string relative_path = 9;
357
358    repeated string dependencies = 10;
359    repeated string dynamic_loading_dependencies = 11;
360
361    // file type specified info
362    AppInfo app_info = 12;
363    ArtInfo art_info = 13;
364    OatInfo oat_info = 14;
365    VdexInfo vdex_info = 15;
366    // TestModule.config message
367    TestModuleConfig test_module_config = 16;
368    // Native services
369    repeated Service services = 17;
370    // Device permissions
371    map<string, PermissionList> device_permissions = 18;
372    // property map(key,value)
373    map<string, string> properties = 19;
374}
375
376enum ReleaseType {
377    DEVICE_BUILD = 0;
378    TEST_SUITE = 1;
379    APP_DISTRIBUTION_PACKAGE = 2;
380}
381
382message ReleaseContent {
383    // Name
384    string name = 1;
385    // Version
386    string version = 2;
387    // Build Number
388    string build_number = 3;
389    // Full name
390    string fullname = 4;
391    // release uid e.g. Build Fingerprint
392    string release_id = 5;
393    // Content id
394    string content_id = 6;
395    // Size in byte
396    int64 size = 7;
397    ReleaseType release_type = 8;
398    // property map(key,value)
399    map<string, string> properties = 9;
400    // File Entry map(relative_path, entry)
401    map<string, Entry> entries = 10;
402
403    // Test Suite specific
404    string test_suite_tradefed = 11;
405    string target_arch = 12;
406    repeated string known_failures = 13;
407}
408// [END messages]