blob: 44ab3163f15173e7471bc81345d5496bbb3fe147 [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
Patrick Rohr259c0b42025-04-10 15:55:30 -070084// Contains staticlibs classes for use by NetworkStack
85java_library {
86 name: "net-utils-networkstack",
87 srcs: [
88 "device/com/android/net/module/util/ProcfsParsingUtils.java",
Patrick Rohrf5e80bf2025-05-01 10:47:02 -070089 "device/com/android/net/module/util/dhcp6/*.java",
Jimi Chene5a4e6b2025-06-11 23:46:57 +000090 "device/com/android/net/module/util/CommonConnectivityJni.java",
91 "device/com/android/net/module/util/RealtimeScheduler.java",
92 "device/com/android/net/module/util/TimerFdUtils.java",
93 "device/com/android/net/module/util/JniUtil.java",
Patrick Rohr259c0b42025-04-10 15:55:30 -070094 "framework/com/android/net/module/util/HexDump.java",
95 ],
96 sdk_version: "module_current",
97 min_sdk_version: "30",
98 target_sdk_version: "30",
99 visibility: [
100 "//packages/modules/Connectivity/tests:__subpackages__",
101 "//packages/modules/NetworkStack:__subpackages__",
102 ],
103 libs: [
104 "androidx.annotation_annotation",
105 "framework-annotations-lib",
106 "framework-connectivity.stubs.module_lib",
Patrick Rohrf5e80bf2025-05-01 10:47:02 -0700107 "net-utils-device-common-struct",
108 "net-utils-device-common-struct-base",
Patrick Rohr259c0b42025-04-10 15:55:30 -0700109 ],
110}
111
Aswin Sankar601d6f92021-10-11 13:12:16 -0700112java_library {
113 name: "net-utils-dnspacket-common",
114 srcs: [
Aditya Choudhary01b5ede2024-01-31 11:08:57 +0000115 "framework/**/DnsPacket.java",
116 "framework/**/DnsPacketUtils.java",
117 "framework/**/DnsSvcbPacket.java",
118 "framework/**/DnsSvcbRecord.java",
119 "framework/**/HexDump.java",
120 "framework/**/NetworkStackConstants.java",
Aswin Sankar601d6f92021-10-11 13:12:16 -0700121 ],
122 sdk_version: "module_current",
123 visibility: [
124 "//packages/services/Iwlan:__subpackages__",
125 ],
Junyu Lai85e24e82022-09-15 07:34:51 +0000126 libs: [
Mike Yu9b96c832023-09-18 08:26:08 +0000127 "androidx.annotation_annotation",
Junyu Lai85e24e82022-09-15 07:34:51 +0000128 "framework-annotations-lib",
129 "framework-connectivity.stubs.module_lib",
130 ],
Aswin Sankar601d6f92021-10-11 13:12:16 -0700131}
132
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800133filegroup {
134 name: "net-utils-framework-common-srcs",
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900135 srcs: ["framework/**/*.java"],
136 path: "framework",
Remi NGUYEN VAN651faf72021-03-24 22:40:37 +0900137 visibility: [
138 "//frameworks/base",
Baligh Uddin27e5fcd2021-05-22 13:16:30 +0000139 "//packages/modules/Connectivity:__subpackages__",
Remi NGUYEN VAN651faf72021-03-24 22:40:37 +0900140 ],
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800141}
142
Yang Sun3aa62e62024-03-12 21:23:19 +0800143// The net-utils-device-common-bpf library requires the callers to contain
144// net-utils-device-common-struct-base.
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800145java_library {
markchienf3448f92021-11-10 01:06:51 +0800146 name: "net-utils-device-common-bpf",
Xiao Ma57b34422021-07-01 13:57:02 +0000147 srcs: [
Tyler Wear92f3c242022-02-15 15:21:43 -0800148 "device/com/android/net/module/util/BpfBitmap.java",
Hungming Chenb3e71a22022-06-23 21:34:54 +0800149 "device/com/android/net/module/util/BpfDump.java",
Tyler Wearaafd9c12021-10-19 11:01:46 -0700150 "device/com/android/net/module/util/BpfMap.java",
Tyler Weare48ee4a2022-02-15 15:30:50 -0800151 "device/com/android/net/module/util/BpfUtils.java",
markchien2e5fece2022-01-21 10:16:54 +0800152 "device/com/android/net/module/util/IBpfMap.java",
markchienf3448f92021-11-10 01:06:51 +0800153 "device/com/android/net/module/util/JniUtil.java",
Lorenzo Colitti05be2f52024-06-02 13:24:21 +0900154 "device/com/android/net/module/util/SingleWriterBpfMap.java",
Patrick Rohr29b0d952022-01-12 21:42:24 +0100155 "device/com/android/net/module/util/TcUtils.java",
markchienf3448f92021-11-10 01:06:51 +0800156 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900157 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000158 min_sdk_version: "30",
markchienf3448f92021-11-10 01:06:51 +0800159 visibility: [
markchienf3448f92021-11-10 01:06:51 +0800160 "//packages/modules/Connectivity:__subpackages__",
161 "//packages/modules/NetworkStack:__subpackages__",
162 ],
markchienf3448f92021-11-10 01:06:51 +0800163 libs: [
164 "androidx.annotation_annotation",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900165 "framework-connectivity.stubs.module_lib",
Yang Sun3aa62e62024-03-12 21:23:19 +0800166 "net-utils-device-common-struct-base",
markchienf3448f92021-11-10 01:06:51 +0800167 ],
168 apex_available: [
169 "com.android.tethering",
170 "//apex_available:platform",
171 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900172 lint: {
173 strict_updatability_linting: true,
174 error_checks: ["NewApi"],
175 },
markchienf3448f92021-11-10 01:06:51 +0800176}
177
178java_library {
Yang Sun3aa62e62024-03-12 21:23:19 +0800179 name: "net-utils-device-common-struct-base",
markchienf3448f92021-11-10 01:06:51 +0800180 srcs: [
Patrick Rohr62d51d12025-07-28 12:44:32 -0700181 "device/com/android/net/module/util/LegacyStruct.java",
Xiao Ma57b34422021-07-01 13:57:02 +0000182 "device/com/android/net/module/util/Struct.java",
Xiao Ma57b34422021-07-01 13:57:02 +0000183 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900184 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000185 min_sdk_version: "30",
Xiao Ma57b34422021-07-01 13:57:02 +0000186 visibility: [
Xiao Ma57b34422021-07-01 13:57:02 +0000187 "//packages/modules/Connectivity:__subpackages__",
188 "//packages/modules/NetworkStack:__subpackages__",
189 ],
190 static_libs: [
191 "net-utils-framework-common",
192 ],
193 libs: [
194 "androidx.annotation_annotation",
Yang Sun3aa62e62024-03-12 21:23:19 +0800195 "framework-annotations-lib", // Required by InetAddressUtils.java
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900196 "framework-connectivity.stubs.module_lib",
Xiao Ma57b34422021-07-01 13:57:02 +0000197 ],
198 apex_available: [
199 "com.android.tethering",
200 "//apex_available:platform",
201 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900202 lint: {
203 strict_updatability_linting: true,
204 error_checks: ["NewApi"],
205 },
Xiao Ma57b34422021-07-01 13:57:02 +0000206}
207
Yang Sun3aa62e62024-03-12 21:23:19 +0800208// The net-utils-device-common-struct library requires the callers to contain
209// net-utils-device-common-struct-base.
Yang Sun1c9fb592024-02-19 10:37:26 +0800210java_library {
Yang Sun3aa62e62024-03-12 21:23:19 +0800211 name: "net-utils-device-common-struct",
Yang Sun1c9fb592024-02-19 10:37:26 +0800212 srcs: [
Yang Sun3aa62e62024-03-12 21:23:19 +0800213 "device/com/android/net/module/util/Ipv6Utils.java",
214 "device/com/android/net/module/util/PacketBuilder.java",
215 "device/com/android/net/module/util/structs/*.java",
Yang Sun1c9fb592024-02-19 10:37:26 +0800216 ],
217 sdk_version: "module_current",
218 min_sdk_version: "30",
219 visibility: [
220 "//packages/modules/Connectivity:__subpackages__",
Yang Sun3aa62e62024-03-12 21:23:19 +0800221 "//packages/modules/NetworkStack:__subpackages__",
Yang Sun1c9fb592024-02-19 10:37:26 +0800222 ],
223 libs: [
Yang Sun3aa62e62024-03-12 21:23:19 +0800224 "androidx.annotation_annotation",
225 "framework-annotations-lib", // Required by IpUtils.java
226 "framework-connectivity.stubs.module_lib",
227 "net-utils-device-common-struct-base",
Yang Sun1c9fb592024-02-19 10:37:26 +0800228 ],
229 apex_available: [
230 "com.android.tethering",
Yang Sun3aa62e62024-03-12 21:23:19 +0800231 "//apex_available:platform",
Yang Sun1c9fb592024-02-19 10:37:26 +0800232 ],
233 lint: {
234 strict_updatability_linting: true,
235 error_checks: ["NewApi"],
236 },
237}
238
Junyu Lai626045a2023-08-28 18:49:44 +0800239// The net-utils-device-common-netlink library requires the callers to contain
Yang Sun3aa62e62024-03-12 21:23:19 +0800240// net-utils-device-common-struct and net-utils-device-common-struct-base.
Xiao Ma57b34422021-07-01 13:57:02 +0000241java_library {
markchienf3448f92021-11-10 01:06:51 +0800242 name: "net-utils-device-common-netlink",
243 srcs: [
Yan Yanf085fad2023-11-20 18:51:30 +0000244 "device/com/android/net/module/util/netlink/**/*.java",
markchienf3448f92021-11-10 01:06:51 +0800245 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900246 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000247 min_sdk_version: "30",
markchienf3448f92021-11-10 01:06:51 +0800248 visibility: [
markchienf3448f92021-11-10 01:06:51 +0800249 "//packages/modules/Connectivity:__subpackages__",
250 "//packages/modules/NetworkStack:__subpackages__",
251 ],
markchienf3448f92021-11-10 01:06:51 +0800252 libs: [
253 "androidx.annotation_annotation",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900254 "framework-connectivity.stubs.module_lib",
Junyu Lai626045a2023-08-28 18:49:44 +0800255 // For libraries which are statically linked in framework-connectivity, do not
256 // statically link here because callers of this library might already have a static
257 // version linked.
258 "net-utils-device-common-struct",
Yang Sun3aa62e62024-03-12 21:23:19 +0800259 "net-utils-device-common-struct-base",
markchienf3448f92021-11-10 01:06:51 +0800260 ],
Sewook Seo45163852024-11-17 22:38:48 +0000261 static_libs: [
262 "netd_aidl_interface-lateststable-java",
263 ],
markchienf3448f92021-11-10 01:06:51 +0800264 apex_available: [
265 "com.android.tethering",
266 "//apex_available:platform",
267 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900268 lint: {
269 strict_updatability_linting: true,
270 error_checks: ["NewApi"],
271 },
markchienf3448f92021-11-10 01:06:51 +0800272}
273
Junyu Lai626045a2023-08-28 18:49:44 +0800274// The net-utils-device-common-ip library requires the callers to contain
Yang Sun3aa62e62024-03-12 21:23:19 +0800275// net-utils-device-common-struct and net-utils-device-common-struct-base.
markchienf3448f92021-11-10 01:06:51 +0800276java_library {
Chalard Jeanb61091b2021-10-07 15:29:13 +0900277 // TODO : this target should probably be folded into net-utils-device-common
278 name: "net-utils-device-common-ip",
279 srcs: [
280 "device/com/android/net/module/util/ip/*.java",
281 ],
282 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000283 min_sdk_version: "30",
Chalard Jeanb61091b2021-10-07 15:29:13 +0900284 visibility: [
Chalard Jeanb61091b2021-10-07 15:29:13 +0900285 "//packages/modules/Connectivity:__subpackages__",
286 "//packages/modules/NetworkStack:__subpackages__",
287 ],
288 libs: [
289 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000290 "framework-connectivity.stubs.module_lib",
Chalard Jeanb61091b2021-10-07 15:29:13 +0900291 ],
292 static_libs: [
293 "net-utils-device-common",
294 "net-utils-device-common-netlink",
295 "net-utils-framework-common",
296 "netd-client",
297 ],
298 apex_available: [
299 "com.android.tethering",
300 "//apex_available:platform",
301 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900302 lint: {
Motomu Utsumia1a00342024-06-13 09:29:47 +0000303 strict_updatability_linting: true,
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900304 error_checks: ["NewApi"],
305 },
Chalard Jeanb61091b2021-10-07 15:29:13 +0900306}
307
308java_library {
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800309 name: "net-utils-framework-common",
Remi NGUYEN VANce241a32020-01-14 21:42:09 +0900310 srcs: [
311 ":net-utils-framework-common-srcs",
Remi NGUYEN VANce241a32020-01-14 21:42:09 +0900312 ],
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900313 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000314 min_sdk_version: "30",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900315 libs: [
Jooyung Hanb3b67982022-06-24 14:56:24 +0900316 "androidx.annotation_annotation",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900317 "framework-annotations-lib",
318 "framework-connectivity.stubs.module_lib",
paulhucdb069e2022-02-14 15:28:50 +0800319 "framework-connectivity-t.stubs.module_lib",
Mark White66d39cd2023-08-07 15:20:07 +0000320 "framework-location.stubs.module_lib",
Remi NGUYEN VAN7f0d0e32022-01-25 19:08:12 +0900321 ],
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800322 jarjar_rules: "jarjar-rules-shared.txt",
323 visibility: [
Luke Huangfd5479e2020-06-20 11:38:17 +0800324 "//cts/tests/tests/net",
Chalard Jeanceaf7d02020-06-26 18:34:52 +0900325 "//cts/tests/tests/wifi",
Baligh Uddine685c812020-10-31 04:28:58 +0000326 "//packages/modules/Connectivity/tests/cts/net",
Baligh Uddinae4770d2020-10-29 02:12:06 +0000327 "//packages/modules/Connectivity/Tethering",
Chalard Jeana9f49912020-10-15 18:06:30 +0900328 "//frameworks/base/tests:__subpackages__",
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800329 "//frameworks/opt/net/ike",
330 "//frameworks/opt/telephony",
Chalard Jean19789192020-10-01 12:45:31 +0900331 "//frameworks/base/wifi:__subpackages__",
Remi NGUYEN VAN38afb0c2020-11-10 18:04:27 +0900332 "//packages/modules/Connectivity:__subpackages__",
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900333 "//packages/modules/NetworkStack:__subpackages__",
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800334 "//packages/modules/CaptivePortalLogin",
Baligh Uddinfcbda3a2020-12-24 06:12:25 +0000335 "//packages/modules/Wifi/framework/tests:__subpackages__",
Junyu Laib24df142022-01-10 10:31:11 +0000336 "//packages/apps/Settings",
Chalard Jean7592a342021-04-19 18:04:34 +0900337 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900338 lint: {
339 strict_updatability_linting: true,
340 error_checks: ["NewApi"],
341 },
Paul Hu8d47d842023-03-31 14:59:49 +0800342 errorprone: {
343 enabled: true,
344 // Error-prone checking only warns of problems when building. To make the build fail with
345 // these errors, list the specific error-prone problems below.
346 javacflags: [
347 "-Xep:NullablePrimitive:ERROR",
348 ],
349 },
Spandan Das2b83e772023-12-21 20:46:31 +0000350 apex_available: [
351 "//apex_available:platform",
352 "com.android.tethering",
353 ],
Aaron Huangf73ff8c2019-12-06 18:12:24 +0800354}
Anton Hansson0ceeb7c2022-05-30 12:01:49 +0000355
356java_library {
357 name: "net-utils-services-common",
David Su2dbab642020-10-26 14:51:01 -0700358 srcs: [
359 "device/android/net/NetworkFactory.java",
Chalard Jean7592a342021-04-19 18:04:34 +0900360 "device/android/net/NetworkFactoryImpl.java",
361 "device/android/net/NetworkFactoryLegacyImpl.java",
362 "device/android/net/NetworkFactoryShim.java",
David Su2dbab642020-10-26 14:51:01 -0700363 ],
Chalard Jeand5802422021-10-27 19:02:14 +0900364 sdk_version: "module_current",
David Sudc0a5682021-01-29 04:42:27 +0000365 min_sdk_version: "30",
Chalard Jeand5802422021-10-27 19:02:14 +0900366 libs: [
367 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000368 "framework-connectivity.stubs.module_lib",
William Escande51c0be52024-07-10 14:26:50 -0700369 "modules-utils-build_system",
Chalard Jeand5802422021-10-27 19:02:14 +0900370 ],
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000371 // TODO: remove "apex_available:platform".
372 apex_available: [
373 "//apex_available:platform",
William Escandeb82afa32025-01-09 12:25:16 -0800374 "com.android.bt",
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000375 "com.android.tethering",
Anton Hansson0ceeb7c2022-05-30 12:01:49 +0000376 "com.android.wifi",
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000377 ],
Aaron Huang57a94962020-01-03 20:35:55 +0800378 visibility: [
markchien32a6e9c2022-01-20 14:34:15 +0800379 // TODO: remove after NetworkStatsService moves to the module.
Remi NGUYEN VAN376f8d42020-01-15 18:26:29 +0900380 "//frameworks/base/services/net",
Xiao Ma2bbc2f72022-01-24 07:58:12 +0000381 "//packages/modules/Connectivity/service",
Remi NGUYEN VAN0cf724a2021-11-19 18:33:12 +0900382 "//packages/modules/Connectivity/tests:__subpackages__",
Roopa Sattiraju98fa3bf2022-02-03 18:53:23 -0800383 "//packages/modules/Bluetooth/android/app",
Nate(Qiang) Jiangce723aa2022-06-01 21:28:32 +0000384 "//packages/modules/Wifi/service:__subpackages__",
Aaron Huang57a94962020-01-03 20:35:55 +0800385 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900386 lint: {
387 strict_updatability_linting: true,
388 error_checks: ["NewApi"],
389 },
Aaron Huang57a94962020-01-03 20:35:55 +0800390}
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900391
Igor Chernysheva25f1092022-12-20 00:07:38 -0800392java_library {
393 name: "net-utils-device-common-async",
394 srcs: [
395 "device/com/android/net/module/util/async/*.java",
396 ],
397 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000398 min_sdk_version: "30",
Igor Chernysheva25f1092022-12-20 00:07:38 -0800399 visibility: [
Igor Chernysheva25f1092022-12-20 00:07:38 -0800400 "//packages/modules/Connectivity:__subpackages__",
401 ],
402 libs: [
403 "framework-annotations-lib",
404 ],
405 static_libs: [
406 ],
407 apex_available: [
408 "com.android.tethering",
409 "//apex_available:platform",
410 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900411 lint: {
412 strict_updatability_linting: true,
413 error_checks: ["NewApi"],
414 },
Igor Chernysheva25f1092022-12-20 00:07:38 -0800415}
416
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700417java_library {
418 name: "net-utils-device-common-wear",
419 srcs: [
420 "device/com/android/net/module/util/wear/*.java",
421 ],
422 sdk_version: "module_current",
Maciej Żenczykowski127a1442023-09-19 23:17:10 +0000423 min_sdk_version: "30",
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700424 visibility: [
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700425 "//packages/modules/Connectivity:__subpackages__",
426 ],
427 libs: [
428 "framework-annotations-lib",
429 ],
430 static_libs: [
431 "net-utils-device-common-async",
432 ],
433 apex_available: [
434 "com.android.tethering",
435 "//apex_available:platform",
436 ],
Motomu Utsumi195a30f2023-09-27 16:03:30 +0900437 lint: {
438 strict_updatability_linting: true,
439 error_checks: ["NewApi"],
440 },
Igor Chernyshev810be2b2023-04-06 15:52:26 -0700441}
442
Yuyang Huangf67388b2023-03-29 16:51:09 +0900443// Limited set of utilities for use by service-connectivity-mdns-standalone-build-test, to make sure
444// the mDNS code can build with only system APIs.
445// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that
446// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build
447// rule verifies that the mDNS code can be built into apps, if code transformations are applied to
448// the annotations.
449// When using "system_current", framework annotations are not available; they would appear as
450// package-private as they are marked as such in the system_current stubs. So build against
451// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7.
452java_library {
453 name: "net-utils-device-common-mdns-standalone-build-test",
454 // Build against core_platform and add the stub libraries manually in "libs", as annotations
455 // are already included in android_system_stubs_current but package-private, so
456 // "framework-annotations-lib" needs to be manually included before
457 // "android_system_stubs_current" (b/272392042)
458 sdk_version: "core_platform",
459 srcs: [
460 "device/com/android/net/module/util/FdEventsReader.java",
Paul Hu78713202024-08-01 15:12:10 +0000461 "device/com/android/net/module/util/HandlerUtils.java",
Yuyang Huangf67388b2023-03-29 16:51:09 +0900462 "device/com/android/net/module/util/SharedLog.java",
463 "framework/com/android/net/module/util/ByteUtils.java",
464 "framework/com/android/net/module/util/CollectionUtils.java",
Yuyang Huangd851a042024-07-16 18:48:43 +0900465 "framework/com/android/net/module/util/DnsUtils.java",
Yuyang Huange4eb87a2023-05-02 18:44:51 +0900466 "framework/com/android/net/module/util/HexDump.java",
Yuyang Huangf67388b2023-03-29 16:51:09 +0900467 "framework/com/android/net/module/util/LinkPropertiesUtils.java",
468 ],
469 libs: [
470 "framework-annotations-lib",
471 "android_system_stubs_current",
472 "androidx.annotation_annotation",
473 ],
474 visibility: ["//packages/modules/Connectivity/service-t"],
475}
476
Handa Wang8be10bf2024-08-08 15:36:48 +0000477// net-utils-framework-connectivity is only for framework-connectivity.
Handa Wang9b0df362024-07-02 13:17:43 +0000478java_library {
479 name: "net-utils-framework-connectivity",
480 srcs: [
481 ":net-utils-framework-connectivity-srcs",
482 ],
483 sdk_version: "module_current",
484 min_sdk_version: "30",
485 apex_available: [
486 "com.android.tethering",
487 "//apex_available:platform",
488 ],
489 visibility: [
Handa Wang8be10bf2024-08-08 15:36:48 +0000490 "//packages/modules/Connectivity/framework",
Handa Wang9b0df362024-07-02 13:17:43 +0000491 ],
492 libs: [
493 "androidx.annotation_annotation",
494 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000495 "framework-configinfrastructure.stubs.module_lib",
Handa Wang9b0df362024-07-02 13:17:43 +0000496 "framework-connectivity.stubs.module_lib",
497 ],
Sarup Dalwani746540b2025-04-22 16:01:52 +0000498 static_libs: [
499 "net-utils-framework-common",
500 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000501 lint: {
502 strict_updatability_linting: true,
503 error_checks: ["NewApi"],
504 },
505}
506
507java_defaults {
508 name: "net-utils-non-bootclasspath-defaults",
509 sdk_version: "module_current",
510 min_sdk_version: "30",
Handa Wang9b0df362024-07-02 13:17:43 +0000511 libs: [
512 "androidx.annotation_annotation",
513 "framework-annotations-lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000514 "framework-configinfrastructure.stubs.module_lib",
Handa Wang9b0df362024-07-02 13:17:43 +0000515 "framework-connectivity.stubs.module_lib",
516 "framework-connectivity-t.stubs.module_lib",
517 "framework-location.stubs.module_lib",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000518 "framework-tethering.stubs.module_lib",
Handa Wang9b0df362024-07-02 13:17:43 +0000519 "unsupportedappusage",
520 ],
521 static_libs: [
522 "modules-utils-build_system",
523 "modules-utils-statemachine",
524 "net-utils-non-bootclasspath-aidl-java",
525 "netd-client",
526 ],
527 apex_available: [
528 "com.android.tethering",
529 "//apex_available:platform",
530 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000531 defaults_visibility: [
532 "//visibility:private",
533 ],
534 lint: {
535 strict_updatability_linting: true,
536 error_checks: ["NewApi"],
537 },
538}
539
Handa Wang8be10bf2024-08-08 15:36:48 +0000540// net-utils-service-connectivity is only for service-connectivity.
Handa Wang9b0df362024-07-02 13:17:43 +0000541java_library {
542 name: "net-utils-service-connectivity",
543 srcs: [
544 ":net-utils-all-srcs",
545 ],
546 exclude_srcs: [
547 ":net-utils-framework-connectivity-srcs",
548 ],
549 libs: [
550 "net-utils-framework-connectivity",
Jihoon Kang8401b6a2024-08-30 00:29:58 +0000551 "framework-connectivity.impl",
552 "framework-tethering.impl",
Handa Wang9b0df362024-07-02 13:17:43 +0000553 ],
554 defaults: ["net-utils-non-bootclasspath-defaults"],
Nate Jiang5f0471c2024-07-12 16:49:52 +0000555 jarjar_rules: "jarjar-rules-shared.txt",
Handa Wang8be10bf2024-08-08 15:36:48 +0000556 visibility: [
557 "//packages/modules/Connectivity/service",
558 "//packages/modules/Connectivity/staticlibs/tests/unit",
559 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000560}
561
Remi NGUYEN VAN514f40b2024-08-15 08:07:02 +0000562// net-utils-connectivity-apks is only for NetworkStack, CaptivePortalLogin and
563// Tethering.apk
564// It includes all the static libraries in this directory, which is safe because
565// these APKs use R8 to strip out unused code, and they do not depend on
566// bootclasspath jars that may have duplicate copies of the included classes
567// with the same jarjaring.
568// Tethering.apk does depend on a bootclasspath jar (framework-tethering.jar),
569// however it does not use any of the static libraries. If it did, Tethering.apk
570// would need to use another variant that excludes classes that are already
571// included in framework-tethering.jar (similarly to how framework-connectivity
572// and service-connectivity do it). Otherwise, static libs included in
573// framework-tethering and Tethering.apk and jarjared the same way would
574// conflict.
Handa Wang9b0df362024-07-02 13:17:43 +0000575java_library {
Xiao Ma6793fd02024-07-26 13:07:50 +0900576 name: "net-utils-connectivity-apks",
Handa Wang9b0df362024-07-02 13:17:43 +0000577 srcs: [
578 ":net-utils-all-srcs",
579 ":framework-connectivity-shared-srcs",
580 ],
581 defaults: ["net-utils-non-bootclasspath-defaults"],
Nate Jiang5f0471c2024-07-12 16:49:52 +0000582 jarjar_rules: "jarjar-rules-shared.txt",
Handa Wang8be10bf2024-08-08 15:36:48 +0000583 visibility: [
584 "//packages/modules/CaptivePortalLogin:__subpackages__",
585 "//packages/modules/Connectivity/Tethering",
586 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000587}
588
589aidl_interface {
590 name: "net-utils-non-bootclasspath-aidl",
591 srcs: [
592 ":net-utils-aidl-srcs",
593 ],
594 unstable: true,
595 backend: {
596 java: {
597 enabled: true,
598 min_sdk_version: "30",
599 apex_available: [
600 "com.android.tethering",
Nate Jiang5f0471c2024-07-12 16:49:52 +0000601 "com.android.wifi",
Xiao Mab28199a2024-08-05 14:24:26 +0900602 "//apex_available:platform",
Handa Wang9b0df362024-07-02 13:17:43 +0000603 ],
604 },
605 cpp: {
606 enabled: false,
607 },
608 ndk: {
609 enabled: false,
610 },
611 rust: {
612 enabled: false,
613 },
614 },
615 include_dirs: [
616 "packages/modules/Connectivity/framework/aidl-export",
617 ],
618 visibility: [
619 "//system/tools/aidl/build",
620 ],
Lorenzo Colitti8f8e59a2025-08-06 15:21:50 +0900621 imports: [
Sarup Dalwani1bec0d62025-07-02 17:45:00 +0000622 "netd_aidl_interface-V18", // For RouteInfoParcel.
Lorenzo Colitti8f8e59a2025-08-06 15:21:50 +0900623 ],
Handa Wang9b0df362024-07-02 13:17:43 +0000624}
625
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900626// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
627// included either (some annotations would be duplicated on the bootclasspath).
628filegroup {
629 name: "net-utils-telephony-common-srcs",
630 srcs: [
631 // Any class here *must* have a corresponding jarjar rule in the telephony build rules.
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900632 "device/android/net/NetworkFactory.java",
Chalard Jean7592a342021-04-19 18:04:34 +0900633 "device/android/net/NetworkFactoryImpl.java",
634 "device/android/net/NetworkFactoryLegacyImpl.java",
635 "device/android/net/NetworkFactoryShim.java",
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900636 ],
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900637 path: "device",
Lorenzo Colittie14bd342020-01-14 14:47:16 +0900638 visibility: [
639 "//frameworks/opt/telephony",
640 ],
641}
Roshan Pius864bdec2020-01-16 09:19:11 -0800642
Nate Jiang5f0471c2024-07-12 16:49:52 +0000643// Filegroup to build lib used by Wifi framework
Roshan Pius864bdec2020-01-16 09:19:11 -0800644// Any class here *must* have a corresponding jarjar rule in the wifi build rules.
645filegroup {
646 name: "net-utils-framework-wifi-common-srcs",
647 srcs: [
Chalard Jeanb61091b2021-10-07 15:29:13 +0900648 "framework/com/android/net/module/util/DnsSdTxtRecord.java",
649 "framework/com/android/net/module/util/Inet4AddressUtils.java",
650 "framework/com/android/net/module/util/InetAddressUtils.java",
651 "framework/com/android/net/module/util/MacAddressUtils.java",
652 "framework/com/android/net/module/util/NetUtils.java",
Roshan Pius864bdec2020-01-16 09:19:11 -0800653 ],
Chalard Jean48c6c7d2020-06-25 23:39:15 +0900654 path: "framework",
Nate Jiang5f0471c2024-07-12 16:49:52 +0000655 visibility: ["//visibility:private"],
Roshan Pius864bdec2020-01-16 09:19:11 -0800656}
Handa Wang9b0df362024-07-02 13:17:43 +0000657
Yan Yan61f779c2024-10-01 15:07:51 -0700658// Filegroup to build lib used by IPsec/IKE framework
659// Any class here *must* have a corresponding jarjar rule in the IPsec build rules.
660filegroup {
661 name: "net-utils-framework-ipsec-common-srcs",
662 srcs: [
663 "framework/com/android/net/module/util/HexDump.java",
664 ],
665 path: "framework",
666 visibility: ["//visibility:private"],
667}
668
669java_library {
670 name: "net-utils-framework-ipsec",
671 sdk_version: "module_current",
672 min_sdk_version: "30",
673 srcs: [":net-utils-framework-ipsec-common-srcs"],
674 libs: [
675 "androidx.annotation_annotation",
676 ],
677 visibility: [
678 "//packages/modules/IPsec",
679 ],
680 apex_available: ["com.android.ipsec"],
681}
682
Handa Wang9b0df362024-07-02 13:17:43 +0000683// Use a file group containing classes necessary for framework-connectivity. The file group should
684// be as small as possible because because the classes end up in the bootclasspath and R8 is not
685// used to remove unused classes.
686filegroup {
687 name: "net-utils-framework-connectivity-srcs",
688 srcs: [
689 "device/com/android/net/module/util/BpfBitmap.java",
690 "device/com/android/net/module/util/BpfDump.java",
691 "device/com/android/net/module/util/BpfMap.java",
692 "device/com/android/net/module/util/BpfUtils.java",
693 "device/com/android/net/module/util/IBpfMap.java",
694 "device/com/android/net/module/util/JniUtil.java",
Patrick Rohr62d51d12025-07-28 12:44:32 -0700695 "device/com/android/net/module/util/LegacyStruct.java",
Handa Wang9b0df362024-07-02 13:17:43 +0000696 "device/com/android/net/module/util/SingleWriterBpfMap.java",
697 "device/com/android/net/module/util/Struct.java",
698 "device/com/android/net/module/util/TcUtils.java",
699 "framework/com/android/net/module/util/HexDump.java",
700 ],
701 visibility: ["//visibility:private"],
702}
703
Handa Wange12dfea2024-11-01 09:25:28 +0000704// Sources outside of com.android.net.module.util should not be added because many modules depend on
705// them and need jarjar rules
Handa Wang9b0df362024-07-02 13:17:43 +0000706filegroup {
707 name: "net-utils-all-srcs",
708 srcs: [
709 "device/**/*.java",
710 ":net-utils-framework-common-srcs",
711 ],
712 visibility: ["//visibility:private"],
713}
714
715filegroup {
716 name: "net-utils-aidl-srcs",
717 srcs: [
718 "device/**/*.aidl",
719 ],
720 path: "device",
721 visibility: ["//visibility:private"],
722}
Nate Jiang5f0471c2024-07-12 16:49:52 +0000723
724java_library {
725 name: "net-utils-service-wifi",
726 srcs: [
727 ":net-utils-all-srcs",
728 ],
729 exclude_srcs: [":net-utils-framework-wifi-common-srcs"],
730 libs: [
731 "net-utils-framework-wifi",
732 ],
733 defaults: ["net-utils-non-bootclasspath-defaults"],
734
735 visibility: [
736 "//packages/modules/Wifi/service",
737 ],
738 apex_available: [
739 "com.android.wifi",
740 ],
741}
742
743java_library {
744 name: "net-utils-framework-wifi",
745 sdk_version: "module_current",
746 min_sdk_version: "30",
747 srcs: [":net-utils-framework-wifi-common-srcs"],
748 libs: [
749 "framework-annotations-lib",
750 "framework-connectivity.stubs.module_lib",
751 "unsupportedappusage",
752 ],
753 visibility: [
754 "//packages/modules/Wifi/framework",
755 ],
756 apex_available: ["com.android.wifi"],
757}
Yuyang Huang1cc77692024-11-08 11:51:07 +0900758
759genrule {
760 name: "statslog-framework-connectivity-java-gen",
761 tools: ["stats-log-api-gen"],
762 cmd: "$(location stats-log-api-gen) --java $(out) --module connectivity --javaPackage com.android.net.module.util --javaClass FrameworkConnectivityStatsLog",
763 out: ["com/android/net/module/util/FrameworkConnectivityStatsLog.java"],
764}
Yan Yan587f9962024-10-02 22:38:10 +0000765
766java_library {
767 name: "net-utils-service-vcn",
768 sdk_version: "module_current",
769 min_sdk_version: "30",
770 srcs: [
771 "device/com/android/net/module/util/HandlerUtils.java",
772 ],
773 libs: [
774 "framework-annotations-lib",
775 ],
776 visibility: [
777 // TODO: b/374174952 Remove it when VCN modularization is released
778 "//frameworks/base/packages/Vcn/service-b",
Yan Yan7c75e442025-07-09 01:17:17 +0000779 "//packages/modules/Connectivity/Vcn/service-b",
Yan Yan587f9962024-10-02 22:38:10 +0000780
781 "//packages/modules/Connectivity/service-b",
782 ],
783 apex_available: [
784 // TODO: b/374174952 Remove it when VCN modularization is released
785 "//apex_available:platform",
786
787 "com.android.tethering",
788 ],
789}
Yan Yanaa2f5312025-07-09 01:19:40 +0000790
791java_library {
792 name: "net-utils-framework-vcn",
793 sdk_version: "module_current",
794 min_sdk_version: "30",
795 srcs: [
796 "framework/com/android/net/module/util/HexDump.java",
797 ],
798 libs: [
799 "androidx.annotation_annotation",
800 ],
801 visibility: [
802 // TODO: b/374174952 Clean up the paths when the VCN
803 // code location is finalized
804 "//frameworks/base/packages/Vcn/framework-b",
805 "//packages/modules/Connectivity/Vcn/framework-b",
806 "//packages/modules/Connectivity/framework-b",
807 ],
808}