blob: 7897492809aa470efebf0eac7787481fc660f4d5 [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",
Casey Borders13a35ea2023-07-13 00:30:38 +000065 ":framework-remoteauth-java-sources",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090066 ],
67 aidl: {
Siim Sammulcd4c8222021-12-13 15:52:07 +000068 generate_get_transaction_name: true,
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090069 include_dirs: [
70 // Include directories for parcelables that are part of the stable API, and need a
71 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
72 // TODO(b/180293679): remove these dependencies as they should not be necessary once
73 // the module builds against API (the parcelable declarations exist in framework.aidl)
74 "frameworks/base/core/java", // For framework parcelables
75 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
76 ],
77 },
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090078 stub_only_libs: [
paulhu537f7202022-02-08 21:25:28 +080079 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090080 ],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090081 impl_only_libs: [
Igor Chernyshev9dac6602022-12-13 19:28:32 -080082 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
83 // framework-connectivity and framework-tethering are in the same APEX.
84 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090085 "framework-wifi.stubs.module_lib",
86 "net-utils-device-common",
87 ],
Chalard Jeandece0d82021-11-15 18:17:33 +090088 static_libs: [
paulhu541b72d2022-02-09 14:02:43 +080089 "mdns_aidl_interface-lateststable-java",
Xiao Ma0a171c02022-01-23 16:14:51 +000090 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +090091 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090092 "modules-utils-preconditions",
Vinh Tran6d8c1d72022-06-08 01:25:14 -040093 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +090094 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090095 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +090096 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +020097 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +080098 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090099 "unsupportedappusage",
100 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900101 apex_available: [
102 "com.android.tethering",
103 ],
104 lint: { strict_updatability_linting: true },
105}
106
107java_library {
108 name: "framework-connectivity-pre-jarjar",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900109 defaults: [
110 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700111 ],
112 static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000113 "httpclient_api",
114 "httpclient_impl",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700115 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900116 libs: [
117 // This cannot be in the defaults clause above because if it were, it would be used
118 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800119 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900120 // TetheringRequest depends on LinkAddress).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800121 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900122 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900123 ],
124 visibility: ["//packages/modules/Connectivity:__subpackages__"]
125}
126
Patrick Rohr740b1d42023-05-11 13:28:54 -0700127java_defaults {
128 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000129 srcs: [":httpclient_api_sources"],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700130 libs: [
131 "androidx.annotation_annotation",
132 ],
133 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000134 "httpclient_impl",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700135 ],
136}
137
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900138java_sdk_library {
139 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900140 defaults: [
141 "framework-connectivity-defaults",
142 "CronetJavaDefaults",
143 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900144 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900145 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000146 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900147 impl_library_visibility: [
148 "//packages/modules/Connectivity/Tethering/apex",
149 // In preparation for future move
150 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900151 "//packages/modules/Connectivity/framework-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900152 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000153 "//packages/modules/Connectivity/service-t",
Casey Borders13a35ea2023-07-13 00:30:38 +0000154 "//packages/modules/Connectivity/remoteauth:__subpackages__",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900155 "//frameworks/base/packages/Connectivity/service",
156 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000157
158 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800159 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900160 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000161 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN678277c2021-05-11 13:37:06 +0000162 "//frameworks/base/packages/Connectivity/tests:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900163 "//frameworks/base/core/tests/bandwidthtests",
164 "//frameworks/base/core/tests/benchmarks",
165 "//frameworks/base/core/tests/utillib",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800166 "//frameworks/base/tests/vcn",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000167 "//frameworks/libs/net/common/testutils",
168 "//frameworks/libs/net/common/tests:__subpackages__",
Xiao Ma0a171c02022-01-23 16:14:51 +0000169 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000170 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800171 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900172 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000173 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
174 "//packages/modules/Connectivity/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800175 "//packages/modules/IPsec/tests/iketests",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000176 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800177 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900178 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000179}
180
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200181platform_compat_config {
182 name: "connectivity-platform-compat-config",
183 src: ":framework-connectivity",
184}
185
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000186cc_library_shared {
187 name: "libframework-connectivity-jni",
188 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000189 cflags: [
190 "-Wall",
191 "-Werror",
192 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000193 // Don't warn about S API usage even with
194 // min_sdk 30: the library is only loaded
195 // on S+ devices
196 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000197 "-Wthread-safety",
198 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000199 srcs: [
200 "jni/android_net_NetworkUtils.cpp",
201 "jni/onload.cpp",
202 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000203 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000204 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000205 "liblog",
206 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000207 ],
208 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000209 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000210 "dnsproxyd_protocol_headers",
211 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000212 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000213 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000214 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000215 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900216}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000217
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800218filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000219 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000220 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800221 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000222 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800223 visibility: ["//frameworks/base"],
224}
225
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400226java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800227 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400228 proto: {
229 type: "stream",
230 },
231 srcs: [":framework-connectivity-protos"],
232 installable: false,
233 sdk_version: "module_current",
234 min_sdk_version: "30",
235 apex_available: [
236 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000237 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000238}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900239
240java_genrule {
241 name: "framework-connectivity-jarjar-rules",
242 tool_files: [
243 ":connectivity-hiddenapi-files",
244 ":framework-connectivity-pre-jarjar{.jar}",
245 ":framework-connectivity-t-pre-jarjar{.jar}",
246 ":framework-connectivity.stubs.module_lib{.jar}",
247 ":framework-connectivity-t.stubs.module_lib{.jar}",
248 "jarjar-excludes.txt",
249 ],
250 tools: [
251 "jarjar-rules-generator",
252 ],
253 out: ["framework_connectivity_jarjar_rules.txt"],
254 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900255 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900256 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
257 "--prefix android.net.connectivity " +
258 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900259 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
260 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
261 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900262 "--excludes $(location jarjar-excludes.txt) " +
263 "--output $(out)",
264 visibility: [
265 "//packages/modules/Connectivity/framework:__subpackages__",
266 "//packages/modules/Connectivity/framework-t:__subpackages__",
267 "//packages/modules/Connectivity/service",
268 ],
269}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800270
271// Library providing limited APIs within the connectivity module, so that R+ components like
272// Tethering have a controlled way to depend on newer components like framework-connectivity that
273// are not loaded on R.
274java_library {
275 name: "connectivity-internal-api-util",
276 sdk_version: "module_current",
277 libs: [
278 "androidx.annotation_annotation",
279 "framework-connectivity.impl",
280 ],
281 jarjar_rules: ":framework-connectivity-jarjar-rules",
282 srcs: [
283 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.TIRAMISU),
284 // so that API checks are enforced for R+ users of this library
285 "src/android/net/connectivity/TiramisuConnectivityInternalApiUtil.java",
286 ],
287 visibility: [
288 "//packages/modules/Connectivity/Tethering:__subpackages__",
289 ],
290}