blob: 82f64ba53296f53a5e8d498bc8b59742a030bd43 [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
Remi NGUYEN VANc41daa42023-08-14 15:34:20 +090022service_remoteauth_pre_jarjar_lib = "service-remoteauth-pre-jarjar"
23
24// The above variables may have different values
25// depending on the branch, and this comment helps
26// separate them from the rest of the file to avoid merge conflicts
27
Tyler Wearb37f5512021-10-01 13:22:00 -070028aidl_interface {
29 name: "connectivity_native_aidl_interface",
30 local_include_dir: "binder",
Tyler Wearb37f5512021-10-01 13:22:00 -070031 srcs: [
32 "binder/android/net/connectivity/aidl/*.aidl",
33 ],
34 backend: {
35 java: {
36 apex_available: [
37 "com.android.tethering",
38 ],
39 min_sdk_version: "30",
40 },
41 ndk: {
42 apex_available: [
43 "com.android.tethering",
44 ],
45 min_sdk_version: "30",
46 },
47 },
48 versions: ["1"],
49
50}
51
52cc_library_static {
53 name: "connectivity_native_aidl_interface-lateststable-ndk",
54 min_sdk_version: "30",
55 whole_static_libs: [
56 "connectivity_native_aidl_interface-V1-ndk",
57 ],
58 apex_available: [
59 "com.android.tethering",
60 ],
61}
62
63java_library {
64 name: "connectivity_native_aidl_interface-lateststable-java",
65 sdk_version: "system_current",
66 min_sdk_version: "30",
67 static_libs: [
68 "connectivity_native_aidl_interface-V1-java",
69 ],
70 apex_available: [
71 "com.android.tethering",
72 ],
73}
74
markchien8fb75e32021-11-11 17:53:56 +080075// The library name match the service-connectivity jarjar rules that put the JNI utils in the
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090076// android.net.connectivity.com.android.net.module.util package.
markchien8fb75e32021-11-11 17:53:56 +080077cc_library_shared {
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090078 name: "libandroid_net_connectivity_com_android_net_module_util_jni",
markchien8fb75e32021-11-11 17:53:56 +080079 min_sdk_version: "30",
80 cflags: [
81 "-Wall",
82 "-Werror",
83 "-Wno-unused-parameter",
84 "-Wthread-safety",
85 ],
86 srcs: [
87 "jni/com_android_net_module_util/onload.cpp",
88 ],
markchien8fb75e32021-11-11 17:53:56 +080089 static_libs: [
90 "libnet_utils_device_common_bpfjni",
Tyler Wearb37f5512021-10-01 13:22:00 -070091 "libnet_utils_device_common_bpfutils",
markchien8fb75e32021-11-11 17:53:56 +080092 ],
93 shared_libs: [
94 "liblog",
95 "libnativehelper",
96 ],
97 apex_available: [
98 "com.android.tethering",
99 ],
100}
101
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000102cc_library_shared {
103 name: "libservice-connectivity",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000104 min_sdk_version: "30",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900105 cflags: [
106 "-Wall",
107 "-Werror",
108 "-Wno-unused-parameter",
109 "-Wthread-safety",
Kangping Dong192e4b02023-10-25 20:34:21 +0800110
111 // AServiceManager_waitForService is available on only 31+, but it's still safe for Thread
112 // service because it's enabled on only 34+
113 "-Wno-unguarded-availability",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900114 ],
115 srcs: [
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900116 ":services.connectivity-netstats-jni-sources",
Hungming Chene2cf0552021-12-25 17:05:41 +0800117 "jni/com_android_server_connectivity_ClatCoordinator.cpp",
Kangping Dong192e4b02023-10-25 20:34:21 +0800118 "jni/com_android_server_ServiceManagerWrapper.cpp",
Patrick Rohr361b8592022-01-28 15:39:17 +0100119 "jni/com_android_server_TestNetworkService.cpp",
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000120 "jni/onload.cpp",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900121 ],
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000122 header_libs: [
Patrick Rohr361b8592022-01-28 15:39:17 +0100123 "bpf_connectivity_headers",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000124 ],
Hungming Chene2cf0552021-12-25 17:05:41 +0800125 static_libs: [
126 "libclat",
127 "libip_checksum",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900128 "libmodules-utils-build",
Hungming Chene2cf0552021-12-25 17:05:41 +0800129 "libnetjniutils",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900130 "libnet_utils_device_common_bpfjni",
Patrick Rohr361b8592022-01-28 15:39:17 +0100131 "netd_aidl_interface-lateststable-ndk",
Hungming Chene2cf0552021-12-25 17:05:41 +0800132 ],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900133 shared_libs: [
Maciej Żenczykowskidcae3512022-01-31 19:59:32 -0800134 "libbase",
Kangping Dong192e4b02023-10-25 20:34:21 +0800135 "libbinder_ndk",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900136 "libcutils",
Maciej Żenczykowskidcae3512022-01-31 19:59:32 -0800137 "libnetdutils",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900138 "liblog",
139 "libnativehelper",
Remi NGUYEN VANd9504892022-02-02 13:03:29 +0900140 "libnetworkstats",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900141 ],
Pete Bentleyb1456112021-01-07 13:51:18 +0000142 apex_available: [
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000143 "com.android.tethering",
Pete Bentleyb1456112021-01-07 13:51:18 +0000144 ],
145}
146
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900147java_library {
Aaron Huang63338842021-01-08 18:32:00 +0800148 name: "service-connectivity-pre-jarjar",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000149 sdk_version: "system_server_current",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000150 min_sdk_version: "30",
Remi NGUYEN VAN02eee9a2023-01-30 19:19:48 +0900151 // NetworkStackApiShimSettingsForCurrentBranch provides the latest available shims depending on
152 // the branch to "service-connectivity".
153 // There are Tethering.apk and TetheringNext.apk variants for the tethering APEX,
154 // which use NetworkStackApiStableShims and NetworkStackApiCurrentShims respectively.
155 // Note that there can be no service-connectivity-next because it would need to be configured in
156 // default_art_config.mk which doesn't support conditionals, hence this scheme of using a
157 // variable here.
158 defaults: ["NetworkStackApiShimSettingsForCurrentBranch"],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900159 srcs: [
Remi NGUYEN VANcdb45f82021-05-13 12:53:15 +0000160 "src/**/*.java",
Aaron Huang63338842021-01-08 18:32:00 +0800161 ":framework-connectivity-shared-srcs",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000162 ":services-connectivity-shared-srcs",
Motomu Utsumi166f9662022-09-01 10:35:29 +0900163 ":statslog-connectivity-java-gen",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900164 ],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900165 libs: [
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000166 "framework-annotations-lib",
Hassan Alic4f63fa2022-11-17 16:13:48 +0000167 "framework-configinfrastructure",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900168 "framework-connectivity-pre-jarjar",
Paul Duffin5118a522022-10-05 18:34:24 +0100169 // The framework-connectivity-t library is only available on T+ platforms
170 // so any calls to it must be protected with a check to ensure that it is
171 // available. The linter will detect any unprotected calls through an API
172 // but not direct calls to the implementation. So, this depends on the
173 // module lib stubs directly to ensure the linter will work correctly
174 // as depending on framework-connectivity-t would cause it to be compiled
175 // against the implementation because the two libraries are in the same
176 // APEX.
paulhu537f7202022-02-08 21:25:28 +0800177 "framework-connectivity-t.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800178 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
179 // service-connectivity and framework-tethering are in the same APEX.
180 "framework-tethering.impl",
Paul Duffin5118a522022-10-05 18:34:24 +0100181 "framework-wifi",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900182 "unsupportedappusage",
Remi NGUYEN VAN907ebd42021-03-08 22:05:03 +0900183 "ServiceConnectivityResources",
Paul Duffin5118a522022-10-05 18:34:24 +0100184 "framework-statsd",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900185 ],
186 static_libs: [
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900187 // Do not add libs here if they are already included
188 // in framework-connectivity
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800189 "androidx.annotation_annotation",
Hungming Chen01f25502022-06-28 22:47:00 +0800190 "connectivity-net-module-utils-bpf",
Tyler Wearb37f5512021-10-01 13:22:00 -0700191 "connectivity_native_aidl_interface-lateststable-java",
Ken Chen5a35cf92023-10-07 07:54:22 +0800192 "dnsresolver_aidl_interface-V12-java",
William Escandeea9e22e2021-08-19 12:26:52 +0200193 "modules-utils-shell-command-handler",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900194 "net-utils-device-common",
Patrick Rohr734f24e2022-08-09 19:23:18 -0700195 "net-utils-device-common-ip",
Xiao Ma09c07272021-07-01 14:00:34 +0000196 "net-utils-device-common-netlink",
Xiao Ma0a171c02022-01-23 16:14:51 +0000197 "net-utils-services-common",
lucaslinef337532021-01-18 11:58:24 +0800198 "netd-client",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000199 "networkstack-client",
lifrc0d25c12021-03-09 17:24:46 +0800200 "PlatformProperties",
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900201 "service-connectivity-protos",
Frank Li55f79d42022-11-25 06:00:54 +0000202 "service-connectivity-stats-protos",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900203 ],
204 apex_available: [
Remi NGUYEN VANeaa96582021-01-08 01:19:44 +0000205 "com.android.tethering",
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900206 ],
Woody Lin7704e692023-08-14 04:47:03 +0000207 lint: { strict_updatability_linting: true },
paulhu802ab972021-12-14 01:30:22 +0000208 visibility: [
209 "//packages/modules/Connectivity/service-t",
210 "//packages/modules/Connectivity/tests:__subpackages__",
Kangping Dong192e4b02023-10-25 20:34:21 +0800211 "//packages/modules/Connectivity/thread/service:__subpackages__",
212 "//packages/modules/Connectivity/thread/tests:__subpackages__",
paulhu802ab972021-12-14 01:30:22 +0000213 ],
Remi NGUYEN VAN59262cb2020-12-21 18:40:08 +0900214}
Aaron Huang63338842021-01-08 18:32:00 +0800215
216java_library {
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900217 name: "service-connectivity-protos",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000218 sdk_version: "system_current",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000219 min_sdk_version: "30",
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900220 proto: {
221 type: "nano",
222 },
223 srcs: [
224 ":system-messages-proto-src",
225 ],
226 libs: ["libprotobuf-java-nano"],
227 apex_available: [
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900228 "com.android.tethering",
229 ],
Paul Duffin5118a522022-10-05 18:34:24 +0100230 lint: {
231 strict_updatability_linting: true,
232 },
Remi NGUYEN VANd8bc0fa2021-03-11 15:41:52 +0900233}
234
Paul Duffin5fc809f2022-05-20 14:15:42 +0000235java_defaults {
236 name: "service-connectivity-defaults",
Remi NGUYEN VAN4ee6c502021-03-22 10:25:12 +0000237 sdk_version: "system_server_current",
Remi NGUYEN VANda43ef02021-03-23 14:45:58 +0000238 min_sdk_version: "30",
zhidoub33a2632022-09-06 17:58:20 +0000239 defaults: [
240 "standalone-system-server-module-optimize-defaults",
241 ],
paulhu802ab972021-12-14 01:30:22 +0000242 // This library combines system server jars that have access to different bootclasspath jars.
243 // Lower SDK service jars must not depend on higher SDK jars as that would let them
244 // transitively depend on the wrong bootclasspath jars. Sources also cannot be added here as
Remi NGUYEN VAN371e7f72022-07-25 18:52:58 +0900245 // they would depend on bootclasspath jars that may not be available.
lifrc0d25c12021-03-09 17:24:46 +0800246 static_libs: [
Aaron Huang63338842021-01-08 18:32:00 +0800247 "service-connectivity-pre-jarjar",
paulhu802ab972021-12-14 01:30:22 +0000248 "service-connectivity-tiramisu-pre-jarjar",
Remi NGUYEN VANb6cde3d2022-03-10 04:32:15 +0000249 "service-nearby-pre-jarjar",
Remi NGUYEN VANc41daa42023-08-14 15:34:20 +0900250 service_remoteauth_pre_jarjar_lib,
Kangping Donge7fef892023-08-11 15:30:09 +0800251 "service-thread-pre-jarjar",
Aaron Huang63338842021-01-08 18:32:00 +0800252 ],
Remi NGUYEN VAN371e7f72022-07-25 18:52:58 +0900253 // The below libraries are not actually needed to build since no source is compiled
254 // (only combining prebuilt static_libs), but they are necessary so that R8 has the right
255 // references to optimize the code. Without these, there will be missing class warnings and
256 // code may be wrongly optimized.
257 // R8 runs after jarjar, so the framework-X libraries need to be the post-jarjar artifacts
258 // (.impl), if they are not just stubs, so that the name of jarjared classes match.
259 libs: [
260 "androidx.annotation_annotation",
261 "framework-annotations-lib",
262 "framework-connectivity.impl",
263 "framework-connectivity-t.impl",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800264 "framework-tethering.impl",
Paul Duffin5118a522022-10-05 18:34:24 +0100265 "framework-wifi",
Remi NGUYEN VAN371e7f72022-07-25 18:52:58 +0900266 "libprotobuf-java-nano",
267 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900268 jarjar_rules: ":connectivity-jarjar-rules",
Aaron Huang63338842021-01-08 18:32:00 +0800269 apex_available: [
Aaron Huang63338842021-01-08 18:32:00 +0800270 "com.android.tethering",
271 ],
Remi NGUYEN VANc6f8fb02022-04-20 18:58:53 +0900272 optimize: {
Remi NGUYEN VANc6f8fb02022-04-20 18:58:53 +0900273 proguard_flags_files: ["proguard.flags"],
274 },
Paul Duffin5118a522022-10-05 18:34:24 +0100275 lint: {
276 strict_updatability_linting: true,
277 },
Aaron Huang63338842021-01-08 18:32:00 +0800278}
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900279
Paul Duffin5fc809f2022-05-20 14:15:42 +0000280// A special library created strictly for use by the tests as they need the
281// implementation library but that is not available when building from prebuilts.
282// Using a library with a different name to what is used by the prebuilts ensures
283// that this will never depend on the prebuilt.
284// Switching service-connectivity to a java_sdk_library would also have worked as
285// that has built in support for managing this but that is too big a change at this
286// point.
287java_library {
288 name: "service-connectivity-for-tests",
289 defaults: ["service-connectivity-defaults"],
290}
291
292java_library {
293 name: "service-connectivity",
294 defaults: ["service-connectivity-defaults"],
295 installable: true,
296}
297
Frank Lie6b47f32022-10-25 18:57:10 +0000298java_library_static {
299 name: "service-connectivity-stats-protos",
300 sdk_version: "system_current",
301 min_sdk_version: "30",
302 proto: {
303 type: "lite",
304 },
305 srcs: [
306 "src/com/android/metrics/stats.proto",
307 ],
308 static_libs: ["ConnectivityServiceprotos"],
309 apex_available: ["com.android.tethering"],
310}
311
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900312genrule {
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900313 name: "connectivity-jarjar-rules",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900314 defaults: ["jarjar-rules-combine-defaults"],
315 srcs: [
316 ":framework-connectivity-jarjar-rules",
317 ":service-connectivity-jarjar-gen",
318 ":service-nearby-jarjar-gen",
Casey Borders13a35ea2023-07-13 00:30:38 +0000319 ":service-remoteauth-jarjar-gen",
Kangping Donge7fef892023-08-11 15:30:09 +0800320 ":service-thread-jarjar-gen",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900321 ],
322 out: ["connectivity-jarjar-rules.txt"],
Remi NGUYEN VAN8ea5ee62021-06-28 18:48:43 +0900323 visibility: ["//packages/modules/Connectivity:__subpackages__"],
324}
Wayne Ma0ea3bdc2022-01-12 01:12:11 +0800325
326// TODO: This filegroup temporary exposes for NetworkStats. It should be
327// removed right after NetworkStats moves into mainline module.
328filegroup {
329 name: "traffic-controller-utils",
330 srcs: ["src/com/android/server/BpfNetMaps.java"],
331 visibility: ["//packages/modules/Connectivity:__subpackages__"],
332}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900333
334java_genrule {
335 name: "service-connectivity-jarjar-gen",
336 tool_files: [
337 ":service-connectivity-pre-jarjar{.jar}",
338 ":service-connectivity-tiramisu-pre-jarjar{.jar}",
339 "jarjar-excludes.txt",
340 ],
341 tools: [
342 "jarjar-rules-generator",
343 ],
344 out: ["service_connectivity_jarjar_rules.txt"],
345 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900346 "$(location :service-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900347 "$(location :service-connectivity-tiramisu-pre-jarjar{.jar}) " +
348 "--prefix android.net.connectivity " +
349 "--excludes $(location jarjar-excludes.txt) " +
350 "--output $(out)",
351 visibility: ["//visibility:private"],
352}
353
354java_genrule {
355 name: "service-nearby-jarjar-gen",
356 tool_files: [
357 ":service-nearby-pre-jarjar{.jar}",
358 "jarjar-excludes.txt",
359 ],
360 tools: [
361 "jarjar-rules-generator",
362 ],
363 out: ["service_nearby_jarjar_rules.txt"],
364 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900365 "$(location :service-nearby-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900366 "--prefix com.android.server.nearby " +
367 "--excludes $(location jarjar-excludes.txt) " +
368 "--output $(out)",
369 visibility: ["//visibility:private"],
370}
Motomu Utsumi166f9662022-09-01 10:35:29 +0900371
Casey Borders13a35ea2023-07-13 00:30:38 +0000372java_genrule {
373 name: "service-remoteauth-jarjar-gen",
374 tool_files: [
Remi NGUYEN VANc41daa42023-08-14 15:34:20 +0900375 ":" + service_remoteauth_pre_jarjar_lib + "{.jar}",
Casey Borders13a35ea2023-07-13 00:30:38 +0000376 "jarjar-excludes.txt",
377 ],
378 tools: [
379 "jarjar-rules-generator",
380 ],
381 out: ["service_remoteauth_jarjar_rules.txt"],
382 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VANc41daa42023-08-14 15:34:20 +0900383 "$(location :" + service_remoteauth_pre_jarjar_lib + "{.jar}) " +
Casey Borders13a35ea2023-07-13 00:30:38 +0000384 "--prefix com.android.server.remoteauth " +
385 "--excludes $(location jarjar-excludes.txt) " +
386 "--output $(out)",
387 visibility: ["//visibility:private"],
388}
389
Kangping Donge7fef892023-08-11 15:30:09 +0800390java_genrule {
391 name: "service-thread-jarjar-gen",
392 tool_files: [
393 ":service-thread-pre-jarjar{.jar}",
394 "jarjar-excludes.txt",
395 ],
396 tools: [
397 "jarjar-rules-generator",
398 ],
399 out: ["service_thread_jarjar_rules.txt"],
400 cmd: "$(location jarjar-rules-generator) " +
401 "$(location :service-thread-pre-jarjar{.jar}) " +
402 "--prefix com.android.server.thread " +
403 "--excludes $(location jarjar-excludes.txt) " +
404 "--output $(out)",
405 visibility: ["//visibility:private"],
406}
407
Motomu Utsumi166f9662022-09-01 10:35:29 +0900408genrule {
Paul Duffin5118a522022-10-05 18:34:24 +0100409 name: "statslog-connectivity-java-gen",
410 tools: ["stats-log-api-gen"],
411 cmd: "$(location stats-log-api-gen) --java $(out) --module connectivity --javaPackage com.android.server --javaClass ConnectivityStatsLog",
412 out: ["com/android/server/ConnectivityStatsLog.java"],
Motomu Utsumi166f9662022-09-01 10:35:29 +0900413}