blob: 655a32c01a2ddfdc703fffc6332cae8e3517da41 [file] [log] [blame]
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +09001//
2// Copyright (C) 2020 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Bob Badour727b6722021-02-12 17:07:05 -080017package {
18 // See: http://go/android-license-faq
Baligh Uddin2afd0982021-05-24 03:50:01 +000019 default_applicable_licenses: ["Android-Apache-2.0"],
Bob Badour727b6722021-02-12 17:07:05 -080020}
21
Motomu Utsumi310f11a2023-09-07 19:20:07 +090022// In the branch which does not support FlaggedAPI, use this default to ignore the annotated APIs.
23java_defaults {
24 name: "FlaggedApiDefaults",
Motomu Utsumi9ee37a02023-09-12 18:00:45 +090025 api_dir: "udc-extended-api",
26 droiddoc_options: [
27 "--hide-annotation android.annotation.FlaggedApi",
28 ],
Motomu Utsumi310f11a2023-09-07 19:20:07 +090029}
30
31// The above variables may have different values
32// depending on the branch, and this comment helps
33// separate them from the rest of the file to avoid merge conflicts
34
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090035filegroup {
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090036 name: "framework-connectivity-internal-sources",
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090037 srcs: [
38 "src/**/*.java",
39 "src/**/*.aidl",
40 ],
41 path: "src",
42 visibility: [
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090043 "//visibility:private",
44 ],
45}
46
47filegroup {
48 name: "framework-connectivity-aidl-export-sources",
49 srcs: [
50 "aidl-export/**/*.aidl",
51 ],
52 path: "aidl-export",
53 visibility: [
54 "//visibility:private",
55 ],
56}
57
58// TODO: use a java_library in the bootclasspath instead
59filegroup {
60 name: "framework-connectivity-sources",
Anton Hansson57f3d692023-03-15 10:30:10 +000061 defaults: ["framework-sources-module-defaults"],
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090062 srcs: [
63 ":framework-connectivity-internal-sources",
64 ":framework-connectivity-aidl-export-sources",
65 ],
Anton Hansson57f3d692023-03-15 10:30:10 +000066 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Bob Badour727b6722021-02-12 17:07:05 -080067}
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090068
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090069java_defaults {
70 name: "framework-connectivity-defaults",
71 defaults: ["framework-module-defaults"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090072 sdk_version: "module_current",
73 min_sdk_version: "30",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090074 srcs: [
75 ":framework-connectivity-sources",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090076 ":net-utils-framework-common-srcs",
Junyu Laieb6f4be2022-01-17 11:52:57 +000077 ":framework-connectivity-api-shared-srcs",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090078 ],
79 aidl: {
Siim Sammulcd4c8222021-12-13 15:52:07 +000080 generate_get_transaction_name: true,
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090081 include_dirs: [
82 // Include directories for parcelables that are part of the stable API, and need a
83 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
84 // TODO(b/180293679): remove these dependencies as they should not be necessary once
85 // the module builds against API (the parcelable declarations exist in framework.aidl)
86 "frameworks/base/core/java", // For framework parcelables
87 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
88 ],
89 },
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090090 stub_only_libs: [
paulhu537f7202022-02-08 21:25:28 +080091 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090092 ],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090093 impl_only_libs: [
Igor Chernyshev9dac6602022-12-13 19:28:32 -080094 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
95 // framework-connectivity and framework-tethering are in the same APEX.
Mark Whitee4d44632023-07-25 23:02:43 +000096 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -080097 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090098 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090099 ],
Chalard Jeandece0d82021-11-15 18:17:33 +0900100 static_libs: [
paulhu541b72d2022-02-09 14:02:43 +0800101 "mdns_aidl_interface-lateststable-java",
Xiao Ma0a171c02022-01-23 16:14:51 +0000102 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +0900103 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900104 "modules-utils-preconditions",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400105 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +0900106 ],
Junyu Lai29b7b632023-08-23 17:35:17 +0800107 impl_only_static_libs: [
108 "net-utils-device-common-struct",
109 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900110 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +0900111 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200112 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +0800113 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900114 "unsupportedappusage",
115 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900116 apex_available: [
117 "com.android.tethering",
118 ],
119 lint: { strict_updatability_linting: true },
120}
121
122java_library {
123 name: "framework-connectivity-pre-jarjar",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900124 defaults: [
125 "framework-connectivity-defaults",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700126 ],
127 static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000128 "httpclient_api",
129 "httpclient_impl",
Stefano Duo2a907332023-06-29 18:08:39 +0100130 "http_client_logging",
Junyu Lai29b7b632023-08-23 17:35:17 +0800131 // Framework-connectivity-pre-jarjar is identical to framework-connectivity
132 // implementation, but without the jarjar rules. However, framework-connectivity
133 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source
134 // to generate the SDK stubs.
135 // Even if the library is included in "impl_only_static_libs" of defaults. This is still
136 // needed because java_library which doesn't understand "impl_only_static_libs".
137 "net-utils-device-common-struct",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700138 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900139 libs: [
140 // This cannot be in the defaults clause above because if it were, it would be used
141 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800142 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900143 // TetheringRequest depends on LinkAddress).
Mark Whitee4d44632023-07-25 23:02:43 +0000144 "framework-location.stubs.module_lib",
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800145 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900146 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900147 ],
148 visibility: ["//packages/modules/Connectivity:__subpackages__"]
149}
150
Patrick Rohr740b1d42023-05-11 13:28:54 -0700151java_defaults {
152 name: "CronetJavaDefaults",
Stefano Duo2cf46932023-07-17 14:52:16 +0000153 srcs: [":httpclient_api_sources"],
Patrick Rohr740b1d42023-05-11 13:28:54 -0700154 libs: [
155 "androidx.annotation_annotation",
156 ],
157 impl_only_static_libs: [
Stefano Duo2cf46932023-07-17 14:52:16 +0000158 "httpclient_impl",
Stefano Duo2a907332023-06-29 18:08:39 +0100159 "http_client_logging",
Patrick Rohr740b1d42023-05-11 13:28:54 -0700160 ],
161}
162
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900163java_sdk_library {
164 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900165 defaults: [
166 "framework-connectivity-defaults",
167 "CronetJavaDefaults",
Motomu Utsumi310f11a2023-09-07 19:20:07 +0900168 "FlaggedApiDefaults",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900169 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900170 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900171 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000172 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900173 impl_library_visibility: [
174 "//packages/modules/Connectivity/Tethering/apex",
175 // In preparation for future move
176 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900177 "//packages/modules/Connectivity/framework-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900178 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000179 "//packages/modules/Connectivity/service-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900180 "//frameworks/base/packages/Connectivity/service",
181 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000182
183 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800184 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900185 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000186 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN678277c2021-05-11 13:37:06 +0000187 "//frameworks/base/packages/Connectivity/tests:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900188 "//frameworks/base/core/tests/bandwidthtests",
189 "//frameworks/base/core/tests/benchmarks",
190 "//frameworks/base/core/tests/utillib",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800191 "//frameworks/base/tests/vcn",
Xiao Ma0a171c02022-01-23 16:14:51 +0000192 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000193 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800194 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumic4800392023-09-11 11:48:36 +0900195 "//packages/modules/Connectivity/staticlibs/testutils",
196 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900197 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000198 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
199 "//packages/modules/Connectivity/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800200 "//packages/modules/IPsec/tests/iketests",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000201 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800202 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900203 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000204}
205
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200206platform_compat_config {
207 name: "connectivity-platform-compat-config",
208 src: ":framework-connectivity",
209}
210
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000211cc_library_shared {
212 name: "libframework-connectivity-jni",
213 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000214 cflags: [
215 "-Wall",
216 "-Werror",
217 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000218 // Don't warn about S API usage even with
219 // min_sdk 30: the library is only loaded
220 // on S+ devices
221 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000222 "-Wthread-safety",
223 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000224 srcs: [
225 "jni/android_net_NetworkUtils.cpp",
226 "jni/onload.cpp",
227 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000228 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000229 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000230 "liblog",
231 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000232 ],
233 header_libs: [
Maciej Żenczykowski32b46a42023-03-11 01:19:40 +0000234 "bpf_headers",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000235 "dnsproxyd_protocol_headers",
236 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000237 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000238 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000239 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000240 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900241}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000242
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800243filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000244 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000245 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800246 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000247 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800248 visibility: ["//frameworks/base"],
249}
250
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400251java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800252 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400253 proto: {
254 type: "stream",
255 },
256 srcs: [":framework-connectivity-protos"],
257 installable: false,
258 sdk_version: "module_current",
259 min_sdk_version: "30",
260 apex_available: [
261 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000262 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000263}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900264
265java_genrule {
266 name: "framework-connectivity-jarjar-rules",
267 tool_files: [
268 ":connectivity-hiddenapi-files",
269 ":framework-connectivity-pre-jarjar{.jar}",
270 ":framework-connectivity-t-pre-jarjar{.jar}",
271 ":framework-connectivity.stubs.module_lib{.jar}",
272 ":framework-connectivity-t.stubs.module_lib{.jar}",
273 "jarjar-excludes.txt",
274 ],
275 tools: [
276 "jarjar-rules-generator",
277 ],
278 out: ["framework_connectivity_jarjar_rules.txt"],
279 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900280 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900281 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
282 "--prefix android.net.connectivity " +
283 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900284 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
285 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
286 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900287 "--excludes $(location jarjar-excludes.txt) " +
288 "--output $(out)",
289 visibility: [
290 "//packages/modules/Connectivity/framework:__subpackages__",
291 "//packages/modules/Connectivity/framework-t:__subpackages__",
292 "//packages/modules/Connectivity/service",
293 ],
294}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800295
296// Library providing limited APIs within the connectivity module, so that R+ components like
297// Tethering have a controlled way to depend on newer components like framework-connectivity that
298// are not loaded on R.
299java_library {
300 name: "connectivity-internal-api-util",
301 sdk_version: "module_current",
302 libs: [
303 "androidx.annotation_annotation",
304 "framework-connectivity.impl",
305 ],
306 jarjar_rules: ":framework-connectivity-jarjar-rules",
307 srcs: [
308 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.TIRAMISU),
309 // so that API checks are enforced for R+ users of this library
310 "src/android/net/connectivity/TiramisuConnectivityInternalApiUtil.java",
311 ],
312 visibility: [
313 "//packages/modules/Connectivity/Tethering:__subpackages__",
314 ],
315}