blob: b064723bbc083fa6c740a1e0c3e33d521305a2ac [file] [log] [blame]
Aaron Huangf73ff8c2019-12-06 18:12:24 +08001// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Aaron Huang57a94962020-01-03 20:35:55 +080015// 1. The "net-utils-framework-common" library is also compiled into the framework and placed on the
16// boot classpath. It uses jarjar rules so that anything outside the framework can use this
17// library directly.
18// 2. The "net-utils-services-common" library is for use by modules and frameworks/base/services.
19// It does not need to be jarjared because it is not placed on the bootclasspath.
Lorenzo Colittie14bd342020-01-14 14:47:16 +090020// 3. The "net-utils-telephony-common-srcs" filegroup is for use specifically by telephony, which
21// places many of its classes, even non-API service classes, on the boot classpath. Any file that
22// is added to this filegroup *must* have a corresponding jarjar rule in the telephony jarjar
23// rules file. Otherwise, it will end up on the boot classpath and other modules will not be able
24// to provide their own copy.
Aaron Huangf73ff8c2019-12-06 18:12:24 +080025
Adrian Roos0607dd92020-03-27 00:30:41 +010026// Note: all filegroups here must have the right path attribute because otherwise, if they are
27// included in the bootclasspath, they could incorrectly be included in the SDK documentation even
28// though they are not in the current.txt files.
29
Bob Badour1b8c7442021-02-12 15:39:10 -080030package {
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000031 default_team: "trendy_team_fwk_core_networking",
Bob Badour1b8c7442021-02-12 15:39:10 -080032 default_applicable_licenses: ["Android-Apache-2.0"],
33}
34
Paul Hu8c8d2b12024-10-15 15:59:31 +000035// This library shouldn't be used anymore (no class should be added), and per-user libraries like
36// net-utils-service-connectivity or net-utils-framework-wifi should be used instead.
Chalard Jean48c6c7d2020-06-25 23:39:15 +090037java_library {
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000038 name: "net-utils-device-common",
39 srcs: [
40 "device/com/android/net/module/util/arp/ArpPacket.java",
41 "device/com/android/net/module/util/DeviceConfigUtils.java",
42 "device/com/android/net/module/util/DomainUtils.java",
43 "device/com/android/net/module/util/FdEventsReader.java",
Patrick Rohraa06b2b2024-06-17 14:18:36 -070044 "device/com/android/net/module/util/FeatureVersions.java",
45 "device/com/android/net/module/util/HandlerUtils.java",
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000046 "device/com/android/net/module/util/NetworkMonitorUtils.java",
47 "device/com/android/net/module/util/PacketReader.java",
48 "device/com/android/net/module/util/SharedLog.java",
49 "device/com/android/net/module/util/SocketUtils.java",
Patrick Rohraa06b2b2024-06-17 14:18:36 -070050 "device/com/android/net/module/util/SyncStateMachine.java",
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000051 // This library is used by system modules, for which the system health impact of Kotlin
52 // has not yet been evaluated. Annotations may need jarjar'ing.
53 // "src_devicecommon/**/*.kt",
54 ],
55 sdk_version: "module_current",
56 min_sdk_version: "30",
57 target_sdk_version: "30",
58 apex_available: [
59 "//apex_available:anyapex",
60 "//apex_available:platform",
61 ],
62 visibility: [
Baligh Uddinf8c12822021-05-21 04:26:52 +000063 "//packages/modules/Connectivity:__subpackages__",
64 "//packages/modules/Connectivity/framework:__subpackages__",
Xiao Ma6f95cef2020-09-08 19:16:15 +090065 "//packages/modules/NetworkStack:__subpackages__",
Chalard Jean48c6c7d2020-06-25 23:39:15 +090066 "//packages/modules/CaptivePortalLogin",
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000067 ],
68 static_libs: [
Patrick Rohraa06b2b2024-06-17 14:18:36 -070069 "modules-utils-statemachine",
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000070 "net-utils-framework-common",
71 ],
72 libs: [
73 "androidx.annotation_annotation",
74 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +000075 "framework-configinfrastructure.stubs.module_lib",
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000076 "framework-connectivity.stubs.module_lib",
77 ],
78 lint: {
79 strict_updatability_linting: true,
80 error_checks: ["NewApi"],
81 },
Chalard Jean48c6c7d2020-06-25 23:39:15 +090082}
83
Aswin Sankar601d6f92021-10-11 13:12:16 -070084java_library {
85 name: "net-utils-dnspacket-common",
86 srcs: [
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000087 "framework/**/DnsPacket.java",
88 "framework/**/DnsPacketUtils.java",
89 "framework/**/DnsSvcbPacket.java",
90 "framework/**/DnsSvcbRecord.java",
91 "framework/**/HexDump.java",
92 "framework/**/NetworkStackConstants.java",
Aswin Sankar601d6f92021-10-11 13:12:16 -070093 ],
94 sdk_version: "module_current",
95 visibility: [
96 "//packages/services/Iwlan:__subpackages__",
97 ],
Junyu Lai85e24e82022-09-15 07:34:51 +000098 libs: [
Mike Yu9b96c832023-09-18 08:26:08 +000099 "androidx.annotation_annotation",
Junyu Lai85e24e82022-09-15 07:34:51 +0000100 "framework-annotations-lib",
101 "framework-connectivity.stubs.module_lib",
102 ],
Aswin Sankar601d6f92021-10-11 13:12:16 -0700103}
104
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800105filegroup {
106 name: "net-utils-framework-common-srcs",
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900107 srcs: ["framework/**/*.java"],
108 path: "framework",
Remi NGUYEN VAN651faf72021-03-24 22:40:37 +0900109 visibility: [
110 "//frameworks/base",
Baligh Uddin27e5fcd2021-05-22 13:16:30 +0000111 "//packages/modules/Connectivity:__subpackages__",
Remi NGUYEN VAN651faf72021-03-24 22:40:37 +0900112 ],
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800113}
114
Yang Sun3aa62e62024-03-12 21:23:19 +0800115// The net-utils-device-common-bpf library requires the callers to contain
116// net-utils-device-common-struct-base.
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800117java_library {
markchienf3448f92021-11-10 01:06:51 +0800118 name: "net-utils-device-common-bpf",
Xiao Ma57b34422021-07-01 13:57:02 +0000119 srcs: [
Tyler Wear92f3c242022-02-15 15:21:43 -0800120 "device/com/android/net/module/util/BpfBitmap.java",
Hungming Chenb3e71a22022-06-23 21:34:54 +0800121 "device/com/android/net/module/util/BpfDump.java",
Tyler Wearaafd9c12021-10-19 11:01:46 -0700122 "device/com/android/net/module/util/BpfMap.java",
Tyler Weare48ee4a2022-02-15 15:30:50 -0800123 "device/com/android/net/module/util/BpfUtils.java",
markchien2e5fece2022-01-21 10:16:54 +0800124 "device/com/android/net/module/util/IBpfMap.java",
markchienf3448f92021-11-10 01:06:51 +0800125 "device/com/android/net/module/util/JniUtil.java",
Lorenzo Colitti05be2f52024-06-02 13:24:21 +0900126 "device/com/android/net/module/util/SingleWriterBpfMap.java",
Patrick Rohr29b0d952022-01-12 21:42:24 +0100127 "device/com/android/net/module/util/TcUtils.java",
markchienf3448f92021-11-10 01:06:51 +0800128 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900129 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000130 min_sdk_version: "30",
markchienf3448f92021-11-10 01:06:51 +0800131 visibility: [
markchienf3448f92021-11-10 01:06:51 +0800132 "//packages/modules/Connectivity:__subpackages__",
133 "//packages/modules/NetworkStack:__subpackages__",
134 ],
markchienf3448f92021-11-10 01:06:51 +0800135 libs: [
136 "androidx.annotation_annotation",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900137 "framework-connectivity.stubs.module_lib",
Yang Sun3aa62e62024-03-12 21:23:19 +0800138 "net-utils-device-common-struct-base",
markchienf3448f92021-11-10 01:06:51 +0800139 ],
140 apex_available: [
141 "com.android.tethering",
142 "//apex_available:platform",
143 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900144 lint: {
145 strict_updatability_linting: true,
146 error_checks: ["NewApi"],
147 },
markchienf3448f92021-11-10 01:06:51 +0800148}
149
150java_library {
Yang Sun3aa62e62024-03-12 21:23:19 +0800151 name: "net-utils-device-common-struct-base",
markchienf3448f92021-11-10 01:06:51 +0800152 srcs: [
Xiao Ma57b34422021-07-01 13:57:02 +0000153 "device/com/android/net/module/util/Struct.java",
Xiao Ma57b34422021-07-01 13:57:02 +0000154 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900155 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000156 min_sdk_version: "30",
Xiao Ma57b34422021-07-01 13:57:02 +0000157 visibility: [
Xiao Ma57b34422021-07-01 13:57:02 +0000158 "//packages/modules/Connectivity:__subpackages__",
159 "//packages/modules/NetworkStack:__subpackages__",
160 ],
161 static_libs: [
162 "net-utils-framework-common",
163 ],
164 libs: [
165 "androidx.annotation_annotation",
Yang Sun3aa62e62024-03-12 21:23:19 +0800166 "framework-annotations-lib", // Required by InetAddressUtils.java
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900167 "framework-connectivity.stubs.module_lib",
Xiao Ma57b34422021-07-01 13:57:02 +0000168 ],
169 apex_available: [
170 "com.android.tethering",
171 "//apex_available:platform",
172 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900173 lint: {
174 strict_updatability_linting: true,
175 error_checks: ["NewApi"],
176 },
Xiao Ma57b34422021-07-01 13:57:02 +0000177}
178
Yang Sun3aa62e62024-03-12 21:23:19 +0800179// The net-utils-device-common-struct library requires the callers to contain
180// net-utils-device-common-struct-base.
Yang Sun1c9fb592024-02-19 10:37:26 +0800181java_library {
Yang Sun3aa62e62024-03-12 21:23:19 +0800182 name: "net-utils-device-common-struct",
Yang Sun1c9fb592024-02-19 10:37:26 +0800183 srcs: [
Yang Sun3aa62e62024-03-12 21:23:19 +0800184 "device/com/android/net/module/util/Ipv6Utils.java",
185 "device/com/android/net/module/util/PacketBuilder.java",
186 "device/com/android/net/module/util/structs/*.java",
Yang Sun1c9fb592024-02-19 10:37:26 +0800187 ],
188 sdk_version: "module_current",
189 min_sdk_version: "30",
190 visibility: [
191 "//packages/modules/Connectivity:__subpackages__",
Yang Sun3aa62e62024-03-12 21:23:19 +0800192 "//packages/modules/NetworkStack:__subpackages__",
Yang Sun1c9fb592024-02-19 10:37:26 +0800193 ],
194 libs: [
Yang Sun3aa62e62024-03-12 21:23:19 +0800195 "androidx.annotation_annotation",
196 "framework-annotations-lib", // Required by IpUtils.java
197 "framework-connectivity.stubs.module_lib",
198 "net-utils-device-common-struct-base",
Yang Sun1c9fb592024-02-19 10:37:26 +0800199 ],
200 apex_available: [
201 "com.android.tethering",
Yang Sun3aa62e62024-03-12 21:23:19 +0800202 "//apex_available:platform",
Yang Sun1c9fb592024-02-19 10:37:26 +0800203 ],
204 lint: {
205 strict_updatability_linting: true,
206 error_checks: ["NewApi"],
207 },
208}
209
Junyu Lai626045a2023-08-28 18:49:44 +0800210// The net-utils-device-common-netlink library requires the callers to contain
Yang Sun3aa62e62024-03-12 21:23:19 +0800211// net-utils-device-common-struct and net-utils-device-common-struct-base.
Xiao Ma57b34422021-07-01 13:57:02 +0000212java_library {
markchienf3448f92021-11-10 01:06:51 +0800213 name: "net-utils-device-common-netlink",
214 srcs: [
Yan Yanf085fad2023-11-20 18:51:30 +0000215 "device/com/android/net/module/util/netlink/**/*.java",
markchienf3448f92021-11-10 01:06:51 +0800216 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900217 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000218 min_sdk_version: "30",
markchienf3448f92021-11-10 01:06:51 +0800219 visibility: [
markchienf3448f92021-11-10 01:06:51 +0800220 "//packages/modules/Connectivity:__subpackages__",
221 "//packages/modules/NetworkStack:__subpackages__",
222 ],
markchienf3448f92021-11-10 01:06:51 +0800223 libs: [
224 "androidx.annotation_annotation",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900225 "framework-connectivity.stubs.module_lib",
Junyu Lai626045a2023-08-28 18:49:44 +0800226 // For libraries which are statically linked in framework-connectivity, do not
227 // statically link here because callers of this library might already have a static
228 // version linked.
229 "net-utils-device-common-struct",
Yang Sun3aa62e62024-03-12 21:23:19 +0800230 "net-utils-device-common-struct-base",
markchienf3448f92021-11-10 01:06:51 +0800231 ],
232 apex_available: [
233 "com.android.tethering",
234 "//apex_available:platform",
235 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900236 lint: {
237 strict_updatability_linting: true,
238 error_checks: ["NewApi"],
239 },
markchienf3448f92021-11-10 01:06:51 +0800240}
241
Junyu Lai626045a2023-08-28 18:49:44 +0800242// The net-utils-device-common-ip library requires the callers to contain
Yang Sun3aa62e62024-03-12 21:23:19 +0800243// net-utils-device-common-struct and net-utils-device-common-struct-base.
markchienf3448f92021-11-10 01:06:51 +0800244java_library {
Chalard Jeanb61091b2021-10-07 15:29:13 +0900245 // TODO : this target should probably be folded into net-utils-device-common
246 name: "net-utils-device-common-ip",
247 srcs: [
248 "device/com/android/net/module/util/ip/*.java",
249 ],
250 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000251 min_sdk_version: "30",
Chalard Jeanb61091b2021-10-07 15:29:13 +0900252 visibility: [
Chalard Jeanb61091b2021-10-07 15:29:13 +0900253 "//packages/modules/Connectivity:__subpackages__",
254 "//packages/modules/NetworkStack:__subpackages__",
255 ],
256 libs: [
257 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000258 "framework-connectivity.stubs.module_lib",
Chalard Jeanb61091b2021-10-07 15:29:13 +0900259 ],
260 static_libs: [
261 "net-utils-device-common",
262 "net-utils-device-common-netlink",
263 "net-utils-framework-common",
264 "netd-client",
265 ],
266 apex_available: [
267 "com.android.tethering",
268 "//apex_available:platform",
269 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900270 lint: {
Motomu Utsumia1a00342024-06-13 09:29:47 +0000271 strict_updatability_linting: true,
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900272 error_checks: ["NewApi"],
273 },
Chalard Jeanb61091b2021-10-07 15:29:13 +0900274}
275
276java_library {
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800277 name: "net-utils-framework-common",
Remi NGUYEN VANce241a32020-01-14 21:42:09 +0900278 srcs: [
279 ":net-utils-framework-common-srcs",
Remi NGUYEN VANce241a32020-01-14 21:42:09 +0900280 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900281 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000282 min_sdk_version: "30",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900283 libs: [
Jooyung Hanb3b67982022-06-24 14:56:24 +0900284 "androidx.annotation_annotation",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900285 "framework-annotations-lib",
286 "framework-connectivity.stubs.module_lib",
paulhucdb069e2022-02-14 15:28:50 +0800287 "framework-connectivity-t.stubs.module_lib",
Mark White66d39cd2023-08-07 15:20:07 +0000288 "framework-location.stubs.module_lib",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900289 ],
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800290 jarjar_rules: "jarjar-rules-shared.txt",
291 visibility: [
Luke Huangfd5479e2020-06-20 11:38:17 +0800292 "//cts/tests/tests/net",
Chalard Jeanceaf7d02020-06-26 18:34:52 +0900293 "//cts/tests/tests/wifi",
Baligh Uddine685c812020-10-31 04:28:58 +0000294 "//packages/modules/Connectivity/tests/cts/net",
Baligh Uddinae4770d2020-10-29 02:12:06 +0000295 "//packages/modules/Connectivity/Tethering",
Chalard Jeana9f49912020-10-15 18:06:30 +0900296 "//frameworks/base/tests:__subpackages__",
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800297 "//frameworks/opt/net/ike",
298 "//frameworks/opt/telephony",
Chalard Jean19789192020-10-01 12:45:31 +0900299 "//frameworks/base/wifi:__subpackages__",
Remi NGUYEN VAN38afb0c2020-11-10 18:04:27 +0900300 "//packages/modules/Connectivity:__subpackages__",
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900301 "//packages/modules/NetworkStack:__subpackages__",
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800302 "//packages/modules/CaptivePortalLogin",
Baligh Uddinfcbda3a2020-12-24 06:12:25 +0000303 "//packages/modules/Wifi/framework/tests:__subpackages__",
Junyu Laib24df142022-01-10 10:31:11 +0000304 "//packages/apps/Settings",
Chalard Jean7592a342021-04-19 18:04:34 +0900305 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900306 lint: {
307 strict_updatability_linting: true,
308 error_checks: ["NewApi"],
309 },
Paul Hu8d47d842023-03-31 14:59:49 +0800310 errorprone: {
311 enabled: true,
312 // Error-prone checking only warns of problems when building. To make the build fail with
313 // these errors, list the specific error-prone problems below.
314 javacflags: [
315 "-Xep:NullablePrimitive:ERROR",
316 ],
317 },
Spandan Das2b83e772023-12-21 20:46:31 +0000318 apex_available: [
319 "//apex_available:platform",
320 "com.android.tethering",
321 ],
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800322}
Anton Hansson0ceeb7c2022-05-30 12:01:49 +0000323
324java_library {
325 name: "net-utils-services-common",
David Su2dbab642020-10-26 14:51:01 -0700326 srcs: [
327 "device/android/net/NetworkFactory.java",
Chalard Jean7592a342021-04-19 18:04:34 +0900328 "device/android/net/NetworkFactoryImpl.java",
329 "device/android/net/NetworkFactoryLegacyImpl.java",
330 "device/android/net/NetworkFactoryShim.java",
David Su2dbab642020-10-26 14:51:01 -0700331 ],
Chalard Jeand5802422021-10-27 19:02:14 +0900332 sdk_version: "module_current",
David Sudc0a5682021-01-29 04:42:27 +0000333 min_sdk_version: "30",
Chalard Jeand5802422021-10-27 19:02:14 +0900334 libs: [
335 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000336 "framework-connectivity.stubs.module_lib",
William Escande51c0be52024-07-10 14:26:50 -0700337 "modules-utils-build_system",
Chalard Jeand5802422021-10-27 19:02:14 +0900338 ],
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000339 // TODO: remove "apex_available:platform".
340 apex_available: [
341 "//apex_available:platform",
William Escandeb82afa32025-01-09 12:25:16 -0800342 "com.android.bt",
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000343 "com.android.tethering",
Anton Hansson0ceeb7c2022-05-30 12:01:49 +0000344 "com.android.wifi",
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000345 ],
Aaron Huang57a94962020-01-03 20:35:55 +0800346 visibility: [
markchien32a6e9c2022-01-20 14:34:15 +0800347 // TODO: remove after NetworkStatsService moves to the module.
Remi NGUYEN VAN376f8d42020-01-15 18:26:29 +0900348 "//frameworks/base/services/net",
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000349 "//packages/modules/Connectivity/service",
Remi NGUYEN VAN0cf724a2021-11-19 18:33:12 +0900350 "//packages/modules/Connectivity/tests:__subpackages__",
Roopa Sattiraju98fa3bf2022-02-03 18:53:23 -0800351 "//packages/modules/Bluetooth/android/app",
Nate(Qiang) Jiangce723aa2022-06-01 21:28:32 +0000352 "//packages/modules/Wifi/service:__subpackages__",
Aaron Huang57a94962020-01-03 20:35:55 +0800353 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900354 lint: {
355 strict_updatability_linting: true,
356 error_checks: ["NewApi"],
357 },
Aaron Huang57a94962020-01-03 20:35:55 +0800358}
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900359
Igor Chernysheva25f1092022-12-20 00:07:38 -0800360java_library {
361 name: "net-utils-device-common-async",
362 srcs: [
363 "device/com/android/net/module/util/async/*.java",
364 ],
365 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000366 min_sdk_version: "30",
Igor Chernysheva25f1092022-12-20 00:07:38 -0800367 visibility: [
Igor Chernysheva25f1092022-12-20 00:07:38 -0800368 "//packages/modules/Connectivity:__subpackages__",
369 ],
370 libs: [
371 "framework-annotations-lib",
372 ],
373 static_libs: [
374 ],
375 apex_available: [
376 "com.android.tethering",
377 "//apex_available:platform",
378 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900379 lint: {
380 strict_updatability_linting: true,
381 error_checks: ["NewApi"],
382 },
Igor Chernysheva25f1092022-12-20 00:07:38 -0800383}
384
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700385java_library {
386 name: "net-utils-device-common-wear",
387 srcs: [
388 "device/com/android/net/module/util/wear/*.java",
389 ],
390 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000391 min_sdk_version: "30",
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700392 visibility: [
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700393 "//packages/modules/Connectivity:__subpackages__",
394 ],
395 libs: [
396 "framework-annotations-lib",
397 ],
398 static_libs: [
399 "net-utils-device-common-async",
400 ],
401 apex_available: [
402 "com.android.tethering",
403 "//apex_available:platform",
404 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900405 lint: {
406 strict_updatability_linting: true,
407 error_checks: ["NewApi"],
408 },
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700409}
410
Yuyang Huangf67388b2023-03-29 16:51:09 +0900411// Limited set of utilities for use by service-connectivity-mdns-standalone-build-test, to make sure
412// the mDNS code can build with only system APIs.
413// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that
414// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build
415// rule verifies that the mDNS code can be built into apps, if code transformations are applied to
416// the annotations.
417// When using "system_current", framework annotations are not available; they would appear as
418// package-private as they are marked as such in the system_current stubs. So build against
419// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7.
420java_library {
421 name: "net-utils-device-common-mdns-standalone-build-test",
422 // Build against core_platform and add the stub libraries manually in "libs", as annotations
423 // are already included in android_system_stubs_current but package-private, so
424 // "framework-annotations-lib" needs to be manually included before
425 // "android_system_stubs_current" (b/272392042)
426 sdk_version: "core_platform",
427 srcs: [
428 "device/com/android/net/module/util/FdEventsReader.java",
Paul Hu78713202024-08-01 15:12:10 +0000429 "device/com/android/net/module/util/HandlerUtils.java",
Paul Hua3a34052025-01-01 18:56:45 -0800430 "device/com/android/net/module/util/JniUtil.java",
431 "device/com/android/net/module/util/RealtimeScheduler.java",
Yuyang Huangf67388b2023-03-29 16:51:09 +0900432 "device/com/android/net/module/util/SharedLog.java",
Paul Hua3a34052025-01-01 18:56:45 -0800433 "device/com/android/net/module/util/ServiceConnectivityJni.java",
434 "device/com/android/net/module/util/TimerFdUtils.java",
Yuyang Huangf67388b2023-03-29 16:51:09 +0900435 "framework/com/android/net/module/util/ByteUtils.java",
436 "framework/com/android/net/module/util/CollectionUtils.java",
Yuyang Huangd851a042024-07-16 18:48:43 +0900437 "framework/com/android/net/module/util/DnsUtils.java",
Yuyang Huange4eb87a2023-05-02 18:44:51 +0900438 "framework/com/android/net/module/util/HexDump.java",
Yuyang Huangf67388b2023-03-29 16:51:09 +0900439 "framework/com/android/net/module/util/LinkPropertiesUtils.java",
440 ],
441 libs: [
442 "framework-annotations-lib",
443 "android_system_stubs_current",
444 "androidx.annotation_annotation",
445 ],
446 visibility: ["//packages/modules/Connectivity/service-t"],
447}
448
Handa Wang8be10bf2024-08-08 15:36:48 +0000449// net-utils-framework-connectivity is only for framework-connectivity.
Handa Wang9b0df362024-07-02 13:17:43 +0000450java_library {
451 name: "net-utils-framework-connectivity",
452 srcs: [
453 ":net-utils-framework-connectivity-srcs",
454 ],
455 sdk_version: "module_current",
456 min_sdk_version: "30",
457 apex_available: [
458 "com.android.tethering",
459 "//apex_available:platform",
460 ],
461 visibility: [
Handa Wang8be10bf2024-08-08 15:36:48 +0000462 "//packages/modules/Connectivity/framework",
Handa Wang9b0df362024-07-02 13:17:43 +0000463 ],
464 libs: [
465 "androidx.annotation_annotation",
466 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000467 "framework-configinfrastructure.stubs.module_lib",
Handa Wang9b0df362024-07-02 13:17:43 +0000468 "framework-connectivity.stubs.module_lib",
469 ],
470 lint: {
471 strict_updatability_linting: true,
472 error_checks: ["NewApi"],
473 },
474}
475
476java_defaults {
477 name: "net-utils-non-bootclasspath-defaults",
478 sdk_version: "module_current",
479 min_sdk_version: "30",
Handa Wang9b0df362024-07-02 13:17:43 +0000480 libs: [
481 "androidx.annotation_annotation",
482 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000483 "framework-configinfrastructure.stubs.module_lib",
Handa Wang9b0df362024-07-02 13:17:43 +0000484 "framework-connectivity.stubs.module_lib",
485 "framework-connectivity-t.stubs.module_lib",
486 "framework-location.stubs.module_lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000487 "framework-tethering.stubs.module_lib",
Handa Wang9b0df362024-07-02 13:17:43 +0000488 "unsupportedappusage",
489 ],
490 static_libs: [
491 "modules-utils-build_system",
492 "modules-utils-statemachine",
493 "net-utils-non-bootclasspath-aidl-java",
494 "netd-client",
495 ],
496 apex_available: [
497 "com.android.tethering",
498 "//apex_available:platform",
499 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000500 defaults_visibility: [
501 "//visibility:private",
502 ],
503 lint: {
504 strict_updatability_linting: true,
505 error_checks: ["NewApi"],
506 },
507}
508
Handa Wang8be10bf2024-08-08 15:36:48 +0000509// net-utils-service-connectivity is only for service-connectivity.
Handa Wang9b0df362024-07-02 13:17:43 +0000510java_library {
511 name: "net-utils-service-connectivity",
512 srcs: [
513 ":net-utils-all-srcs",
514 ],
515 exclude_srcs: [
516 ":net-utils-framework-connectivity-srcs",
517 ],
518 libs: [
519 "net-utils-framework-connectivity",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000520 "framework-connectivity.impl",
521 "framework-tethering.impl",
Handa Wang9b0df362024-07-02 13:17:43 +0000522 ],
523 defaults: ["net-utils-non-bootclasspath-defaults"],
Nate Jiang5f0471c2024-07-12 16:49:52 +0000524 jarjar_rules: "jarjar-rules-shared.txt",
Handa Wang8be10bf2024-08-08 15:36:48 +0000525 visibility: [
526 "//packages/modules/Connectivity/service",
527 "//packages/modules/Connectivity/staticlibs/tests/unit",
528 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000529}
530
Remi NGUYEN VAN514f40b2024-08-15 08:07:02 +0000531// net-utils-connectivity-apks is only for NetworkStack, CaptivePortalLogin and
532// Tethering.apk
533// It includes all the static libraries in this directory, which is safe because
534// these APKs use R8 to strip out unused code, and they do not depend on
535// bootclasspath jars that may have duplicate copies of the included classes
536// with the same jarjaring.
537// Tethering.apk does depend on a bootclasspath jar (framework-tethering.jar),
538// however it does not use any of the static libraries. If it did, Tethering.apk
539// would need to use another variant that excludes classes that are already
540// included in framework-tethering.jar (similarly to how framework-connectivity
541// and service-connectivity do it). Otherwise, static libs included in
542// framework-tethering and Tethering.apk and jarjared the same way would
543// conflict.
Handa Wang9b0df362024-07-02 13:17:43 +0000544java_library {
Xiao Ma6793fd02024-07-26 13:07:50 +0900545 name: "net-utils-connectivity-apks",
Handa Wang9b0df362024-07-02 13:17:43 +0000546 srcs: [
547 ":net-utils-all-srcs",
548 ":framework-connectivity-shared-srcs",
549 ],
550 defaults: ["net-utils-non-bootclasspath-defaults"],
Nate Jiang5f0471c2024-07-12 16:49:52 +0000551 jarjar_rules: "jarjar-rules-shared.txt",
Handa Wang8be10bf2024-08-08 15:36:48 +0000552 visibility: [
553 "//packages/modules/CaptivePortalLogin:__subpackages__",
554 "//packages/modules/Connectivity/Tethering",
555 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000556}
557
558aidl_interface {
559 name: "net-utils-non-bootclasspath-aidl",
560 srcs: [
561 ":net-utils-aidl-srcs",
562 ],
563 unstable: true,
564 backend: {
565 java: {
566 enabled: true,
567 min_sdk_version: "30",
568 apex_available: [
569 "com.android.tethering",
Nate Jiang5f0471c2024-07-12 16:49:52 +0000570 "com.android.wifi",
Xiao Mab28199a2024-08-05 14:24:26 +0900571 "//apex_available:platform",
Handa Wang9b0df362024-07-02 13:17:43 +0000572 ],
573 },
574 cpp: {
575 enabled: false,
576 },
577 ndk: {
578 enabled: false,
579 },
580 rust: {
581 enabled: false,
582 },
583 },
584 include_dirs: [
585 "packages/modules/Connectivity/framework/aidl-export",
586 ],
587 visibility: [
588 "//system/tools/aidl/build",
589 ],
590}
591
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900592// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
593// included either (some annotations would be duplicated on the bootclasspath).
594filegroup {
595 name: "net-utils-telephony-common-srcs",
596 srcs: [
597 // Any class here *must* have a corresponding jarjar rule in the telephony build rules.
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900598 "device/android/net/NetworkFactory.java",
Chalard Jean7592a342021-04-19 18:04:34 +0900599 "device/android/net/NetworkFactoryImpl.java",
600 "device/android/net/NetworkFactoryLegacyImpl.java",
601 "device/android/net/NetworkFactoryShim.java",
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900602 ],
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900603 path: "device",
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900604 visibility: [
605 "//frameworks/opt/telephony",
606 ],
607}
Roshan Pius864bdec2020-01-16 09:19:11 -0800608
Nate Jiang5f0471c2024-07-12 16:49:52 +0000609// Filegroup to build lib used by Wifi framework
Roshan Pius864bdec2020-01-16 09:19:11 -0800610// Any class here *must* have a corresponding jarjar rule in the wifi build rules.
611filegroup {
612 name: "net-utils-framework-wifi-common-srcs",
613 srcs: [
Chalard Jeanb61091b2021-10-07 15:29:13 +0900614 "framework/com/android/net/module/util/DnsSdTxtRecord.java",
615 "framework/com/android/net/module/util/Inet4AddressUtils.java",
616 "framework/com/android/net/module/util/InetAddressUtils.java",
617 "framework/com/android/net/module/util/MacAddressUtils.java",
618 "framework/com/android/net/module/util/NetUtils.java",
Roshan Pius864bdec2020-01-16 09:19:11 -0800619 ],
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900620 path: "framework",
Nate Jiang5f0471c2024-07-12 16:49:52 +0000621 visibility: ["//visibility:private"],
Roshan Pius864bdec2020-01-16 09:19:11 -0800622}
Handa Wang9b0df362024-07-02 13:17:43 +0000623
Yan Yan61f779c2024-10-01 15:07:51 -0700624// Filegroup to build lib used by IPsec/IKE framework
625// Any class here *must* have a corresponding jarjar rule in the IPsec build rules.
626filegroup {
627 name: "net-utils-framework-ipsec-common-srcs",
628 srcs: [
629 "framework/com/android/net/module/util/HexDump.java",
630 ],
631 path: "framework",
632 visibility: ["//visibility:private"],
633}
634
635java_library {
636 name: "net-utils-framework-ipsec",
637 sdk_version: "module_current",
638 min_sdk_version: "30",
639 srcs: [":net-utils-framework-ipsec-common-srcs"],
640 libs: [
641 "androidx.annotation_annotation",
642 ],
643 visibility: [
644 "//packages/modules/IPsec",
645 ],
646 apex_available: ["com.android.ipsec"],
647}
648
Handa Wang9b0df362024-07-02 13:17:43 +0000649// Use a file group containing classes necessary for framework-connectivity. The file group should
650// be as small as possible because because the classes end up in the bootclasspath and R8 is not
651// used to remove unused classes.
652filegroup {
653 name: "net-utils-framework-connectivity-srcs",
654 srcs: [
655 "device/com/android/net/module/util/BpfBitmap.java",
656 "device/com/android/net/module/util/BpfDump.java",
657 "device/com/android/net/module/util/BpfMap.java",
658 "device/com/android/net/module/util/BpfUtils.java",
659 "device/com/android/net/module/util/IBpfMap.java",
660 "device/com/android/net/module/util/JniUtil.java",
661 "device/com/android/net/module/util/SingleWriterBpfMap.java",
662 "device/com/android/net/module/util/Struct.java",
663 "device/com/android/net/module/util/TcUtils.java",
664 "framework/com/android/net/module/util/HexDump.java",
665 ],
666 visibility: ["//visibility:private"],
667}
668
Handa Wange12dfea2024-11-01 09:25:28 +0000669// Sources outside of com.android.net.module.util should not be added because many modules depend on
670// them and need jarjar rules
Handa Wang9b0df362024-07-02 13:17:43 +0000671filegroup {
672 name: "net-utils-all-srcs",
673 srcs: [
674 "device/**/*.java",
675 ":net-utils-framework-common-srcs",
676 ],
677 visibility: ["//visibility:private"],
678}
679
680filegroup {
681 name: "net-utils-aidl-srcs",
682 srcs: [
683 "device/**/*.aidl",
684 ],
685 path: "device",
686 visibility: ["//visibility:private"],
687}
Nate Jiang5f0471c2024-07-12 16:49:52 +0000688
689java_library {
690 name: "net-utils-service-wifi",
691 srcs: [
692 ":net-utils-all-srcs",
693 ],
694 exclude_srcs: [":net-utils-framework-wifi-common-srcs"],
695 libs: [
696 "net-utils-framework-wifi",
697 ],
698 defaults: ["net-utils-non-bootclasspath-defaults"],
699
700 visibility: [
701 "//packages/modules/Wifi/service",
702 ],
703 apex_available: [
704 "com.android.wifi",
705 ],
706}
707
708java_library {
709 name: "net-utils-framework-wifi",
710 sdk_version: "module_current",
711 min_sdk_version: "30",
712 srcs: [":net-utils-framework-wifi-common-srcs"],
713 libs: [
714 "framework-annotations-lib",
715 "framework-connectivity.stubs.module_lib",
716 "unsupportedappusage",
717 ],
718 visibility: [
719 "//packages/modules/Wifi/framework",
720 ],
721 apex_available: ["com.android.wifi"],
722}
Yuyang Huang1cc77692024-11-08 11:51:07 +0900723
724genrule {
725 name: "statslog-framework-connectivity-java-gen",
726 tools: ["stats-log-api-gen"],
727 cmd: "$(location stats-log-api-gen) --java $(out) --module connectivity --javaPackage com.android.net.module.util --javaClass FrameworkConnectivityStatsLog",
728 out: ["com/android/net/module/util/FrameworkConnectivityStatsLog.java"],
729}
Yan Yan587f9962024-10-02 22:38:10 +0000730
731java_library {
732 name: "net-utils-service-vcn",
733 sdk_version: "module_current",
734 min_sdk_version: "30",
735 srcs: [
736 "device/com/android/net/module/util/HandlerUtils.java",
737 ],
738 libs: [
739 "framework-annotations-lib",
740 ],
741 visibility: [
742 // TODO: b/374174952 Remove it when VCN modularization is released
743 "//frameworks/base/packages/Vcn/service-b",
744
745 "//packages/modules/Connectivity/service-b",
746 ],
747 apex_available: [
748 // TODO: b/374174952 Remove it when VCN modularization is released
749 "//apex_available:platform",
750
751 "com.android.tethering",
752 ],
753}