blob: deea6b6ac935ce55e21ce63686c22f4cbcaaa367 [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",
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.
Mark Whitee4d44632023-07-25 23:02:43 +000084 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -080085 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090086 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090087 ],
Chalard Jeandece0d82021-11-15 18:17:33 +090088 static_libs: [
Junyu Laid0e04942024-07-10 18:10:05 +080089 "com.android.net.flags-aconfig-java",
Ken Chen7da858c2023-11-17 12:20:53 +080090 // Not using the latest stable version because all functions in the latest version of
91 // mdns_aidl_interface are deprecated.
92 "mdns_aidl_interface-V1-java",
Xiao Ma0a171c02022-01-23 16:14:51 +000093 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +090094 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090095 "modules-utils-preconditions",
Vinh Tran6d8c1d72022-06-08 01:25:14 -040096 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +090097 ],
Junyu Lai29b7b632023-08-23 17:35:17 +080098 impl_only_static_libs: [
Handa Wang9b0df362024-07-02 13:17:43 +000099 "net-utils-framework-connectivity",
Junyu Lai29b7b632023-08-23 17:35:17 +0800100 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900101 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +0900102 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200103 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +0800104 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900105 "unsupportedappusage",
106 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900107 apex_available: [
108 "com.android.tethering",
109 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900110}
111
Motomu Utsumi4d255642024-07-23 16:41:25 +0900112// Library to allow Cronet to use hidden APIs
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900113java_library {
Motomu Utsumi4d255642024-07-23 16:41:25 +0900114 name: "framework-connectivity-pre-jarjar-without-cronet",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900115 defaults: [
116 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700117 ],
118 static_libs: [
Junyu Lai29b7b632023-08-23 17:35:17 +0800119 // Framework-connectivity-pre-jarjar is identical to framework-connectivity
120 // implementation, but without the jarjar rules. However, framework-connectivity
121 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source
122 // to generate the SDK stubs.
123 // Even if the library is included in "impl_only_static_libs" of defaults. This is still
124 // needed because java_library which doesn't understand "impl_only_static_libs".
Handa Wang9b0df362024-07-02 13:17:43 +0000125 "net-utils-framework-connectivity",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700126 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900127 libs: [
128 // This cannot be in the defaults clause above because if it were, it would be used
129 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800130 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900131 // TetheringRequest depends on LinkAddress).
Mark Whitee4d44632023-07-25 23:02:43 +0000132 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800133 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900134 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900135 ],
Motomu Utsumi4d255642024-07-23 16:41:25 +0900136 visibility: ["//external/cronet:__subpackages__"],
137}
138
139java_library {
140 name: "framework-connectivity-pre-jarjar",
141 defaults: ["framework-module-defaults"],
142 min_sdk_version: "30",
143 static_libs: [
144 "framework-connectivity-pre-jarjar-without-cronet",
145 "httpclient_api",
146 "httpclient_impl",
147 ],
148 apex_available: [
149 "com.android.tethering",
150 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800151 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900152}
153
Patrick Rohr740b1d42023-05-11 13:28:54 -0700154java_defaults {
155 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000156 srcs: [":httpclient_api_sources"],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700157 libs: [
158 "androidx.annotation_annotation",
159 ],
160 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000161 "httpclient_impl",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700162 ],
163}
164
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900165java_sdk_library {
166 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900167 defaults: [
168 "framework-connectivity-defaults",
169 "CronetJavaDefaults",
170 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900171 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900172 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000173 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900174 impl_library_visibility: [
175 "//packages/modules/Connectivity/Tethering/apex",
176 // In preparation for future move
177 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900178 "//packages/modules/Connectivity/framework-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900179 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000180 "//packages/modules/Connectivity/service-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900181 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000182
183 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800184 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900185 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000186 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900187 "//frameworks/base/core/tests/bandwidthtests",
188 "//frameworks/base/core/tests/benchmarks",
189 "//frameworks/base/core/tests/utillib",
Chiachang Wanga5d98752024-02-28 07:50:15 +0000190 "//frameworks/base/services/tests/VpnTests",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800191 "//frameworks/base/tests/vcn",
Xiao Ma0a171c02022-01-23 16:14:51 +0000192 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000193 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800194 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumic4800392023-09-11 11:48:36 +0900195 "//packages/modules/Connectivity/staticlibs/testutils",
196 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900197 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000198 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
199 "//packages/modules/Connectivity/tests:__subpackages__",
Handa Wang806f5a12023-12-04 12:53:39 +0800200 "//packages/modules/Connectivity/thread/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800201 "//packages/modules/IPsec/tests/iketests",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000202 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800203 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900204 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800205 lint: {
206 baseline_filename: "lint-baseline.xml",
207 },
Motomu Utsumi52f294c2024-02-15 15:21:39 +0900208 aconfig_declarations: [
209 "com.android.net.flags-aconfig",
210 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000211}
212
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200213platform_compat_config {
214 name: "connectivity-platform-compat-config",
215 src: ":framework-connectivity",
216}
217
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000218cc_library_shared {
219 name: "libframework-connectivity-jni",
220 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000221 cflags: [
222 "-Wall",
223 "-Werror",
224 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000225 // Don't warn about S API usage even with
226 // min_sdk 30: the library is only loaded
227 // on S+ devices
228 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000229 "-Wthread-safety",
230 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000231 srcs: [
232 "jni/android_net_NetworkUtils.cpp",
233 "jni/onload.cpp",
234 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000235 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000236 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000237 "liblog",
238 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000239 ],
240 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000241 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000242 "dnsproxyd_protocol_headers",
243 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000244 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000245 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000246 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000247 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900248}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000249
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800250filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000251 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000252 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800253 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000254 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800255 visibility: ["//frameworks/base"],
256}
257
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400258java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800259 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400260 proto: {
261 type: "stream",
262 },
263 srcs: [":framework-connectivity-protos"],
264 installable: false,
265 sdk_version: "module_current",
266 min_sdk_version: "30",
267 apex_available: [
268 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000269 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000270}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900271
272java_genrule {
273 name: "framework-connectivity-jarjar-rules",
274 tool_files: [
275 ":connectivity-hiddenapi-files",
276 ":framework-connectivity-pre-jarjar{.jar}",
277 ":framework-connectivity-t-pre-jarjar{.jar}",
278 ":framework-connectivity.stubs.module_lib{.jar}",
279 ":framework-connectivity-t.stubs.module_lib{.jar}",
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900280 ":framework-connectivity-module-api-stubs-including-flagged{.jar}",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900281 "jarjar-excludes.txt",
282 ],
283 tools: [
284 "jarjar-rules-generator",
285 ],
286 out: ["framework_connectivity_jarjar_rules.txt"],
287 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900288 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900289 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
290 "--prefix android.net.connectivity " +
291 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900292 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900293 "--apistubs $(location :framework-connectivity-module-api-stubs-including-flagged{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900294 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
295 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900296 "--excludes $(location jarjar-excludes.txt) " +
297 "--output $(out)",
298 visibility: [
299 "//packages/modules/Connectivity/framework:__subpackages__",
300 "//packages/modules/Connectivity/framework-t:__subpackages__",
301 "//packages/modules/Connectivity/service",
302 ],
303}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800304
Motomu Utsumiada9e982023-11-06 22:49:25 +0900305droidstubs {
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900306 name: "framework-connectivity-module-api-stubs-including-flagged-droidstubs",
Motomu Utsumiada9e982023-11-06 22:49:25 +0900307 srcs: [
308 ":framework-connectivity-sources",
309 ":framework-connectivity-tiramisu-updatable-sources",
310 ":framework-nearby-java-sources",
311 ":framework-thread-sources",
312 ],
313 flags: [
Motomu Utsumi2f2aa212023-11-09 16:34:07 +0900314 "--show-for-stub-purposes-annotation android.annotation.SystemApi" +
Cole Fausta52ecf02023-12-20 11:57:07 -0800315 "\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)",
Motomu Utsumi2f2aa212023-11-09 16:34:07 +0900316 "--show-for-stub-purposes-annotation android.annotation.SystemApi" +
Cole Fausta52ecf02023-12-20 11:57:07 -0800317 "\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)",
Motomu Utsumiada9e982023-11-06 22:49:25 +0900318 ],
319 aidl: {
320 include_dirs: [
321 "packages/modules/Connectivity/framework/aidl-export",
322 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
323 ],
324 },
325}
326
327java_library {
Motomu Utsumiba5dde82023-11-22 16:24:32 +0900328 name: "framework-connectivity-module-api-stubs-including-flagged",
329 srcs: [":framework-connectivity-module-api-stubs-including-flagged-droidstubs"],
Motomu Utsumiada9e982023-11-06 22:49:25 +0900330}
331
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800332// Library providing limited APIs within the connectivity module, so that R+ components like
333// Tethering have a controlled way to depend on newer components like framework-connectivity that
334// are not loaded on R.
Chalard Jean2fb66f12023-08-25 12:50:37 +0900335// Note that this target needs to have access to hidden classes, and as such needs to list
336// the full libraries instead of the .impl lib (which only expose API classes).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800337java_library {
338 name: "connectivity-internal-api-util",
339 sdk_version: "module_current",
340 libs: [
341 "androidx.annotation_annotation",
Chalard Jean2fb66f12023-08-25 12:50:37 +0900342 "framework-connectivity-pre-jarjar",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800343 ],
344 jarjar_rules: ":framework-connectivity-jarjar-rules",
345 srcs: [
Chalard Jean2fb66f12023-08-25 12:50:37 +0900346 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.S)
347 // or above as appropriate so that API checks are enforced for R+ users of this library
Chalard Jean674f3472023-10-24 20:59:01 +0900348 "src/android/net/connectivity/ConnectivityInternalApiUtil.java",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800349 ],
350 visibility: [
351 "//packages/modules/Connectivity/Tethering:__subpackages__",
352 ],
353}