1/*
2 * Copyright (C) 2022 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
17syntax = "proto3";
18
19import "frameworks/base/tools/aapt2/Resources.proto";
20
21package aapt.pb;
22
23option java_package = "com.android.aapt";
24
25// Top level message representing data extracted from the APK for 'apkinfo'
26// command.
27message ApkInfo {
28  message XmlFile {
29    string path = 1;
30    XmlNode root = 2;
31  }
32
33  Badging badging = 1;
34  ResourceTable resource_table = 2;
35  repeated XmlFile xml_files = 3;
36}
37
38// Data extracted from the manifest of the APK.
39message Badging {
40  PackageInfo package = 1;
41  Application application = 2;
42  UsesSdk uses_sdk = 3;
43  // Previously: UsesConfiguration uses_configuration = 4;
44  reserved 4;
45  SupportsScreen supports_screen = 5;
46  SupportsInput supports_input = 6;
47  LaunchableActivity launchable_activity = 7;
48  LeanbackLaunchableActivity leanback_launchable_activity = 8;
49  StaticLibrary static_library = 9;
50  SdkLibrary sdk_library = 10;
51  Overlay overlay = 11;
52  PackageVerifier package_verifier = 12;
53  CompatibleScreens compatible_screens = 13;
54  Architectures architectures = 14;
55  SupportsGlTexture supports_gl_texture = 15;
56  Components components = 16;
57
58  repeated string locales = 17;
59  repeated int32 densities = 18;
60
61  repeated UsesPackage uses_packages = 51;
62  repeated UsesConfiguration uses_configurations = 52;
63  repeated FeatureGroup feature_groups = 53;
64  repeated UsesPermission uses_permissions = 54;
65  repeated Permission permissions = 55;
66  repeated UsesLibrary uses_libraries = 56;
67  repeated UsesStaticLibrary uses_static_libraries = 57;
68  repeated UsesSdkLibrary uses_sdk_libraries = 58;
69  repeated UsesNativeLibrary uses_native_libraries = 59;
70
71  repeated Metadata metadata = 62;
72  repeated Property properties = 63;
73}
74
75// Information extracted about package from <manifest> and
76// <original-package> tags.
77message PackageInfo {
78  enum InstallLocation {
79    DEFAULT_INSTALL_LOCATION = 0;
80    AUTO = 1;
81    INTERNAL_ONLY = 2;
82    PREFER_EXTERNAL = 3;
83  }
84
85  string package = 1;
86  int32 version_code = 2;
87  string version_name = 3;
88
89  string split = 4;
90
91  string platform_version_name = 5;
92  string platform_version_code = 6;
93
94  int32 compile_sdk_version = 7;
95  string compile_sdk_version_codename = 8;
96
97  InstallLocation install_location = 9;
98
99  string original_package = 10;
100}
101
102// Information extracted from <application> element.
103message Application {
104  string label = 1;
105  string icon = 2;
106  string banner = 3;
107
108  bool test_only = 4;
109  bool game = 5;
110  bool debuggable = 6;
111
112  map<string, string> locale_labels = 8;
113  map<int32, string> density_icons = 9;
114}
115
116// Components defined in the APK.
117message Components {
118  bool main = 1;
119  bool other_activities = 2;
120  bool other_receivers = 3;
121  bool other_services = 4;
122
123  repeated string provided_components = 5;
124}
125
126// Application's min and target SDKs.
127message UsesSdk {
128  oneof min_sdk {
129    int32 min_sdk_version = 2;
130    string min_sdk_version_name = 3;
131  }
132  int32 max_sdk_version = 4;
133  oneof target_sdk {
134    int32 target_sdk_version = 5;
135    string target_sdk_version_name = 6;
136  }
137}
138
139message UsesConfiguration {
140  int32 req_touch_screen = 1;
141  int32 req_keyboard_type = 2;
142  int32 req_hard_keyboard = 3;
143  int32 req_navigation = 4;
144  int32 req_five_way_nav = 5;
145}
146
147// Screens supported by this application.
148message SupportsScreen {
149  enum ScreenType {
150    UNSPECIFIED_SCREEN_TYPE = 0;
151    SMALL = 1;
152    NORMAL = 2;
153    LARGE = 3;
154    XLARGE = 4;
155  }
156  repeated ScreenType screens = 1;
157  bool supports_any_densities = 2;
158  int32 requires_smallest_width_dp = 3;
159  int32 compatible_width_limit_dp = 4;
160  int32 largest_width_limit_dp = 5;
161}
162
163// Inputs supported by this application.
164message SupportsInput {
165  repeated string inputs = 1;
166}
167
168// Information about used features which is extracted from <uses-permission>
169// elements or implied from permissions.
170message Feature {
171  message ImpliedData {
172      bool from_sdk_23_permission = 1;
173      repeated string reasons = 2;
174  }
175
176  string name = 1;
177  bool required = 2;
178  int32 version = 3;
179
180  ImpliedData implied_data = 4;
181}
182
183message FeatureGroup {
184  string label = 1;
185  int32 open_gles_version = 2;
186  repeated Feature features = 3;
187}
188
189// Information about permission requested by the application.
190message UsesPermission {
191  message PermissionFlags {
192    bool never_for_location = 1;
193  }
194
195  string name = 1;
196  int32 max_sdk_version = 2;
197  bool required = 3;
198  bool implied = 4;
199  bool sdk23_and_above = 5;
200
201  repeated string required_features = 6;
202  repeated string required_not_features = 7;
203
204  PermissionFlags permission_flags = 8;
205}
206
207// Permission defined by the application.
208message Permission {
209  string name = 1;
210}
211
212// Data extracted about launchable activity. Launchable activity is an entry
213// point on phone and tablet devices.
214message LaunchableActivity {
215  string name = 1;
216  string icon = 2;
217  string label = 3;
218}
219
220// Data extracted about leanback launchable activity. Leanback launchable
221// activity is an entry point on TV devices.
222message LeanbackLaunchableActivity {
223  string name = 1;
224  string icon = 2;
225  string label = 3;
226  string banner = 4;
227}
228
229// Library used by the application.
230message UsesLibrary {
231  string name = 1;
232  bool required = 2;
233}
234
235// Static library this APK declares.
236message StaticLibrary {
237  string name = 1;
238  int32 version = 2;
239  int32 version_major = 3;
240}
241
242// Static library used by the application.
243message UsesStaticLibrary {
244  string name = 1;
245  int32 version = 2;
246  int32 version_major = 3;
247  repeated string certificates = 4;
248}
249
250// SDK library this APK declares.
251message SdkLibrary {
252  string name = 1;
253  int32 version_major = 2;
254}
255
256// SDK library used by the application.
257message UsesSdkLibrary {
258  string name = 1;
259  int32 version_major = 2;
260  repeated string certificates = 3;
261}
262
263// Native library used by the application.
264message UsesNativeLibrary {
265  string name = 1;
266  bool required = 2;
267}
268
269// Information extracted from <meta-data> elements defined across
270// AndroidManifest.xml.
271message Metadata {
272  string name = 1;
273  oneof value {
274    string value_string = 2;
275    int32 value_int = 3;
276  }
277  oneof resource {
278    string resource_string = 4;
279    int32 resource_int = 5;
280  }
281}
282
283// Information about overlay that is declared in the APK.
284message Overlay {
285  string target_package = 1;
286  int32 priority = 2;
287  bool static = 3;
288  string required_property_name = 4;
289  string required_property_value = 5;
290}
291
292// Data extracted from <package-verifier> element.
293message PackageVerifier {
294  string name = 1;
295  string public_key = 2;
296}
297
298// External packages used by the application
299message UsesPackage {
300  string name = 1;
301  string package_type = 2;
302  int32 version = 3;
303  int32 version_major = 4;
304  repeated string certificates = 5;
305}
306
307// Open GL textures format supported by the current application.
308message SupportsGlTexture {
309  repeated string name = 1;
310}
311
312// Screens compatible with the application.
313message CompatibleScreens {
314  message Screen {
315    int32 size = 1;
316    int32 density = 2;
317  }
318
319  repeated Screen screens = 1;
320}
321
322// Architectures supported by the application.
323message Architectures {
324  repeated string architectures = 1;
325  repeated string alt_architectures = 2;
326}
327
328// Information extracted from <property> elements defined across
329// AndroidManifest.xml.
330message Property {
331  string name = 1;
332  oneof value {
333    string value_string = 2;
334    int32 value_int = 3;
335  }
336  oneof resource {
337    string resource_string = 4;
338    int32 resource_int = 5;
339  }
340}