• 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
20mainline_stubs_args =
21    "--error UnhiddenSystemApi " +
22    "--hide CallbackInterface " +
23    "--hide HiddenTypedefConstant " +
24    "--hide RequiresPermission " +
25    "--enhance-documentation "
26
27// TODO: remove the hiding when server classes are cleaned up.
28mainline_framework_stubs_args =
29    mainline_stubs_args +
30    "--hide-package com.android.server "
31
32priv_apps = " " +
33    "--show-annotation android.annotation.SystemApi\\(" +
34        "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
35    "\\) "
36
37module_libs = " " +
38    " --show-annotation android.annotation.SystemApi\\(" +
39        "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
40    "\\)" +
41    " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
42        "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
43    "\\) "
44
45mainline_service_stubs_args =
46    mainline_stubs_args +
47    "--show-annotation android.annotation.SystemApi\\(" +
48        "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" +
49    "\\) " +
50    "--hide-annotation android.annotation.Hide " +
51    "--hide InternalClasses " // com.android.* classes are okay in this interface
52
53// Defaults common to all mainline module java_sdk_library instances.
54java_defaults {
55    name: "framework-module-common-defaults",
56
57    // Use the source of annotations that affect metalava doc generation, since
58    // the relevant generation instructions are themselves in javadoc, which is
59    // not present in class files.
60    api_srcs: [":framework-metalava-annotations"],
61
62    // Make the source retention annotations available on the classpath when compiling
63    // the implementation library. (This should be in impl_only_libs but some modules
64    // use these defaults for java_library, sigh.)
65    libs: ["framework-annotations-lib"],
66
67    // Framework modules are not generally shared libraries, i.e. they are not
68    // intended, and must not be allowed, to be used in a <uses-library> manifest
69    // entry.
70    shared_library: false,
71
72    // Prevent dependencies that do not specify an sdk_version from accessing the
73    // implementation library by default and force them to use stubs instead.
74    default_to_stubs: true,
75
76    // Enable api lint. This will eventually become the default for java_sdk_library
77    // but it cannot yet be turned on because some usages have not been cleaned up.
78    // TODO(b/156126315) - Remove when no longer needed.
79    api_lint: {
80        enabled: true,
81    },
82
83    // The API scope specific properties.
84    public: {
85        enabled: true,
86        sdk_version: "module_current",
87    },
88
89    // installable implies we'll create a non-apex (platform) variant, which
90    // we shouldn't ordinarily need (and it can create issues), so disable that.
91    installable: false,
92
93    // Configure framework module specific metalava options.
94    droiddoc_options: [mainline_stubs_args],
95
96    annotations_enabled: true,
97
98    // Allow access to the stubs from anywhere
99    visibility: ["//visibility:public"],
100    stubs_library_visibility: ["//visibility:public"],
101
102    // Hide impl library and stub sources
103    impl_library_visibility: [
104        ":__pkg__",
105        "//frameworks/base/api", // For framework-all
106    ],
107    stubs_source_visibility: ["//visibility:private"],
108
109    defaults_visibility: ["//visibility:private"],
110
111    // Collates API usages from each module for further analysis.
112    plugins: ["java_api_finder"],
113
114    dist_group: "android",
115}
116
117// Defaults for mainline module provided java_sdk_library instances.
118java_defaults {
119    name: "framework-module-defaults",
120    defaults: ["framework-module-common-defaults"],
121    sdk_version: "module_current",
122
123    system: {
124        enabled: true,
125        sdk_version: "module_current",
126    },
127    module_lib: {
128        enabled: true,
129        sdk_version: "module_current",
130    },
131    defaults_visibility: [
132        ":__subpackages__",
133        "//frameworks/base/apex:__subpackages__",
134        "//frameworks/base/libs/hwui",
135        "//frameworks/base/wifi",
136        "//packages/modules:__subpackages__",
137        "//packages/providers/MediaProvider:__subpackages__",
138        "//system/apex/apexd:__subpackages__",
139    ],
140}
141
142// Defaults for mainline module system server provided java_sdk_library instances.
143java_defaults {
144    name: "framework-system-server-module-defaults",
145    defaults: ["framework-module-common-defaults"],
146    sdk_version: "system_server_current",
147
148    system_server: {
149        enabled: true,
150        sdk_version: "system_server_current",
151    },
152    defaults_visibility: [
153        ":__subpackages__",
154        "//art/libartservice:__subpackages__",
155        "//frameworks/base/apex:__subpackages__",
156        "//packages/modules:__subpackages__",
157        "//system/apex/apexd:__subpackages__",
158    ],
159}
160
161stubs_defaults {
162    name: "service-module-stubs-srcs-defaults",
163    args: mainline_service_stubs_args,
164    installable: false,
165    annotations_enabled: true,
166    merge_annotations_dirs: [
167        "metalava-manual",
168    ],
169    filter_packages: ["com.android."],
170    check_api: {
171        current: {
172            api_file: "api/current.txt",
173            removed_api_file: "api/removed.txt",
174        },
175        api_lint: {
176            enabled: true,
177        },
178    },
179    dist: {
180        targets: ["sdk"],
181        dir: "apistubs/android/system-server/api",
182    },
183}
184
185// Empty for now, but a convenient place to add rules for all
186// module java_library system_server stub libs.
187java_defaults {
188    name: "service-module-stubs-defaults",
189    dist: {
190        targets: ["sdk"],
191        dir: "apistubs/android/system-server",
192    },
193}
194
195// These apex_defaults serve as a common place to add properties which should
196// affect all mainline modules.
197apex_defaults {
198    name: "q-launched-apex-module",
199    min_sdk_version: "29",
200    updatable: true,
201    defaults_visibility: ["//visibility:public"],
202}
203
204apex_defaults {
205    name: "r-launched-apex-module",
206    min_sdk_version: "30",
207    updatable: true,
208    defaults_visibility: ["//visibility:public"],
209}
210
211apex_defaults {
212    name: "s-launched-apex-module",
213    min_sdk_version: "31",
214    updatable: true,
215    defaults_visibility: [
216        "//art:__subpackages__",
217        "//packages/modules:__subpackages__",
218    ],
219}
220
221apex_defaults {
222    name: "t-launched-apex-module",
223    min_sdk_version: "Tiramisu",
224    updatable: true,
225    defaults_visibility: ["//packages/modules:__subpackages__"],
226}
227