• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2019 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
15package {
16    default_visibility: [":__subpackages__"],
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20// Defaults common to all mainline module java_sdk_library instances.
21java_defaults {
22    name: "framework-module-common-defaults",
23
24    // Use the source of annotations that affect metalava doc generation, since
25    // the relevant generation instructions are themselves in javadoc, which is
26    // not present in class files.
27    api_srcs: [":framework-metalava-annotations"],
28
29    // Make the source retention annotations available on the classpath when compiling
30    // the implementation library. (This should be in impl_only_libs but some modules
31    // use these defaults for java_library, sigh.)
32    libs: ["framework-annotations-lib"],
33
34    // Framework modules are not generally shared libraries, i.e. they are not
35    // intended, and must not be allowed, to be used in a <uses-library> manifest
36    // entry.
37    shared_library: false,
38
39    // Prevent dependencies that do not specify an sdk_version from accessing the
40    // implementation library by default and force them to use stubs instead.
41    default_to_stubs: true,
42
43    // Enable api lint. This will eventually become the default for java_sdk_library
44    // but it cannot yet be turned on because some usages have not been cleaned up.
45    // TODO(b/156126315) - Remove when no longer needed.
46    api_lint: {
47        enabled: true,
48        legacy_errors_allowed: false,
49    },
50
51    // The API scope specific properties.
52    public: {
53        enabled: true,
54        sdk_version: "module_current",
55    },
56
57    // installable implies we'll create a non-apex (platform) variant, which
58    // we shouldn't ordinarily need (and it can create issues), so disable that.
59    installable: false,
60
61    optimize: {
62        // Note that we don't enable optimizations by default, but we do
63        // bundle an additional set of Proguard rules that should always
64        // be used downstream for selectively optimized targets.
65        proguard_flags_files: [":framework-sdk-proguard-rules"],
66    },
67
68    // Configure framework module specific metalava options.
69    droiddoc_options: [
70        "--error UnhiddenSystemApi",
71        "--error UnflaggedApi",
72        "--error-when-new FlaggedApiLiteral",
73        "--hide CallbackInterface",
74        "--enhance-documentation",
75    ],
76
77    annotations_enabled: true,
78
79    // Allow access to the stubs from anywhere
80    visibility: ["//visibility:public"],
81    stubs_library_visibility: ["//visibility:public"],
82
83    // Hide impl library and stub sources
84    impl_library_visibility: [
85        ":__pkg__",
86        "//frameworks/base/api", // For framework-all
87    ],
88    stubs_source_visibility: [
89        ":__pkg__",
90        "//frameworks/base/api", // For all-modules-public-stubs-source-exportable
91    ],
92
93    defaults_visibility: ["//visibility:private"],
94
95    dist_group: "android",
96}
97
98// Defaults for the java_sdk_libraries of non-updatable modules.
99// java_sdk_libraries using these defaults should also add themselves to the
100// non_updatable_modules list in frameworks/base/api/api.go
101java_defaults {
102    name: "non-updatable-framework-module-defaults",
103    defaults: ["framework-module-common-defaults"],
104
105    system: {
106        enabled: true,
107        sdk_version: "module_current",
108    },
109    module_lib: {
110        enabled: true,
111        sdk_version: "module_current",
112    },
113    // Non-updatable modules are allowed to provide @TestApi
114    test: {
115        enabled: true,
116        sdk_version: "module_current",
117    },
118
119    defaults_visibility: [
120        "//frameworks/base",
121        "//frameworks/base/api",
122        "//packages/modules/Virtualization:__subpackages__",
123    ],
124}
125
126// Defaults for mainline module provided java_sdk_library instances.
127java_defaults {
128    name: "framework-module-defaults",
129    defaults: ["framework-module-common-defaults"],
130    sdk_version: "module_current",
131
132    system: {
133        enabled: true,
134        sdk_version: "module_current",
135    },
136    module_lib: {
137        enabled: true,
138        sdk_version: "module_current",
139    },
140
141    defaults_visibility: [
142        ":__subpackages__",
143        // TODO(b/237461653): Move this to packages/modules/Nfc
144        "//frameworks/base/nfc",
145        "//frameworks/base/apex:__subpackages__",
146        "//frameworks/base/libs/hwui",
147        "//frameworks/base/packages/Vcn:__subpackages__",
148        "//frameworks/base/wifi",
149        "//packages/modules:__subpackages__",
150        "//packages/providers/MediaProvider:__subpackages__",
151        "//system/apex/apexd:__subpackages__",
152    ],
153}
154
155// Defaults for mainline module system server provided java_sdk_library instances.
156java_defaults {
157    name: "framework-system-server-module-defaults",
158    defaults: ["framework-module-common-defaults"],
159    sdk_version: "system_server_current",
160
161    system_server: {
162        enabled: true,
163        sdk_version: "system_server_current",
164    },
165
166    defaults_visibility: [
167        ":__subpackages__",
168        "//art/libartservice:__subpackages__",
169        "//frameworks/base/apex:__subpackages__",
170        "//frameworks/base/packages/Vcn:__subpackages__",
171        "//packages/modules:__subpackages__",
172        "//system/apex/apexd:__subpackages__",
173    ],
174}
175
176filegroup_defaults {
177    name: "framework-sources-module-defaults",
178    visibility: [
179        "//frameworks/base",
180        "//frameworks/base/api",
181    ],
182    defaults_visibility: ["//visibility:public"],
183}
184
185// These apex_defaults serve as a common place to add properties which should
186// affect all mainline modules.
187
188APEX_LOWEST_MIN_SDK_VERSION = "30"
189DCLA_MIN_SDK_VERSION = "31"
190
191apex_defaults {
192    name: "any-launched-apex-modules",
193    updatable: true,
194    defaults_visibility: ["//visibility:public"],
195}
196
197apex_defaults {
198    name: "q-launched-apex-module",
199    defaults: ["any-launched-apex-modules"],
200    min_sdk_version: APEX_LOWEST_MIN_SDK_VERSION,
201    defaults_visibility: ["//visibility:public"],
202}
203
204soong_config_module_type_import {
205    from: "system/apex/Android.bp",
206    module_types: [
207        "library_linking_strategy_apex_defaults",
208        "library_linking_strategy_cc_defaults",
209    ],
210}
211
212library_linking_strategy_apex_defaults {
213    name: "q-launched-dcla-enabled-apex-module",
214    defaults_visibility: [
215        "//external/conscrypt/apex",
216        "//packages/modules/DnsResolver/apex",
217        "//frameworks/av/apex",
218    ],
219    defaults: ["q-launched-apex-module"],
220    soong_config_variables: {
221        library_linking_strategy: {
222            // Use the Q min_sdk_version
223            prefer_static: {},
224            // Override the Q min_sdk_version to min_sdk_version that supports dcla
225            conditions_default: {
226                min_sdk_version: DCLA_MIN_SDK_VERSION,
227            },
228        },
229    },
230}
231
232apex_defaults {
233    name: "r-launched-apex-module",
234    defaults: ["any-launched-apex-modules"],
235    min_sdk_version: "30",
236    defaults_visibility: ["//visibility:public"],
237}
238
239library_linking_strategy_apex_defaults {
240    name: "r-launched-dcla-enabled-apex-module",
241    defaults_visibility: [
242        "//packages/modules/adb:__subpackages__",
243        "//packages/modules/Connectivity/Tethering/apex",
244    ],
245    defaults: ["r-launched-apex-module"],
246    soong_config_variables: {
247        library_linking_strategy: {
248            // Use the R min_sdk_version
249            prefer_static: {},
250            // Override the R min_sdk_version to min_sdk_version that supports dcla
251            conditions_default: {
252                min_sdk_version: DCLA_MIN_SDK_VERSION,
253            },
254        },
255    },
256}
257
258apex_defaults {
259    name: "s-launched-apex-module",
260    defaults: ["any-launched-apex-modules"],
261    min_sdk_version: "31",
262    // Indicates that pre-installed version of this apex can be compressed.
263    // Whether it actually will be compressed is controlled on per-device basis.
264    compressible: true,
265    defaults_visibility: [
266        "//art:__subpackages__",
267        "//packages/modules:__subpackages__",
268    ],
269}
270
271apex_defaults {
272    name: "t-launched-apex-module",
273    defaults: ["any-launched-apex-modules"],
274    min_sdk_version: "Tiramisu",
275    // Indicates that pre-installed version of this apex can be compressed.
276    // Whether it actually will be compressed is controlled on per-device basis.
277    compressible: true,
278    defaults_visibility: ["//packages/modules:__subpackages__"],
279}
280
281apex_defaults {
282    name: "u-launched-apex-module",
283    defaults: ["any-launched-apex-modules"],
284    min_sdk_version: "UpsideDownCake",
285    // Indicates that pre-installed version of this apex can be compressed.
286    // Whether it actually will be compressed is controlled on per-device basis.
287    compressible: true,
288    defaults_visibility: ["//packages/modules:__subpackages__"],
289}
290
291apex_defaults {
292    name: "v-launched-apex-module",
293    defaults: ["any-launched-apex-modules"],
294    min_sdk_version: "VanillaIceCream",
295    // Indicates that pre-installed version of this apex can be compressed.
296    // Whether it actually will be compressed is controlled on per-device basis.
297    compressible: true,
298    defaults_visibility: ["//packages/modules:__subpackages__"],
299}
300
301apex_defaults {
302    name: "b-launched-apex-module",
303    defaults: ["any-launched-apex-modules"],
304    min_sdk_version: "36",
305    // Indicates that pre-installed version of this apex can be compressed.
306    // Whether it actually will be compressed is controlled on per-device basis.
307    compressible: true,
308    defaults_visibility: [
309        "//packages/modules:__subpackages__",
310        // TODO(b/367426693): Remove this once NFC codebase is moved.
311        "//packages/apps/Nfc:__subpackages__",
312    ],
313}
314
315library_linking_strategy_cc_defaults {
316    name: "apex-lowest-min-sdk-version",
317    defaults_visibility: [
318        "//system/core/libutils:__subpackages__",
319    ],
320    min_sdk_version: APEX_LOWEST_MIN_SDK_VERSION,
321    soong_config_variables: {
322        library_linking_strategy: {
323            prefer_static: {
324                min_sdk_version: "apex_inherit",
325            },
326        },
327    },
328}
329