blob: fc84816b84d25e4a7f1451d59b750cc3640e0184 [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 {
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000018 default_team: "trendy_team_fwk_core_networking",
Bob Badour727b6722021-02-12 17:07:05 -080019 // See: http://go/android-license-faq
Baligh Uddin2afd0982021-05-24 03:50:01 +000020 default_applicable_licenses: ["Android-Apache-2.0"],
Bob Badour727b6722021-02-12 17:07:05 -080021}
22
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090023filegroup {
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090024 name: "framework-connectivity-internal-sources",
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090025 srcs: [
26 "src/**/*.java",
27 "src/**/*.aidl",
28 ],
29 path: "src",
30 visibility: [
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090031 "//visibility:private",
32 ],
33}
34
35filegroup {
36 name: "framework-connectivity-aidl-export-sources",
37 srcs: [
38 "aidl-export/**/*.aidl",
39 ],
40 path: "aidl-export",
41 visibility: [
42 "//visibility:private",
43 ],
44}
45
46// TODO: use a java_library in the bootclasspath instead
47filegroup {
48 name: "framework-connectivity-sources",
Anton Hansson57f3d692023-03-15 10:30:10 +000049 defaults: ["framework-sources-module-defaults"],
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090050 srcs: [
51 ":framework-connectivity-internal-sources",
52 ":framework-connectivity-aidl-export-sources",
53 ],
Anton Hansson57f3d692023-03-15 10:30:10 +000054 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Bob Badour727b6722021-02-12 17:07:05 -080055}
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090056
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090057java_defaults {
58 name: "framework-connectivity-defaults",
59 defaults: ["framework-module-defaults"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090060 sdk_version: "module_current",
61 min_sdk_version: "30",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090062 srcs: [
63 ":framework-connectivity-sources",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090064 ":net-utils-framework-common-srcs",
Junyu Laieb6f4be2022-01-17 11:52:57 +000065 ":framework-connectivity-api-shared-srcs",
Sandro Montanari9ffc0682024-07-24 15:50:37 +000066 ":framework-networksecurity-sources",
Yuyang Huang1cc77692024-11-08 11:51:07 +090067 ":statslog-framework-connectivity-java-gen",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090068 ],
69 aidl: {
Siim Sammulcd4c8222021-12-13 15:52:07 +000070 generate_get_transaction_name: true,
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090071 include_dirs: [
72 // Include directories for parcelables that are part of the stable API, and need a
73 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
74 // TODO(b/180293679): remove these dependencies as they should not be necessary once
75 // the module builds against API (the parcelable declarations exist in framework.aidl)
76 "frameworks/base/core/java", // For framework parcelables
77 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
Patrick Rohr7d6dfd52024-12-05 04:06:53 +000078 "packages/modules/Connectivity/Tethering/common/TetheringLib/src",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090079 ],
80 },
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090081 stub_only_libs: [
paulhu537f7202022-02-08 21:25:28 +080082 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090083 ],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090084 impl_only_libs: [
Igor Chernyshev9dac6602022-12-13 19:28:32 -080085 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
86 // framework-connectivity and framework-tethering are in the same APEX.
Mark Whitee4d44632023-07-25 23:02:43 +000087 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -080088 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090089 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090090 ],
Chalard Jeandece0d82021-11-15 18:17:33 +090091 static_libs: [
Junyu Laid0e04942024-07-10 18:10:05 +080092 "com.android.net.flags-aconfig-java",
Jimi Chen92e23ac2025-06-02 13:25:24 +000093 "android.net.platform.flags-aconfig-java-export",
Ken Chen7da858c2023-11-17 12:20:53 +080094 // Not using the latest stable version because all functions in the latest version of
95 // mdns_aidl_interface are deprecated.
96 "mdns_aidl_interface-V1-java",
Xiao Ma0a171c02022-01-23 16:14:51 +000097 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +090098 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090099 "modules-utils-preconditions",
Sandro Montanari9ffc0682024-07-24 15:50:37 +0000100 "networksecurity_flags_java_lib",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400101 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +0900102 ],
Junyu Lai29b7b632023-08-23 17:35:17 +0800103 impl_only_static_libs: [
Handa Wang9b0df362024-07-02 13:17:43 +0000104 "net-utils-framework-connectivity",
Junyu Lai29b7b632023-08-23 17:35:17 +0800105 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900106 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +0900107 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200108 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +0800109 "framework-connectivity-t.stubs.module_lib",
Yuyang Huang1cc77692024-11-08 11:51:07 +0900110 "framework-statsd.stubs.module_lib",
Yuyang Huangee0a07c2024-11-25 12:31:48 +0900111 "unsupportedappusage",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900112 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900113 apex_available: [
114 "com.android.tethering",
115 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900116}
117
Motomu Utsumi4d255642024-07-23 16:41:25 +0900118// Library to allow Cronet to use hidden APIs
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900119java_library {
Motomu Utsumi4d255642024-07-23 16:41:25 +0900120 name: "framework-connectivity-pre-jarjar-without-cronet",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900121 defaults: [
122 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700123 ],
124 static_libs: [
Junyu Lai29b7b632023-08-23 17:35:17 +0800125 // Framework-connectivity-pre-jarjar is identical to framework-connectivity
126 // implementation, but without the jarjar rules. However, framework-connectivity
127 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source
128 // to generate the SDK stubs.
129 // Even if the library is included in "impl_only_static_libs" of defaults. This is still
130 // needed because java_library which doesn't understand "impl_only_static_libs".
Handa Wang9b0df362024-07-02 13:17:43 +0000131 "net-utils-framework-connectivity",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700132 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900133 libs: [
134 // This cannot be in the defaults clause above because if it were, it would be used
135 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800136 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900137 // TetheringRequest depends on LinkAddress).
Mark Whitee4d44632023-07-25 23:02:43 +0000138 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800139 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900140 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900141 ],
Motomu Utsumi4d255642024-07-23 16:41:25 +0900142 visibility: ["//external/cronet:__subpackages__"],
143}
144
145java_library {
146 name: "framework-connectivity-pre-jarjar",
147 defaults: ["framework-module-defaults"],
Yan Yanb4ccc6a2024-11-02 01:37:17 +0000148 installable: false,
Motomu Utsumi4d255642024-07-23 16:41:25 +0900149 min_sdk_version: "30",
150 static_libs: [
151 "framework-connectivity-pre-jarjar-without-cronet",
152 "httpclient_api",
153 "httpclient_impl",
154 ],
155 apex_available: [
156 "com.android.tethering",
157 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800158 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900159}
160
Patrick Rohr740b1d42023-05-11 13:28:54 -0700161java_defaults {
162 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000163 srcs: [":httpclient_api_sources"],
Mohannad Farragb09cd9e2025-02-06 15:26:07 +0000164 static_libs: [
165 "com.android.net.http.flags-aconfig-java",
Mohannad Farragb09cd9e2025-02-06 15:26:07 +0000166 ],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700167 libs: [
168 "androidx.annotation_annotation",
169 ],
170 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000171 "httpclient_impl",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700172 ],
173}
174
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900175java_sdk_library {
176 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900177 defaults: [
178 "framework-connectivity-defaults",
179 "CronetJavaDefaults",
180 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900181 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900182 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000183 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900184 impl_library_visibility: [
185 "//packages/modules/Connectivity/Tethering/apex",
186 // In preparation for future move
187 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900188 "//packages/modules/Connectivity/framework-t",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000189 "//packages/modules/Connectivity/remoteauth/service",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900190 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000191 "//packages/modules/Connectivity/service-t",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000192 "//packages/modules/Connectivity/staticlibs",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900193 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000194
195 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800196 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900197 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Yan Yan587f9962024-10-02 22:38:10 +0000198
Yan Yane82942e2025-07-10 18:57:13 +0000199 // TODO: b/374174952 Clean up VCN paths when the code location is finalized
Yan Yan587f9962024-10-02 22:38:10 +0000200 "//cts/tests/tests/vcn",
Yan Yane82942e2025-07-10 18:57:13 +0000201 "//packages/modules/Connectivity/Vcn/tests:__subpackages__",
Yan Yan587f9962024-10-02 22:38:10 +0000202
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000203 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900204 "//frameworks/base/core/tests/bandwidthtests",
205 "//frameworks/base/core/tests/benchmarks",
206 "//frameworks/base/core/tests/utillib",
Chiachang Wanga5d98752024-02-28 07:50:15 +0000207 "//frameworks/base/services/tests/VpnTests",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800208 "//frameworks/base/tests/vcn",
Xiao Ma0a171c02022-01-23 16:14:51 +0000209 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000210 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800211 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumic4800392023-09-11 11:48:36 +0900212 "//packages/modules/Connectivity/staticlibs/testutils",
213 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900214 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000215 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
216 "//packages/modules/Connectivity/tests:__subpackages__",
Handa Wang806f5a12023-12-04 12:53:39 +0800217 "//packages/modules/Connectivity/thread/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800218 "//packages/modules/IPsec/tests/iketests",
Jihoon Kange7cae172024-09-09 22:52:00 +0000219 "//packages/modules/NetworkStack",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000220 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800221 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900222 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800223 lint: {
224 baseline_filename: "lint-baseline.xml",
225 },
Motomu Utsumi52f294c2024-02-15 15:21:39 +0900226 aconfig_declarations: [
227 "com.android.net.flags-aconfig",
Mohannad Farrag50231432024-11-22 07:50:30 +0000228 "com.android.net.http.flags-aconfig",
Sandro Montanari9ffc0682024-07-24 15:50:37 +0000229 "com.android.networksecurity.flags-aconfig",
Motomu Utsumi52f294c2024-02-15 15:21:39 +0900230 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000231}
232
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200233platform_compat_config {
234 name: "connectivity-platform-compat-config",
235 src: ":framework-connectivity",
236}
237
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000238cc_library_shared {
239 name: "libframework-connectivity-jni",
240 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000241 cflags: [
242 "-Wall",
243 "-Werror",
244 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000245 // Don't warn about S API usage even with
246 // min_sdk 30: the library is only loaded
247 // on S+ devices
248 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000249 "-Wthread-safety",
250 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000251 srcs: [
252 "jni/android_net_NetworkUtils.cpp",
253 "jni/onload.cpp",
254 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000255 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000256 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000257 "liblog",
258 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000259 ],
260 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000261 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000262 "dnsproxyd_protocol_headers",
263 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000264 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000265 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000266 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000267 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900268}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000269
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800270filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000271 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000272 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800273 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000274 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800275 visibility: ["//frameworks/base"],
276}
277
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400278java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800279 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400280 proto: {
281 type: "stream",
282 },
283 srcs: [":framework-connectivity-protos"],
284 installable: false,
285 sdk_version: "module_current",
286 min_sdk_version: "30",
287 apex_available: [
288 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000289 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000290}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900291
292java_genrule {
293 name: "framework-connectivity-jarjar-rules",
294 tool_files: [
295 ":connectivity-hiddenapi-files",
296 ":framework-connectivity-pre-jarjar{.jar}",
297 ":framework-connectivity-t-pre-jarjar{.jar}",
298 ":framework-connectivity.stubs.module_lib{.jar}",
299 ":framework-connectivity-t.stubs.module_lib{.jar}",
300 "jarjar-excludes.txt",
301 ],
302 tools: [
303 "jarjar-rules-generator",
304 ],
305 out: ["framework_connectivity_jarjar_rules.txt"],
306 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900307 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900308 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
309 "--prefix android.net.connectivity " +
310 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900311 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
312 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
313 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900314 "--excludes $(location jarjar-excludes.txt) " +
315 "--output $(out)",
316 visibility: [
317 "//packages/modules/Connectivity/framework:__subpackages__",
318 "//packages/modules/Connectivity/framework-t:__subpackages__",
319 "//packages/modules/Connectivity/service",
320 ],
321}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800322
323// Library providing limited APIs within the connectivity module, so that R+ components like
324// Tethering have a controlled way to depend on newer components like framework-connectivity that
325// are not loaded on R.
Chalard Jean2fb66f12023-08-25 12:50:37 +0900326// Note that this target needs to have access to hidden classes, and as such needs to list
327// the full libraries instead of the .impl lib (which only expose API classes).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800328java_library {
329 name: "connectivity-internal-api-util",
330 sdk_version: "module_current",
331 libs: [
332 "androidx.annotation_annotation",
Chalard Jean2fb66f12023-08-25 12:50:37 +0900333 "framework-connectivity-pre-jarjar",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800334 ],
335 jarjar_rules: ":framework-connectivity-jarjar-rules",
336 srcs: [
Chalard Jean2fb66f12023-08-25 12:50:37 +0900337 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.S)
338 // or above as appropriate so that API checks are enforced for R+ users of this library
Chalard Jean674f3472023-10-24 20:59:01 +0900339 "src/android/net/connectivity/ConnectivityInternalApiUtil.java",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800340 ],
341 visibility: [
342 "//packages/modules/Connectivity/Tethering:__subpackages__",
343 ],
344}