blob: 73a1ed0a9aee0a1a2216ad0425131ff5ba481649 [file] [log] [blame]
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +09001//
2// Copyright (C) 2020 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
Bob Badour727b6722021-02-12 17:07:05 -080017package {
18 // See: http://go/android-license-faq
Baligh Uddin2afd0982021-05-24 03:50:01 +000019 default_applicable_licenses: ["Android-Apache-2.0"],
Bob Badour727b6722021-02-12 17:07:05 -080020}
21
Motomu Utsumi310f11a2023-09-07 19:20:07 +090022// In the branch which does not support FlaggedAPI, use this default to ignore the annotated APIs.
23java_defaults {
24 name: "FlaggedApiDefaults",
25}
26
27// The above variables may have different values
28// depending on the branch, and this comment helps
29// separate them from the rest of the file to avoid merge conflicts
30
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090031filegroup {
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090032 name: "framework-connectivity-internal-sources",
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090033 srcs: [
34 "src/**/*.java",
35 "src/**/*.aidl",
36 ],
37 path: "src",
38 visibility: [
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090039 "//visibility:private",
40 ],
41}
42
43filegroup {
44 name: "framework-connectivity-aidl-export-sources",
45 srcs: [
46 "aidl-export/**/*.aidl",
47 ],
48 path: "aidl-export",
49 visibility: [
50 "//visibility:private",
51 ],
52}
53
54// TODO: use a java_library in the bootclasspath instead
55filegroup {
56 name: "framework-connectivity-sources",
Anton Hansson57f3d692023-03-15 10:30:10 +000057 defaults: ["framework-sources-module-defaults"],
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090058 srcs: [
59 ":framework-connectivity-internal-sources",
60 ":framework-connectivity-aidl-export-sources",
61 ],
Anton Hansson57f3d692023-03-15 10:30:10 +000062 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Bob Badour727b6722021-02-12 17:07:05 -080063}
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090064
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090065java_defaults {
66 name: "framework-connectivity-defaults",
67 defaults: ["framework-module-defaults"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090068 sdk_version: "module_current",
69 min_sdk_version: "30",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090070 srcs: [
71 ":framework-connectivity-sources",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090072 ":net-utils-framework-common-srcs",
Junyu Laieb6f4be2022-01-17 11:52:57 +000073 ":framework-connectivity-api-shared-srcs",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090074 ],
75 aidl: {
Siim Sammulcd4c8222021-12-13 15:52:07 +000076 generate_get_transaction_name: true,
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090077 include_dirs: [
78 // Include directories for parcelables that are part of the stable API, and need a
79 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
80 // TODO(b/180293679): remove these dependencies as they should not be necessary once
81 // the module builds against API (the parcelable declarations exist in framework.aidl)
82 "frameworks/base/core/java", // For framework parcelables
83 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
84 ],
85 },
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090086 stub_only_libs: [
paulhu537f7202022-02-08 21:25:28 +080087 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090088 ],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090089 impl_only_libs: [
Igor Chernyshev9dac6602022-12-13 19:28:32 -080090 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
91 // framework-connectivity and framework-tethering are in the same APEX.
Mark Whitee4d44632023-07-25 23:02:43 +000092 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -080093 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090094 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090095 ],
Chalard Jeandece0d82021-11-15 18:17:33 +090096 static_libs: [
Ken Chen7da858c2023-11-17 12:20:53 +080097 // Not using the latest stable version because all functions in the latest version of
98 // mdns_aidl_interface are deprecated.
99 "mdns_aidl_interface-V1-java",
Xiao Ma0a171c02022-01-23 16:14:51 +0000100 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +0900101 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900102 "modules-utils-preconditions",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400103 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +0900104 ],
Junyu Lai29b7b632023-08-23 17:35:17 +0800105 impl_only_static_libs: [
Junyu Lai626045a2023-08-28 18:49:44 +0800106 "net-utils-device-common-bpf",
Junyu Lai29b7b632023-08-23 17:35:17 +0800107 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900108 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +0900109 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200110 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +0800111 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900112 "unsupportedappusage",
113 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900114 apex_available: [
115 "com.android.tethering",
116 ],
117 lint: { strict_updatability_linting: true },
118}
119
120java_library {
121 name: "framework-connectivity-pre-jarjar",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900122 defaults: [
123 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700124 ],
125 static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000126 "httpclient_api",
127 "httpclient_impl",
Stefano Duo2a907332023-06-29 18:08:39 +0100128 "http_client_logging",
Junyu Lai29b7b632023-08-23 17:35:17 +0800129 // Framework-connectivity-pre-jarjar is identical to framework-connectivity
130 // implementation, but without the jarjar rules. However, framework-connectivity
131 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source
132 // to generate the SDK stubs.
133 // Even if the library is included in "impl_only_static_libs" of defaults. This is still
134 // needed because java_library which doesn't understand "impl_only_static_libs".
Junyu Lai626045a2023-08-28 18:49:44 +0800135 "net-utils-device-common-bpf",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700136 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900137 libs: [
138 // This cannot be in the defaults clause above because if it were, it would be used
139 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800140 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900141 // TetheringRequest depends on LinkAddress).
Mark Whitee4d44632023-07-25 23:02:43 +0000142 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800143 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900144 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900145 ],
146 visibility: ["//packages/modules/Connectivity:__subpackages__"]
147}
148
Patrick Rohr740b1d42023-05-11 13:28:54 -0700149java_defaults {
150 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000151 srcs: [":httpclient_api_sources"],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700152 libs: [
153 "androidx.annotation_annotation",
154 ],
155 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000156 "httpclient_impl",
Stefano Duo2a907332023-06-29 18:08:39 +0100157 "http_client_logging",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700158 ],
159}
160
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900161java_sdk_library {
162 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900163 defaults: [
164 "framework-connectivity-defaults",
165 "CronetJavaDefaults",
Motomu Utsumi310f11a2023-09-07 19:20:07 +0900166 "FlaggedApiDefaults",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900167 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900168 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900169 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000170 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900171 impl_library_visibility: [
172 "//packages/modules/Connectivity/Tethering/apex",
173 // In preparation for future move
174 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900175 "//packages/modules/Connectivity/framework-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900176 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000177 "//packages/modules/Connectivity/service-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900178 "//frameworks/base/packages/Connectivity/service",
179 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000180
181 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800182 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900183 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000184 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN678277c2021-05-11 13:37:06 +0000185 "//frameworks/base/packages/Connectivity/tests:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900186 "//frameworks/base/core/tests/bandwidthtests",
187 "//frameworks/base/core/tests/benchmarks",
188 "//frameworks/base/core/tests/utillib",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800189 "//frameworks/base/tests/vcn",
Xiao Ma0a171c02022-01-23 16:14:51 +0000190 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000191 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800192 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumic4800392023-09-11 11:48:36 +0900193 "//packages/modules/Connectivity/staticlibs/testutils",
194 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900195 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000196 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
197 "//packages/modules/Connectivity/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800198 "//packages/modules/IPsec/tests/iketests",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000199 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800200 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900201 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000202}
203
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200204platform_compat_config {
205 name: "connectivity-platform-compat-config",
206 src: ":framework-connectivity",
207}
208
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000209cc_library_shared {
210 name: "libframework-connectivity-jni",
211 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000212 cflags: [
213 "-Wall",
214 "-Werror",
215 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000216 // Don't warn about S API usage even with
217 // min_sdk 30: the library is only loaded
218 // on S+ devices
219 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000220 "-Wthread-safety",
221 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000222 srcs: [
223 "jni/android_net_NetworkUtils.cpp",
224 "jni/onload.cpp",
225 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000226 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000227 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000228 "liblog",
229 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000230 ],
231 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000232 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000233 "dnsproxyd_protocol_headers",
234 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000235 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000236 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000237 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000238 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900239}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000240
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800241filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000242 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000243 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800244 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000245 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800246 visibility: ["//frameworks/base"],
247}
248
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400249java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800250 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400251 proto: {
252 type: "stream",
253 },
254 srcs: [":framework-connectivity-protos"],
255 installable: false,
256 sdk_version: "module_current",
257 min_sdk_version: "30",
258 apex_available: [
259 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000260 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000261}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900262
263java_genrule {
264 name: "framework-connectivity-jarjar-rules",
265 tool_files: [
266 ":connectivity-hiddenapi-files",
267 ":framework-connectivity-pre-jarjar{.jar}",
268 ":framework-connectivity-t-pre-jarjar{.jar}",
269 ":framework-connectivity.stubs.module_lib{.jar}",
270 ":framework-connectivity-t.stubs.module_lib{.jar}",
Motomu Utsumiada9e982023-11-06 22:49:25 +0900271 ":framework-connectivity-flagged-apis{.jar}",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900272 "jarjar-excludes.txt",
273 ],
274 tools: [
275 "jarjar-rules-generator",
276 ],
277 out: ["framework_connectivity_jarjar_rules.txt"],
278 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900279 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900280 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
281 "--prefix android.net.connectivity " +
282 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900283 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
Motomu Utsumiada9e982023-11-06 22:49:25 +0900284 "--apistubs $(location :framework-connectivity-flagged-apis{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900285 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
286 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900287 "--excludes $(location jarjar-excludes.txt) " +
288 "--output $(out)",
289 visibility: [
290 "//packages/modules/Connectivity/framework:__subpackages__",
291 "//packages/modules/Connectivity/framework-t:__subpackages__",
292 "//packages/modules/Connectivity/service",
293 ],
294}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800295
Motomu Utsumiada9e982023-11-06 22:49:25 +0900296droidstubs {
297 name: "framework-connectivity-flagged-apis-droidstubs",
298 srcs: [
299 ":framework-connectivity-sources",
300 ":framework-connectivity-tiramisu-updatable-sources",
301 ":framework-nearby-java-sources",
302 ":framework-thread-sources",
303 ],
304 flags: [
305 "--show-annotation android.annotation.FlaggedApi",
Motomu Utsumi2f2aa212023-11-09 16:34:07 +0900306 "--show-for-stub-purposes-annotation android.annotation.SystemApi" +
307 "\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)",
308 "--show-for-stub-purposes-annotation android.annotation.SystemApi" +
309 "\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)",
Motomu Utsumiada9e982023-11-06 22:49:25 +0900310 ],
311 aidl: {
312 include_dirs: [
313 "packages/modules/Connectivity/framework/aidl-export",
314 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
315 ],
316 },
317}
318
319java_library {
320 name: "framework-connectivity-flagged-apis",
321 srcs: [":framework-connectivity-flagged-apis-droidstubs"],
322}
323
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800324// Library providing limited APIs within the connectivity module, so that R+ components like
325// Tethering have a controlled way to depend on newer components like framework-connectivity that
326// are not loaded on R.
Chalard Jean2fb66f12023-08-25 12:50:37 +0900327// Note that this target needs to have access to hidden classes, and as such needs to list
328// the full libraries instead of the .impl lib (which only expose API classes).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800329java_library {
330 name: "connectivity-internal-api-util",
331 sdk_version: "module_current",
332 libs: [
333 "androidx.annotation_annotation",
Chalard Jean2fb66f12023-08-25 12:50:37 +0900334 "framework-connectivity-pre-jarjar",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800335 ],
336 jarjar_rules: ":framework-connectivity-jarjar-rules",
337 srcs: [
Chalard Jean2fb66f12023-08-25 12:50:37 +0900338 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.S)
339 // or above as appropriate so that API checks are enforced for R+ users of this library
340 "src/android/net/RoutingCoordinatorManager.java",
Chalard Jean674f3472023-10-24 20:59:01 +0900341 "src/android/net/connectivity/ConnectivityInternalApiUtil.java",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800342 ],
343 visibility: [
344 "//packages/modules/Connectivity/Tethering:__subpackages__",
345 ],
346}