blob: 875d33b13231614585aa46a520e5cf5319d82986 [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
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090022filegroup {
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090023 name: "framework-connectivity-internal-sources",
Remi NGUYEN VAN66ea68e2021-01-15 16:22:36 +090024 srcs: [
25 "src/**/*.java",
26 "src/**/*.aidl",
27 ],
28 path: "src",
29 visibility: [
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090030 "//visibility:private",
31 ],
32}
33
34filegroup {
35 name: "framework-connectivity-aidl-export-sources",
36 srcs: [
37 "aidl-export/**/*.aidl",
38 ],
39 path: "aidl-export",
40 visibility: [
41 "//visibility:private",
42 ],
43}
44
45// TODO: use a java_library in the bootclasspath instead
46filegroup {
47 name: "framework-connectivity-sources",
Anton Hansson57f3d692023-03-15 10:30:10 +000048 defaults: ["framework-sources-module-defaults"],
Remi NGUYEN VANad43ca62021-02-15 20:16:28 +090049 srcs: [
50 ":framework-connectivity-internal-sources",
51 ":framework-connectivity-aidl-export-sources",
52 ],
Anton Hansson57f3d692023-03-15 10:30:10 +000053 visibility: ["//packages/modules/Connectivity:__subpackages__"],
Bob Badour727b6722021-02-12 17:07:05 -080054}
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090055
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090056java_defaults {
57 name: "framework-connectivity-defaults",
58 defaults: ["framework-module-defaults"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090059 sdk_version: "module_current",
60 min_sdk_version: "30",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090061 srcs: [
62 ":framework-connectivity-sources",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090063 ":net-utils-framework-common-srcs",
Junyu Laieb6f4be2022-01-17 11:52:57 +000064 ":framework-connectivity-api-shared-srcs",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090065 ],
66 aidl: {
Siim Sammulcd4c8222021-12-13 15:52:07 +000067 generate_get_transaction_name: true,
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090068 include_dirs: [
69 // Include directories for parcelables that are part of the stable API, and need a
70 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
71 // TODO(b/180293679): remove these dependencies as they should not be necessary once
72 // the module builds against API (the parcelable declarations exist in framework.aidl)
73 "frameworks/base/core/java", // For framework parcelables
74 "frameworks/native/aidl/binder", // For PersistableBundle.aidl
75 ],
76 },
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090077 stub_only_libs: [
paulhu537f7202022-02-08 21:25:28 +080078 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090079 ],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090080 impl_only_libs: [
Igor Chernyshev9dac6602022-12-13 19:28:32 -080081 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both
82 // framework-connectivity and framework-tethering are in the same APEX.
83 "framework-tethering.impl",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +090084 "framework-wifi.stubs.module_lib",
85 "net-utils-device-common",
86 ],
Chalard Jeandece0d82021-11-15 18:17:33 +090087 static_libs: [
paulhu541b72d2022-02-09 14:02:43 +080088 "mdns_aidl_interface-lateststable-java",
Xiao Ma0a171c02022-01-23 16:14:51 +000089 "modules-utils-backgroundthread",
Chalard Jeandece0d82021-11-15 18:17:33 +090090 "modules-utils-build",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +090091 "modules-utils-preconditions",
Vinh Tran6d8c1d72022-06-08 01:25:14 -040092 "framework-connectivity-javastream-protos",
Chalard Jeandece0d82021-11-15 18:17:33 +090093 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090094 libs: [
Jooyung Hanc8375542022-06-24 19:16:40 +090095 "androidx.annotation_annotation",
Taras Antoshchuk30d41e52021-08-02 18:06:35 +020096 "app-compat-annotations",
paulhu537f7202022-02-08 21:25:28 +080097 "framework-connectivity-t.stubs.module_lib",
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +090098 "unsupportedappusage",
99 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900100 apex_available: [
101 "com.android.tethering",
102 ],
103 lint: { strict_updatability_linting: true },
104}
105
106java_library {
107 name: "framework-connectivity-pre-jarjar",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900108 defaults: [
109 "framework-connectivity-defaults",
110 "CronetJavaPrejarjarDefaults",
111 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900112 libs: [
113 // This cannot be in the defaults clause above because if it were, it would be used
114 // to generate the connectivity stubs. That would create a circular dependency
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800115 // because the tethering impl depend on the connectivity stubs (e.g.,
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900116 // TetheringRequest depends on LinkAddress).
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800117 "framework-tethering.impl",
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900118 "framework-wifi.stubs.module_lib",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900119 ],
120 visibility: ["//packages/modules/Connectivity:__subpackages__"]
121}
122
123java_sdk_library {
124 name: "framework-connectivity",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900125 defaults: [
126 "framework-connectivity-defaults",
127 "CronetJavaDefaults",
128 ],
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900129 installable: true,
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900130 jarjar_rules: ":framework-connectivity-jarjar-rules",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000131 permitted_packages: ["android.net"],
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900132 impl_library_visibility: [
133 "//packages/modules/Connectivity/Tethering/apex",
134 // In preparation for future move
135 "//packages/modules/Connectivity/apex",
Remi NGUYEN VAN6a20eed2022-01-31 11:21:08 +0900136 "//packages/modules/Connectivity/framework-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900137 "//packages/modules/Connectivity/service",
paulhu802ab972021-12-14 01:30:22 +0000138 "//packages/modules/Connectivity/service-t",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900139 "//frameworks/base/packages/Connectivity/service",
140 "//frameworks/base",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000141
142 // Tests using hidden APIs
Chiachang Wang32708712021-04-14 11:48:19 +0800143 "//cts/tests/netlegacy22.api",
Lorenzo Colittieb8d8552022-02-01 13:51:42 +0900144 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000145 "//external/sl4a:__subpackages__",
Remi NGUYEN VAN678277c2021-05-11 13:37:06 +0000146 "//frameworks/base/packages/Connectivity/tests:__subpackages__",
Remi NGUYEN VAN85a4e072022-02-02 20:06:56 +0900147 "//frameworks/base/core/tests/bandwidthtests",
148 "//frameworks/base/core/tests/benchmarks",
149 "//frameworks/base/core/tests/utillib",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800150 "//frameworks/base/tests/vcn",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000151 "//frameworks/libs/net/common/testutils",
152 "//frameworks/libs/net/common/tests:__subpackages__",
Xiao Ma0a171c02022-01-23 16:14:51 +0000153 "//frameworks/opt/net/ethernet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000154 "//frameworks/opt/telephony/tests/telephonytests",
Chiachang Wang426a6de2021-04-13 11:15:36 +0800155 "//packages/modules/CaptivePortalLogin/tests",
Motomu Utsumi73e2e872023-04-14 19:22:42 +0900156 "//packages/modules/Connectivity/Cronet/tests:__subpackages__",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000157 "//packages/modules/Connectivity/Tethering/tests:__subpackages__",
158 "//packages/modules/Connectivity/tests:__subpackages__",
Aaron Huang720ad7c2022-01-26 00:43:10 +0800159 "//packages/modules/IPsec/tests/iketests",
Remi NGUYEN VAN173f8b12021-03-16 01:31:07 +0000160 "//packages/modules/NetworkStack/tests:__subpackages__",
Chiachang Wange9d848e2021-03-31 16:11:37 +0800161 "//packages/modules/Wifi/service/tests/wifitests",
Remi NGUYEN VAN71d64e72021-03-24 22:59:50 +0900162 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000163}
164
Taras Antoshchuk30d41e52021-08-02 18:06:35 +0200165platform_compat_config {
166 name: "connectivity-platform-compat-config",
167 src: ":framework-connectivity",
168}
169
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000170cc_library_shared {
171 name: "libframework-connectivity-jni",
172 min_sdk_version: "30",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000173 cflags: [
174 "-Wall",
175 "-Werror",
176 "-Wno-unused-parameter",
Remi NGUYEN VANb36fb992021-03-23 14:45:58 +0000177 // Don't warn about S API usage even with
178 // min_sdk 30: the library is only loaded
179 // on S+ devices
180 "-Wno-unguarded-availability",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000181 "-Wthread-safety",
182 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000183 srcs: [
184 "jni/android_net_NetworkUtils.cpp",
185 "jni/onload.cpp",
186 ],
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000187 shared_libs: [
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000188 "libandroid",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000189 "liblog",
190 "libnativehelper",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000191 ],
192 header_libs: [
193 "dnsproxyd_protocol_headers",
194 ],
Remi NGUYEN VANdeed4cb2021-04-02 06:38:46 +0000195 stl: "none",
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000196 apex_available: [
Remi NGUYEN VANc58c9932021-03-19 10:13:40 +0000197 "com.android.tethering",
Remi NGUYEN VAN3b52af92021-03-19 00:24:45 +0000198 ],
Remi NGUYEN VAN11b5a5c2021-01-28 13:37:03 +0900199}
Junyu Laieb6f4be2022-01-17 11:52:57 +0000200
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800201filegroup {
Junyu Laieb6f4be2022-01-17 11:52:57 +0000202 name: "framework-connectivity-protos",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000203 srcs: [
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800204 "proto/**/*.proto",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000205 ],
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800206 visibility: ["//frameworks/base"],
207}
208
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400209java_library {
Aaron Huangdac7e4b2022-02-14 21:38:14 +0800210 name: "framework-connectivity-javastream-protos",
Vinh Tran6d8c1d72022-06-08 01:25:14 -0400211 proto: {
212 type: "stream",
213 },
214 srcs: [":framework-connectivity-protos"],
215 installable: false,
216 sdk_version: "module_current",
217 min_sdk_version: "30",
218 apex_available: [
219 "com.android.tethering",
Junyu Laieb6f4be2022-01-17 11:52:57 +0000220 ],
Junyu Laieb6f4be2022-01-17 11:52:57 +0000221}
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900222
223java_genrule {
224 name: "framework-connectivity-jarjar-rules",
225 tool_files: [
226 ":connectivity-hiddenapi-files",
227 ":framework-connectivity-pre-jarjar{.jar}",
228 ":framework-connectivity-t-pre-jarjar{.jar}",
229 ":framework-connectivity.stubs.module_lib{.jar}",
230 ":framework-connectivity-t.stubs.module_lib{.jar}",
231 "jarjar-excludes.txt",
232 ],
233 tools: [
234 "jarjar-rules-generator",
235 ],
236 out: ["framework_connectivity_jarjar_rules.txt"],
237 cmd: "$(location jarjar-rules-generator) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900238 "$(location :framework-connectivity-pre-jarjar{.jar}) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900239 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " +
240 "--prefix android.net.connectivity " +
241 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
Remi NGUYEN VAN0bd90f12022-08-10 20:15:46 +0900242 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
243 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
244 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
Remi NGUYEN VANe55a88d2022-04-20 15:59:16 +0900245 "--excludes $(location jarjar-excludes.txt) " +
246 "--output $(out)",
247 visibility: [
248 "//packages/modules/Connectivity/framework:__subpackages__",
249 "//packages/modules/Connectivity/framework-t:__subpackages__",
250 "//packages/modules/Connectivity/service",
251 ],
252}
Igor Chernyshev9dac6602022-12-13 19:28:32 -0800253
254// Library providing limited APIs within the connectivity module, so that R+ components like
255// Tethering have a controlled way to depend on newer components like framework-connectivity that
256// are not loaded on R.
257java_library {
258 name: "connectivity-internal-api-util",
259 sdk_version: "module_current",
260 libs: [
261 "androidx.annotation_annotation",
262 "framework-connectivity.impl",
263 ],
264 jarjar_rules: ":framework-connectivity-jarjar-rules",
265 srcs: [
266 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.TIRAMISU),
267 // so that API checks are enforced for R+ users of this library
268 "src/android/net/connectivity/TiramisuConnectivityInternalApiUtil.java",
269 ],
270 visibility: [
271 "//packages/modules/Connectivity/Tethering:__subpackages__",
272 ],
273}