blob: ab3af9a6be1c73c1b01f38122b7ba21e7b4cd17c [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",
Ken Chen7da858c2023-11-17 12:20:53 +080093 // Not using the latest stable version because all functions in the latest version of
94 // mdns_aidl_interface are deprecated.
95 "mdns_aidl_interface-V1-java",
Xiao Ma0a171c02022-01-23 16:14:51 +000096 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +090097 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090098 "modules-utils-preconditions",
Sandro Montanari9ffc0682024-07-24 15:50:37 +000099 "networksecurity_flags_java_lib",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400100 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +0900101 ],
Junyu Lai29b7b632023-08-23 17:35:17 +0800102 impl_only_static_libs: [
Handa Wang9b0df362024-07-02 13:17:43 +0000103 "net-utils-framework-connectivity",
Junyu Lai29b7b632023-08-23 17:35:17 +0800104 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900105 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +0900106 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200107 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +0800108 "framework-connectivity-t.stubs.module_lib",
Yuyang Huang1cc77692024-11-08 11:51:07 +0900109 "framework-statsd.stubs.module_lib",
Yuyang Huangee0a07c2024-11-25 12:31:48 +0900110 "unsupportedappusage",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900111 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900112 apex_available: [
113 "com.android.tethering",
114 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900115}
116
Motomu Utsumi4d255642024-07-23 16:41:25 +0900117// Library to allow Cronet to use hidden APIs
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900118java_library {
Motomu Utsumi4d255642024-07-23 16:41:25 +0900119 name: "framework-connectivity-pre-jarjar-without-cronet",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900120 defaults: [
121 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700122 ],
123 static_libs: [
Junyu Lai29b7b632023-08-23 17:35:17 +0800124 // Framework-connectivity-pre-jarjar is identical to framework-connectivity
125 // implementation, but without the jarjar rules. However, framework-connectivity
126 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source
127 // to generate the SDK stubs.
128 // Even if the library is included in "impl_only_static_libs" of defaults. This is still
129 // needed because java_library which doesn't understand "impl_only_static_libs".
Handa Wang9b0df362024-07-02 13:17:43 +0000130 "net-utils-framework-connectivity",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700131 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900132 libs: [
133 // This cannot be in the defaults clause above because if it were, it would be used
134 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800135 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900136 // TetheringRequest depends on LinkAddress).
Mark Whitee4d44632023-07-25 23:02:43 +0000137 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800138 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900139 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900140 ],
Motomu Utsumi4d255642024-07-23 16:41:25 +0900141 visibility: ["//external/cronet:__subpackages__"],
142}
143
144java_library {
145 name: "framework-connectivity-pre-jarjar",
146 defaults: ["framework-module-defaults"],
Yan Yanb4ccc6a2024-11-02 01:37:17 +0000147 installable: false,
Motomu Utsumi4d255642024-07-23 16:41:25 +0900148 min_sdk_version: "30",
149 static_libs: [
150 "framework-connectivity-pre-jarjar-without-cronet",
151 "httpclient_api",
152 "httpclient_impl",
153 ],
154 apex_available: [
155 "com.android.tethering",
156 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800157 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900158}
159
Patrick Rohr740b1d42023-05-11 13:28:54 -0700160java_defaults {
161 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000162 srcs: [":httpclient_api_sources"],
Mohannad Farragb09cd9e2025-02-06 15:26:07 +0000163 static_libs: [
164 "com.android.net.http.flags-aconfig-java",
Mohannad Farragb09cd9e2025-02-06 15:26:07 +0000165 ],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700166 libs: [
167 "androidx.annotation_annotation",
168 ],
169 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000170 "httpclient_impl",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700171 ],
172}
173
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900174java_sdk_library {
175 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900176 defaults: [
177 "framework-connectivity-defaults",
178 "CronetJavaDefaults",
179 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900180 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900181 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000182 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900183 impl_library_visibility: [
184 "//packages/modules/Connectivity/Tethering/apex",
185 // In preparation for future move
186 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900187 "//packages/modules/Connectivity/framework-t",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000188 "//packages/modules/Connectivity/remoteauth/service",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900189 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000190 "//packages/modules/Connectivity/service-t",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000191 "//packages/modules/Connectivity/staticlibs",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900192 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000193
194 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800195 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900196 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Yan Yan587f9962024-10-02 22:38:10 +0000197
198 // TODO: b/374174952 Remove it when VCN CTS is moved to Connectivity/
199 "//cts/tests/tests/vcn",
200
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000201 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900202 "//frameworks/base/core/tests/bandwidthtests",
203 "//frameworks/base/core/tests/benchmarks",
204 "//frameworks/base/core/tests/utillib",
Chiachang Wanga5d98752024-02-28 07:50:15 +0000205 "//frameworks/base/services/tests/VpnTests",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800206 "//frameworks/base/tests/vcn",
Xiao Ma0a171c02022-01-23 16:14:51 +0000207 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000208 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800209 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumic4800392023-09-11 11:48:36 +0900210 "//packages/modules/Connectivity/staticlibs/testutils",
211 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900212 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000213 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
214 "//packages/modules/Connectivity/tests:__subpackages__",
Handa Wang806f5a12023-12-04 12:53:39 +0800215 "//packages/modules/Connectivity/thread/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800216 "//packages/modules/IPsec/tests/iketests",
Jihoon Kange7cae172024-09-09 22:52:00 +0000217 "//packages/modules/NetworkStack",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000218 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800219 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900220 ],
Cole Fausta52ecf02023-12-20 11:57:07 -0800221 lint: {
222 baseline_filename: "lint-baseline.xml",
223 },
Motomu Utsumi52f294c2024-02-15 15:21:39 +0900224 aconfig_declarations: [
225 "com.android.net.flags-aconfig",
Mohannad Farrag50231432024-11-22 07:50:30 +0000226 "com.android.net.http.flags-aconfig",
Sandro Montanari9ffc0682024-07-24 15:50:37 +0000227 "com.android.networksecurity.flags-aconfig",
Motomu Utsumi52f294c2024-02-15 15:21:39 +0900228 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000229}
230
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200231platform_compat_config {
232 name: "connectivity-platform-compat-config",
233 src: ":framework-connectivity",
234}
235
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000236cc_library_shared {
237 name: "libframework-connectivity-jni",
238 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000239 cflags: [
240 "-Wall",
241 "-Werror",
242 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000243 // Don't warn about S API usage even with
244 // min_sdk 30: the library is only loaded
245 // on S+ devices
246 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000247 "-Wthread-safety",
248 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000249 srcs: [
250 "jni/android_net_NetworkUtils.cpp",
251 "jni/onload.cpp",
252 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000253 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000254 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000255 "liblog",
256 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000257 ],
258 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000259 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000260 "dnsproxyd_protocol_headers",
261 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000262 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000263 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000264 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000265 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900266}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000267
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800268filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000269 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000270 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800271 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000272 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800273 visibility: ["//frameworks/base"],
274}
275
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400276java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800277 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400278 proto: {
279 type: "stream",
280 },
281 srcs: [":framework-connectivity-protos"],
282 installable: false,
283 sdk_version: "module_current",
284 min_sdk_version: "30",
285 apex_available: [
286 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000287 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000288}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900289
290java_genrule {
291 name: "framework-connectivity-jarjar-rules",
292 tool_files: [
293 ":connectivity-hiddenapi-files",
294 ":framework-connectivity-pre-jarjar{.jar}",
295 ":framework-connectivity-t-pre-jarjar{.jar}",
296 ":framework-connectivity.stubs.module_lib{.jar}",
297 ":framework-connectivity-t.stubs.module_lib{.jar}",
298 "jarjar-excludes.txt",
299 ],
300 tools: [
301 "jarjar-rules-generator",
302 ],
303 out: ["framework_connectivity_jarjar_rules.txt"],
304 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900305 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900306 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
307 "--prefix android.net.connectivity " +
308 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900309 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
310 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
311 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900312 "--excludes $(location jarjar-excludes.txt) " +
313 "--output $(out)",
314 visibility: [
315 "//packages/modules/Connectivity/framework:__subpackages__",
316 "//packages/modules/Connectivity/framework-t:__subpackages__",
317 "//packages/modules/Connectivity/service",
318 ],
319}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800320
321// Library providing limited APIs within the connectivity module, so that R+ components like
322// Tethering have a controlled way to depend on newer components like framework-connectivity that
323// are not loaded on R.
Chalard Jean2fb66f12023-08-25 12:50:37 +0900324// Note that this target needs to have access to hidden classes, and as such needs to list
325// the full libraries instead of the .impl lib (which only expose API classes).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800326java_library {
327 name: "connectivity-internal-api-util",
328 sdk_version: "module_current",
329 libs: [
330 "androidx.annotation_annotation",
Chalard Jean2fb66f12023-08-25 12:50:37 +0900331 "framework-connectivity-pre-jarjar",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800332 ],
333 jarjar_rules: ":framework-connectivity-jarjar-rules",
334 srcs: [
Chalard Jean2fb66f12023-08-25 12:50:37 +0900335 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.S)
336 // or above as appropriate so that API checks are enforced for R+ users of this library
Chalard Jean674f3472023-10-24 20:59:01 +0900337 "src/android/net/connectivity/ConnectivityInternalApiUtil.java",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800338 ],
339 visibility: [
340 "//packages/modules/Connectivity/Tethering:__subpackages__",
341 ],
342}