blob: a1d6a973e662ba6050c1b3437f9908ca1dda912a [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
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090022filegroup {
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090023 name: "framework-connectivity-internal-sources",
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090024 srcs: [
25 "src/**/*.java",
26 "src/**/*.aidl",
27 ],
28 path: "src",
29 visibility: [
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090030 "//visibility:private",
31 ],
32}
33
34filegroup {
35 name: "framework-connectivity-aidl-export-sources",
36 srcs: [
37 "aidl-export/**/*.aidl",
38 ],
39 path: "aidl-export",
40 visibility: [
41 "//visibility:private",
42 ],
43}
44
45// TODO: use a java_library in the bootclasspath instead
46filegroup {
47 name: "framework-connectivity-sources",
Anton Hansson57f3d692023-03-15 10:30:10 +000048 defaults: ["framework-sources-module-defaults"],
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090049 srcs: [
50 ":framework-connectivity-internal-sources",
51 ":framework-connectivity-aidl-export-sources",
52 ],
Anton Hansson57f3d692023-03-15 10:30:10 +000053 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Bob Badour727b6722021-02-12 17:07:05 -080054}
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090055
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090056java_defaults {
57 name: "framework-connectivity-defaults",
58 defaults: ["framework-module-defaults"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090059 sdk_version: "module_current",
60 min_sdk_version: "30",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090061 srcs: [
62 ":framework-connectivity-sources",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090063 ":net-utils-framework-common-srcs",
Junyu Laieb6f4be2022-01-17 11:52:57 +000064 ":framework-connectivity-api-shared-srcs",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090065 ],
66 aidl: {
Siim Sammulcd4c8222021-12-13 15:52:07 +000067 generate_get_transaction_name: true,
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090068 include_dirs: [
69 // Include directories for parcelables that are part of the stable API, and need a
70 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
71 // TODO(b/180293679): remove these dependencies as they should not be necessary once
72 // the module builds against API (the parcelable declarations exist in framework.aidl)
73 "frameworks/base/core/java", // For framework parcelables
74 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
75 ],
76 },
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090077 stub_only_libs: [
paulhu537f7202022-02-08 21:25:28 +080078 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090079 ],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090080 impl_only_libs: [
Igor Chernyshev9dac6602022-12-13 19:28:32 -080081 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
82 // framework-connectivity and framework-tethering are in the same APEX.
Mark Whitee4d44632023-07-25 23:02:43 +000083 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -080084 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090085 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090086 ],
Chalard Jeandece0d82021-11-15 18:17:33 +090087 static_libs: [
Ken Chen7da858c2023-11-17 12:20:53 +080088 // Not using the latest stable version because all functions in the latest version of
89 // mdns_aidl_interface are deprecated.
90 "mdns_aidl_interface-V1-java",
Xiao Ma0a171c02022-01-23 16:14:51 +000091 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +090092 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090093 "modules-utils-preconditions",
Vinh Tran6d8c1d72022-06-08 01:25:14 -040094 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +090095 ],
Junyu Lai29b7b632023-08-23 17:35:17 +080096 impl_only_static_libs: [
Junyu Lai626045a2023-08-28 18:49:44 +080097 "net-utils-device-common-bpf",
Yang Sunbaa50fa2023-12-10 22:01:44 +080098 "net-utils-device-common-struct",
Junyu Lai29b7b632023-08-23 17:35:17 +080099 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900100 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +0900101 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200102 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +0800103 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900104 "unsupportedappusage",
105 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900106 apex_available: [
107 "com.android.tethering",
108 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900109}
110
111java_library {
112 name: "framework-connectivity-pre-jarjar",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900113 defaults: [
114 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700115 ],
116 static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000117 "httpclient_api",
118 "httpclient_impl",
Stefano Duo2a907332023-06-29 18:08:39 +0100119 "http_client_logging",
Junyu Lai29b7b632023-08-23 17:35:17 +0800120 // Framework-connectivity-pre-jarjar is identical to framework-connectivity
121 // implementation, but without the jarjar rules. However, framework-connectivity
122 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source
123 // to generate the SDK stubs.
124 // Even if the library is included in "impl_only_static_libs" of defaults. This is still
125 // needed because java_library which doesn't understand "impl_only_static_libs".
Junyu Lai626045a2023-08-28 18:49:44 +0800126 "net-utils-device-common-bpf",
Yang Sunbaa50fa2023-12-10 22:01:44 +0800127 "net-utils-device-common-struct",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700128 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900129 libs: [
130 // This cannot be in the defaults clause above because if it were, it would be used
131 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800132 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900133 // TetheringRequest depends on LinkAddress).
Mark Whitee4d44632023-07-25 23:02:43 +0000134 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800135 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900136 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900137 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800138 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900139}
140
Patrick Rohr740b1d42023-05-11 13:28:54 -0700141java_defaults {
142 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000143 srcs: [":httpclient_api_sources"],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700144 libs: [
145 "androidx.annotation_annotation",
146 ],
147 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000148 "httpclient_impl",
Stefano Duo2a907332023-06-29 18:08:39 +0100149 "http_client_logging",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700150 ],
151}
152
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900153java_sdk_library {
154 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900155 defaults: [
156 "framework-connectivity-defaults",
157 "CronetJavaDefaults",
158 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900159 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900160 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000161 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900162 impl_library_visibility: [
163 "//packages/modules/Connectivity/Tethering/apex",
164 // In preparation for future move
165 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900166 "//packages/modules/Connectivity/framework-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900167 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000168 "//packages/modules/Connectivity/service-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900169 "//frameworks/base/packages/Connectivity/service",
170 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000171
172 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800173 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900174 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000175 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN678277c2021-05-11 13:37:06 +0000176 "//frameworks/base/packages/Connectivity/tests:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900177 "//frameworks/base/core/tests/bandwidthtests",
178 "//frameworks/base/core/tests/benchmarks",
179 "//frameworks/base/core/tests/utillib",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800180 "//frameworks/base/tests/vcn",
Xiao Ma0a171c02022-01-23 16:14:51 +0000181 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000182 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800183 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumic4800392023-09-11 11:48:36 +0900184 "//packages/modules/Connectivity/staticlibs/testutils",
185 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900186 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000187 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
188 "//packages/modules/Connectivity/tests:__subpackages__",
Handa Wang806f5a12023-12-04 12:53:39 +0800189 "//packages/modules/Connectivity/thread/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800190 "//packages/modules/IPsec/tests/iketests",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000191 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800192 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900193 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800194 lint: {
195 baseline_filename: "lint-baseline.xml",
196 },
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000197}
198
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200199platform_compat_config {
200 name: "connectivity-platform-compat-config",
201 src: ":framework-connectivity",
202}
203
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000204cc_library_shared {
205 name: "libframework-connectivity-jni",
206 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000207 cflags: [
208 "-Wall",
209 "-Werror",
210 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000211 // Don't warn about S API usage even with
212 // min_sdk 30: the library is only loaded
213 // on S+ devices
214 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000215 "-Wthread-safety",
216 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000217 srcs: [
218 "jni/android_net_NetworkUtils.cpp",
219 "jni/onload.cpp",
220 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000221 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000222 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000223 "liblog",
224 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000225 ],
226 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000227 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000228 "dnsproxyd_protocol_headers",
229 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000230 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000231 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000232 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000233 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900234}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000235
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800236filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000237 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000238 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800239 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000240 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800241 visibility: ["//frameworks/base"],
242}
243
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400244java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800245 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400246 proto: {
247 type: "stream",
248 },
249 srcs: [":framework-connectivity-protos"],
250 installable: false,
251 sdk_version: "module_current",
252 min_sdk_version: "30",
253 apex_available: [
254 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000255 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000256}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900257
258java_genrule {
259 name: "framework-connectivity-jarjar-rules",
260 tool_files: [
261 ":connectivity-hiddenapi-files",
262 ":framework-connectivity-pre-jarjar{.jar}",
263 ":framework-connectivity-t-pre-jarjar{.jar}",
264 ":framework-connectivity.stubs.module_lib{.jar}",
265 ":framework-connectivity-t.stubs.module_lib{.jar}",
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900266 ":framework-connectivity-module-api-stubs-including-flagged{.jar}",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900267 "jarjar-excludes.txt",
268 ],
269 tools: [
270 "jarjar-rules-generator",
271 ],
272 out: ["framework_connectivity_jarjar_rules.txt"],
273 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900274 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900275 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
276 "--prefix android.net.connectivity " +
277 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900278 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900279 "--apistubs $(location :framework-connectivity-module-api-stubs-including-flagged{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900280 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
281 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900282 "--excludes $(location jarjar-excludes.txt) " +
283 "--output $(out)",
284 visibility: [
285 "//packages/modules/Connectivity/framework:__subpackages__",
286 "//packages/modules/Connectivity/framework-t:__subpackages__",
287 "//packages/modules/Connectivity/service",
288 ],
289}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800290
Motomu Utsumiada9e982023-11-06 22:49:25 +0900291droidstubs {
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900292 name: "framework-connectivity-module-api-stubs-including-flagged-droidstubs",
Motomu Utsumiada9e982023-11-06 22:49:25 +0900293 srcs: [
294 ":framework-connectivity-sources",
295 ":framework-connectivity-tiramisu-updatable-sources",
296 ":framework-nearby-java-sources",
297 ":framework-thread-sources",
298 ],
299 flags: [
Motomu Utsumi2f2aa212023-11-09 16:34:07 +0900300 "--show-for-stub-purposes-annotation android.annotation.SystemApi" +
Cole Fausta52ecf02023-12-20 11:57:07 -0800301 "\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)",
Motomu Utsumi2f2aa212023-11-09 16:34:07 +0900302 "--show-for-stub-purposes-annotation android.annotation.SystemApi" +
Cole Fausta52ecf02023-12-20 11:57:07 -0800303 "\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)",
Motomu Utsumiada9e982023-11-06 22:49:25 +0900304 ],
305 aidl: {
306 include_dirs: [
307 "packages/modules/Connectivity/framework/aidl-export",
308 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
309 ],
310 },
311}
312
313java_library {
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900314 name: "framework-connectivity-module-api-stubs-including-flagged",
315 srcs: [":framework-connectivity-module-api-stubs-including-flagged-droidstubs"],
Motomu Utsumiada9e982023-11-06 22:49:25 +0900316}
317
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800318// Library providing limited APIs within the connectivity module, so that R+ components like
319// Tethering have a controlled way to depend on newer components like framework-connectivity that
320// are not loaded on R.
Chalard Jean2fb66f12023-08-25 12:50:37 +0900321// Note that this target needs to have access to hidden classes, and as such needs to list
322// the full libraries instead of the .impl lib (which only expose API classes).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800323java_library {
324 name: "connectivity-internal-api-util",
325 sdk_version: "module_current",
326 libs: [
327 "androidx.annotation_annotation",
Chalard Jean2fb66f12023-08-25 12:50:37 +0900328 "framework-connectivity-pre-jarjar",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800329 ],
330 jarjar_rules: ":framework-connectivity-jarjar-rules",
331 srcs: [
Chalard Jean2fb66f12023-08-25 12:50:37 +0900332 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.S)
333 // or above as appropriate so that API checks are enforced for R+ users of this library
334 "src/android/net/RoutingCoordinatorManager.java",
Chalard Jean674f3472023-10-24 20:59:01 +0900335 "src/android/net/connectivity/ConnectivityInternalApiUtil.java",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800336 ],
337 visibility: [
338 "//packages/modules/Connectivity/Tethering:__subpackages__",
339 ],
340}