blob: 9ae3d6c2a34d8d24a78c4a91e6cfdaf74deed5a5 [file] [log] [blame]
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +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 Badour6c7ed9d2021-02-12 17:07:05 -080017package {
18 // See: http://go/android-license-faq
Baligh Uddin36847132021-05-23 16:38:40 +000019 default_applicable_licenses: ["Android-Apache-2.0"],
Bob Badour6c7ed9d2021-02-12 17:07:05 -080020}
21
Tyler Wearb37f5512021-10-01 13:22:00 -070022aidl_interface {
23 name: "connectivity_native_aidl_interface",
24 local_include_dir: "binder",
Tyler Wearb37f5512021-10-01 13:22:00 -070025 srcs: [
26 "binder/android/net/connectivity/aidl/*.aidl",
27 ],
28 backend: {
29 java: {
30 apex_available: [
31 "com.android.tethering",
32 ],
33 min_sdk_version: "30",
34 },
35 ndk: {
36 apex_available: [
37 "com.android.tethering",
38 ],
39 min_sdk_version: "30",
40 },
41 },
42 versions: ["1"],
43
44}
45
46cc_library_static {
47 name: "connectivity_native_aidl_interface-lateststable-ndk",
48 min_sdk_version: "30",
49 whole_static_libs: [
50 "connectivity_native_aidl_interface-V1-ndk",
51 ],
52 apex_available: [
53 "com.android.tethering",
54 ],
55}
56
57java_library {
58 name: "connectivity_native_aidl_interface-lateststable-java",
59 sdk_version: "system_current",
60 min_sdk_version: "30",
61 static_libs: [
62 "connectivity_native_aidl_interface-V1-java",
63 ],
64 apex_available: [
65 "com.android.tethering",
66 ],
67}
68
markchien8fb75e32021-11-11 17:53:56 +080069// The library name match the service-connectivity jarjar rules that put the JNI utils in the
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090070// android.net.connectivity.com.android.net.module.util package.
markchien8fb75e32021-11-11 17:53:56 +080071cc_library_shared {
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090072 name: "libandroid_net_connectivity_com_android_net_module_util_jni",
markchien8fb75e32021-11-11 17:53:56 +080073 min_sdk_version: "30",
74 cflags: [
75 "-Wall",
76 "-Werror",
77 "-Wno-unused-parameter",
78 "-Wthread-safety",
79 ],
80 srcs: [
81 "jni/com_android_net_module_util/onload.cpp",
82 ],
markchien8fb75e32021-11-11 17:53:56 +080083 static_libs: [
84 "libnet_utils_device_common_bpfjni",
Tyler Wearb37f5512021-10-01 13:22:00 -070085 "libnet_utils_device_common_bpfutils",
markchien8fb75e32021-11-11 17:53:56 +080086 ],
87 shared_libs: [
88 "liblog",
89 "libnativehelper",
90 ],
91 apex_available: [
92 "com.android.tethering",
93 ],
94}
95
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +000096cc_library_shared {
97 name: "libservice-connectivity",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +000098 min_sdk_version: "30",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +090099 cflags: [
100 "-Wall",
101 "-Werror",
102 "-Wno-unused-parameter",
103 "-Wthread-safety",
104 ],
105 srcs: [
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900106 ":services.connectivity-netstats-jni-sources",
Patrick Rohr361b8592022-01-28 15:39:17 +0100107 "jni/com_android_server_BpfNetMaps.cpp",
Hungming Chene2cf0552021-12-25 17:05:41 +0800108 "jni/com_android_server_connectivity_ClatCoordinator.cpp",
Patrick Rohr361b8592022-01-28 15:39:17 +0100109 "jni/com_android_server_TestNetworkService.cpp",
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000110 "jni/onload.cpp",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900111 ],
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000112 header_libs: [
Patrick Rohr361b8592022-01-28 15:39:17 +0100113 "bpf_connectivity_headers",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000114 ],
Hungming Chene2cf0552021-12-25 17:05:41 +0800115 static_libs: [
116 "libclat",
117 "libip_checksum",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900118 "libmodules-utils-build",
Hungming Chene2cf0552021-12-25 17:05:41 +0800119 "libnetjniutils",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900120 "libnet_utils_device_common_bpfjni",
Patrick Rohr361b8592022-01-28 15:39:17 +0100121 "libtraffic_controller",
122 "netd_aidl_interface-lateststable-ndk",
Hungming Chene2cf0552021-12-25 17:05:41 +0800123 ],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900124 shared_libs: [
Maciej Żenczykowskidcae3512022-01-31 19:59:32 -0800125 "libbase",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900126 "libcutils",
Maciej Żenczykowskidcae3512022-01-31 19:59:32 -0800127 "libnetdutils",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900128 "liblog",
129 "libnativehelper",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900130 "libnetworkstats",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900131 ],
Pete Bentleyb1456112021-01-07 13:51:18 +0000132 apex_available: [
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000133 "com.android.tethering",
Pete Bentleyb1456112021-01-07 13:51:18 +0000134 ],
135}
136
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900137java_library {
Aaron Huang63338842021-01-08 18:32:00 +0800138 name: "service-connectivity-pre-jarjar",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000139 sdk_version: "system_server_current",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000140 min_sdk_version: "30",
Remi NGUYEN VAN02eee9a2023-01-30 19:19:48 +0900141 // NetworkStackApiShimSettingsForCurrentBranch provides the latest available shims depending on
142 // the branch to "service-connectivity".
143 // There are Tethering.apk and TetheringNext.apk variants for the tethering APEX,
144 // which use NetworkStackApiStableShims and NetworkStackApiCurrentShims respectively.
145 // Note that there can be no service-connectivity-next because it would need to be configured in
146 // default_art_config.mk which doesn't support conditionals, hence this scheme of using a
147 // variable here.
148 defaults: ["NetworkStackApiShimSettingsForCurrentBranch"],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900149 srcs: [
Remi NGUYEN VANcdb45f82021-05-13 12:53:15 +0000150 "src/**/*.java",
Aaron Huang63338842021-01-08 18:32:00 +0800151 ":framework-connectivity-shared-srcs",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000152 ":services-connectivity-shared-srcs",
Motomu Utsumi166f9662022-09-01 10:35:29 +0900153 ":statslog-connectivity-java-gen",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900154 ],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900155 libs: [
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000156 "framework-annotations-lib",
Hassan Alic4f63fa2022-11-17 16:13:48 +0000157 "framework-configinfrastructure",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900158 "framework-connectivity-pre-jarjar",
Paul Duffin5118a522022-10-05 18:34:24 +0100159 // The framework-connectivity-t library is only available on T+ platforms
160 // so any calls to it must be protected with a check to ensure that it is
161 // available. The linter will detect any unprotected calls through an API
162 // but not direct calls to the implementation. So, this depends on the
163 // module lib stubs directly to ensure the linter will work correctly
164 // as depending on framework-connectivity-t would cause it to be compiled
165 // against the implementation because the two libraries are in the same
166 // APEX.
paulhu537f7202022-02-08 21:25:28 +0800167 "framework-connectivity-t.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800168 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
169 // service-connectivity and framework-tethering are in the same APEX.
170 "framework-tethering.impl",
Paul Duffin5118a522022-10-05 18:34:24 +0100171 "framework-wifi",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900172 "unsupportedappusage",
Remi NGUYEN VAN907ebd42021-03-08 22:05:03 +0900173 "ServiceConnectivityResources",
Paul Duffin5118a522022-10-05 18:34:24 +0100174 "framework-statsd",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900175 ],
176 static_libs: [
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900177 // Do not add libs here if they are already included
178 // in framework-connectivity
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800179 "androidx.annotation_annotation",
Hungming Chen01f25502022-06-28 22:47:00 +0800180 "connectivity-net-module-utils-bpf",
Tyler Wearb37f5512021-10-01 13:22:00 -0700181 "connectivity_native_aidl_interface-lateststable-java",
Kangping Dong707a9962022-12-19 16:33:55 +0800182 "dnsresolver_aidl_interface-V11-java",
William Escandeea9e22e2021-08-19 12:26:52 +0200183 "modules-utils-shell-command-handler",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900184 "net-utils-device-common",
markchien8fb75e32021-11-11 17:53:56 +0800185 "net-utils-device-common-bpf",
Patrick Rohr734f24e2022-08-09 19:23:18 -0700186 "net-utils-device-common-ip",
Xiao Ma09c07272021-07-01 14:00:34 +0000187 "net-utils-device-common-netlink",
Xiao Ma0a171c02022-01-23 16:14:51 +0000188 "net-utils-services-common",
lucaslinef337532021-01-18 11:58:24 +0800189 "netd-client",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000190 "networkstack-client",
lifrc0d25c12021-03-09 17:24:46 +0800191 "PlatformProperties",
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900192 "service-connectivity-protos",
Frank Li55f79d42022-11-25 06:00:54 +0000193 "service-connectivity-stats-protos",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900194 ],
195 apex_available: [
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000196 "com.android.tethering",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900197 ],
Woody Lin7704e692023-08-14 04:47:03 +0000198 lint: { strict_updatability_linting: true },
paulhu802ab972021-12-14 01:30:22 +0000199 visibility: [
200 "//packages/modules/Connectivity/service-t",
201 "//packages/modules/Connectivity/tests:__subpackages__",
202 ],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900203}
Aaron Huang63338842021-01-08 18:32:00 +0800204
205java_library {
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900206 name: "service-connectivity-protos",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000207 sdk_version: "system_current",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000208 min_sdk_version: "30",
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900209 proto: {
210 type: "nano",
211 },
212 srcs: [
213 ":system-messages-proto-src",
214 ],
215 libs: ["libprotobuf-java-nano"],
216 apex_available: [
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900217 "com.android.tethering",
218 ],
Paul Duffin5118a522022-10-05 18:34:24 +0100219 lint: {
220 strict_updatability_linting: true,
221 },
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900222}
223
Paul Duffin5fc809f2022-05-20 14:15:42 +0000224java_defaults {
225 name: "service-connectivity-defaults",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000226 sdk_version: "system_server_current",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000227 min_sdk_version: "30",
zhidoub33a2632022-09-06 17:58:20 +0000228 defaults: [
229 "standalone-system-server-module-optimize-defaults",
230 ],
paulhu802ab972021-12-14 01:30:22 +0000231 // This library combines system server jars that have access to different bootclasspath jars.
232 // Lower SDK service jars must not depend on higher SDK jars as that would let them
233 // transitively depend on the wrong bootclasspath jars. Sources also cannot be added here as
Remi NGUYEN VAN371e7f72022-07-25 18:52:58 +0900234 // they would depend on bootclasspath jars that may not be available.
lifrc0d25c12021-03-09 17:24:46 +0800235 static_libs: [
Aaron Huang63338842021-01-08 18:32:00 +0800236 "service-connectivity-pre-jarjar",
paulhu802ab972021-12-14 01:30:22 +0000237 "service-connectivity-tiramisu-pre-jarjar",
Remi NGUYEN VANb6cde3d2022-03-10 04:32:15 +0000238 "service-nearby-pre-jarjar",
Casey Borders13a35ea2023-07-13 00:30:38 +0000239 "service-remoteauth-pre-jarjar",
Kangping Donge7fef892023-08-11 15:30:09 +0800240 "service-thread-pre-jarjar",
Aaron Huang63338842021-01-08 18:32:00 +0800241 ],
Remi NGUYEN VAN371e7f72022-07-25 18:52:58 +0900242 // The below libraries are not actually needed to build since no source is compiled
243 // (only combining prebuilt static_libs), but they are necessary so that R8 has the right
244 // references to optimize the code. Without these, there will be missing class warnings and
245 // code may be wrongly optimized.
246 // R8 runs after jarjar, so the framework-X libraries need to be the post-jarjar artifacts
247 // (.impl), if they are not just stubs, so that the name of jarjared classes match.
248 libs: [
249 "androidx.annotation_annotation",
250 "framework-annotations-lib",
251 "framework-connectivity.impl",
252 "framework-connectivity-t.impl",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800253 "framework-tethering.impl",
Paul Duffin5118a522022-10-05 18:34:24 +0100254 "framework-wifi",
Remi NGUYEN VAN371e7f72022-07-25 18:52:58 +0900255 "libprotobuf-java-nano",
256 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900257 jarjar_rules: ":connectivity-jarjar-rules",
Aaron Huang63338842021-01-08 18:32:00 +0800258 apex_available: [
Aaron Huang63338842021-01-08 18:32:00 +0800259 "com.android.tethering",
260 ],
Remi NGUYEN VANc6f8fb02022-04-20 18:58:53 +0900261 optimize: {
Remi NGUYEN VANc6f8fb02022-04-20 18:58:53 +0900262 proguard_flags_files: ["proguard.flags"],
263 },
Paul Duffin5118a522022-10-05 18:34:24 +0100264 lint: {
265 strict_updatability_linting: true,
266 },
Aaron Huang63338842021-01-08 18:32:00 +0800267}
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900268
Paul Duffin5fc809f2022-05-20 14:15:42 +0000269// A special library created strictly for use by the tests as they need the
270// implementation library but that is not available when building from prebuilts.
271// Using a library with a different name to what is used by the prebuilts ensures
272// that this will never depend on the prebuilt.
273// Switching service-connectivity to a java_sdk_library would also have worked as
274// that has built in support for managing this but that is too big a change at this
275// point.
276java_library {
277 name: "service-connectivity-for-tests",
278 defaults: ["service-connectivity-defaults"],
279}
280
281java_library {
282 name: "service-connectivity",
283 defaults: ["service-connectivity-defaults"],
284 installable: true,
285}
286
Frank Lie6b47f32022-10-25 18:57:10 +0000287java_library_static {
288 name: "service-connectivity-stats-protos",
289 sdk_version: "system_current",
290 min_sdk_version: "30",
291 proto: {
292 type: "lite",
293 },
294 srcs: [
295 "src/com/android/metrics/stats.proto",
296 ],
297 static_libs: ["ConnectivityServiceprotos"],
298 apex_available: ["com.android.tethering"],
299}
300
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900301genrule {
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900302 name: "connectivity-jarjar-rules",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900303 defaults: ["jarjar-rules-combine-defaults"],
304 srcs: [
305 ":framework-connectivity-jarjar-rules",
306 ":service-connectivity-jarjar-gen",
307 ":service-nearby-jarjar-gen",
Casey Borders13a35ea2023-07-13 00:30:38 +0000308 ":service-remoteauth-jarjar-gen",
Kangping Donge7fef892023-08-11 15:30:09 +0800309 ":service-thread-jarjar-gen",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900310 ],
311 out: ["connectivity-jarjar-rules.txt"],
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900312 visibility: ["//packages/modules/Connectivity:__subpackages__"],
313}
Wayne Ma0ea3bdc2022-01-12 01:12:11 +0800314
315// TODO: This filegroup temporary exposes for NetworkStats. It should be
316// removed right after NetworkStats moves into mainline module.
317filegroup {
318 name: "traffic-controller-utils",
319 srcs: ["src/com/android/server/BpfNetMaps.java"],
320 visibility: ["//packages/modules/Connectivity:__subpackages__"],
321}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900322
323java_genrule {
324 name: "service-connectivity-jarjar-gen",
325 tool_files: [
326 ":service-connectivity-pre-jarjar{.jar}",
327 ":service-connectivity-tiramisu-pre-jarjar{.jar}",
328 "jarjar-excludes.txt",
329 ],
330 tools: [
331 "jarjar-rules-generator",
332 ],
333 out: ["service_connectivity_jarjar_rules.txt"],
334 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900335 "$(location :service-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900336 "$(location :service-connectivity-tiramisu-pre-jarjar{.jar}) " +
337 "--prefix android.net.connectivity " +
338 "--excludes $(location jarjar-excludes.txt) " +
339 "--output $(out)",
340 visibility: ["//visibility:private"],
341}
342
343java_genrule {
344 name: "service-nearby-jarjar-gen",
345 tool_files: [
346 ":service-nearby-pre-jarjar{.jar}",
347 "jarjar-excludes.txt",
348 ],
349 tools: [
350 "jarjar-rules-generator",
351 ],
352 out: ["service_nearby_jarjar_rules.txt"],
353 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900354 "$(location :service-nearby-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900355 "--prefix com.android.server.nearby " +
356 "--excludes $(location jarjar-excludes.txt) " +
357 "--output $(out)",
358 visibility: ["//visibility:private"],
359}
Motomu Utsumi166f9662022-09-01 10:35:29 +0900360
Casey Borders13a35ea2023-07-13 00:30:38 +0000361java_genrule {
362 name: "service-remoteauth-jarjar-gen",
363 tool_files: [
364 ":service-remoteauth-pre-jarjar{.jar}",
365 "jarjar-excludes.txt",
366 ],
367 tools: [
368 "jarjar-rules-generator",
369 ],
370 out: ["service_remoteauth_jarjar_rules.txt"],
371 cmd: "$(location jarjar-rules-generator) " +
372 "$(location :service-remoteauth-pre-jarjar{.jar}) " +
373 "--prefix com.android.server.remoteauth " +
374 "--excludes $(location jarjar-excludes.txt) " +
375 "--output $(out)",
376 visibility: ["//visibility:private"],
377}
378
Kangping Donge7fef892023-08-11 15:30:09 +0800379java_genrule {
380 name: "service-thread-jarjar-gen",
381 tool_files: [
382 ":service-thread-pre-jarjar{.jar}",
383 "jarjar-excludes.txt",
384 ],
385 tools: [
386 "jarjar-rules-generator",
387 ],
388 out: ["service_thread_jarjar_rules.txt"],
389 cmd: "$(location jarjar-rules-generator) " +
390 "$(location :service-thread-pre-jarjar{.jar}) " +
391 "--prefix com.android.server.thread " +
392 "--excludes $(location jarjar-excludes.txt) " +
393 "--output $(out)",
394 visibility: ["//visibility:private"],
395}
396
Motomu Utsumi166f9662022-09-01 10:35:29 +0900397genrule {
Paul Duffin5118a522022-10-05 18:34:24 +0100398 name: "statslog-connectivity-java-gen",
399 tools: ["stats-log-api-gen"],
400 cmd: "$(location stats-log-api-gen) --java $(out) --module connectivity --javaPackage com.android.server --javaClass ConnectivityStatsLog",
401 out: ["com/android/server/ConnectivityStatsLog.java"],
Motomu Utsumi166f9662022-09-01 10:35:29 +0900402}