blob: 4b3d55873ffbf357fb1abcc7eadd375243140fe4 [file] [log] [blame]
Remi NGUYEN VANded23152018-12-07 16:52:24 +09001//
2// Copyright (C) 2018 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
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090017// The network stack can be compiled using system_current (non-finalized) SDK, or finalized system_X
18// SDK. There is also a variant that uses system_current SDK and runs in the system process
19// (InProcessNetworkStack). The following structure is used to create the build rules:
20//
21// NetworkStackAndroidLibraryDefaults <-- common defaults for android libs
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +090022// / \
23// +NetworkStackApiStableShims --> / \ <-- +NetworkStackApiCurrentShims
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090024// +NetworkStackReleaseApiLevel / \ +NetworkStackDevApiLevel
Lorenzo Colittid6709182021-02-22 01:38:39 +090025// +jarjar apishim.api[latest].* / \
26// to apishim.* / \
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +090027// / \
Lorenzo Colittid6709182021-02-22 01:38:39 +090028// / \
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +090029// / \ android libs w/ all code
Lorenzo Colittid6709182021-02-22 01:38:39 +090030// / <- +module src/ -> \ (also used in unit tests)
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +090031// / \ |
32// NetworkStackApiStableLib NetworkStackApiCurrentLib <--*
33// | |
34// | <-- +NetworkStackAppDefaults --> |
35// | (APK build params) |
36// | |
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090037// | <-- +NetworkStackReleaseApiLevel | <-- +NetworkStackDevApiLevel
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +090038// | |
39// | |
40// NetworkStackApiStable NetworkStack, InProcessNetworkStack, <-- APKs
41// TestNetworkStack
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090042
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090043// Common defaults to define SDK level
Bob Badourdd486972021-02-12 15:05:06 -080044package {
45 default_applicable_licenses: ["Android-Apache-2.0"],
46}
47
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +090048// In some branches, this may be module_current instead of module_33 if the SDK prebuilts are not
49// yet dropped there, meaning module_33 cannot be used yet.
50module_33_version = "module_33"
51
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +090052// TODO: remove this default and replace with ConnectivityNextEnableDefaults. This will need to be
53// done separately in each branch due to merge conflicts.
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +090054// Defaults to enable/disable java targets that depend on
55// NetworkStackNext, which uses development APIs. "enabled" may
56// have a different value depending on the branch.
57java_defaults {
58 name: "NetworkStackNextEnableDefaults",
59 enabled: true,
60}
61// This is a placeholder comment to avoid merge conflicts
62// as the above target may have different "enabled" values
63// depending on the branch
64
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090065java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090066 name: "NetworkStackDevApiLevel",
Remi NGUYEN VAN5b3ea2f2020-11-24 02:43:44 +000067 min_sdk_version: "29",
Chiachang Wange8486de2022-03-21 09:53:41 +080068 sdk_version: "module_current",
69 libs: [
70 "framework-connectivity",
Chiachang Wange3770412022-03-28 10:07:08 +080071 "framework-connectivity-t",
Chiachang Wange8486de2022-03-21 09:53:41 +080072 "framework-statsd",
73 "framework-wifi",
74 ]
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090075}
76
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090077java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090078 name: "NetworkStackReleaseApiLevel",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +090079 sdk_version: module_33_version,
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090080 min_sdk_version: "29",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +090081 target_sdk_version: "33",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +090082 libs: [
83 "framework-connectivity",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +090084 "framework-connectivity-t",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +090085 "framework-statsd",
86 "framework-wifi",
87 ]
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090088}
89
Lorenzo Colittid6709182021-02-22 01:38:39 +090090// Libraries for the API shims
91java_defaults {
92 name: "NetworkStackShimsDefaults",
93 libs: [
94 "androidx.annotation_annotation",
Remi NGUYEN VANc0c75412021-11-01 11:56:52 +090095 "networkstack-aidl-latest",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090096 ],
Chiachang Wangb86f43c2021-04-22 10:00:40 +080097 static_libs : [
98 "modules-utils-build_system"
99 ],
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900100 apex_available: [
101 "com.android.tethering",
102 "//apex_available:platform", // For InProcessNetworkStack and InProcessTethering
103 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900104 min_sdk_version: "29",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900105}
106
Lorenzo Colittid6709182021-02-22 01:38:39 +0900107// Common shim code. This includes the shim interface definitions themselves, and things like
108// ShimUtils and UnsupportedApiLevelException. Compiles against system_current because ShimUtils
109// needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK.
110// TODO: consider moving ShimUtils into a library (or removing it in favour of SdkLevel) and compile
111// this target against the lowest-supported SDK (currently 29).
112java_library {
113 name: "NetworkStackShimsCommon",
114 defaults: ["NetworkStackShimsDefaults"],
115 srcs: ["apishim/common/**/*.java"],
116 sdk_version: "system_current",
117 visibility: ["//visibility:private"],
118}
119
120// Each level of the shims (29, 30, ...) is its own java_library compiled against the corresponding
121// system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level.
122java_library {
123 name: "NetworkStackApi29Shims",
124 defaults: ["NetworkStackShimsDefaults"],
125 srcs: ["apishim/29/**/*.java"],
126 libs: [
127 "NetworkStackShimsCommon",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900128 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900129 sdk_version: "system_29",
130 visibility: ["//visibility:private"],
131}
132
133java_library {
134 name: "NetworkStackApi30Shims",
135 defaults: ["NetworkStackShimsDefaults"],
136 srcs: [
137 "apishim/30/**/*.java",
138 ],
139 libs: [
140 "NetworkStackShimsCommon",
141 "NetworkStackApi29Shims",
142 ],
143 sdk_version: "system_30",
144 visibility: ["//visibility:private"],
Pedro Loureiro633685e2021-02-25 15:32:07 +0000145 lint: {
Chiachang Wang194b36f2021-10-01 11:32:46 +0800146 strict_updatability_linting: true,
Pedro Loureiro633685e2021-02-25 15:32:07 +0000147 },
Lorenzo Colittid6709182021-02-22 01:38:39 +0900148}
149
Lorenzo Colittid6709182021-02-22 01:38:39 +0900150java_library {
151 name: "NetworkStackApi31Shims",
152 defaults: ["NetworkStackShimsDefaults"],
153 srcs: [
154 "apishim/31/**/*.java",
155 ],
156 libs: [
157 "NetworkStackShimsCommon",
158 "NetworkStackApi29Shims",
159 "NetworkStackApi30Shims",
Chiachang Wangffe87162021-02-26 17:36:52 +0800160 "framework-connectivity",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900161 ],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900162 sdk_version: "module_31",
163 visibility: ["//visibility:private"],
164}
165
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900166java_library {
Chiachang Wang9dee53b2022-01-06 15:27:56 +0800167 name: "NetworkStackApi33Shims",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900168 defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900169 srcs: [
Chiachang Wang9dee53b2022-01-06 15:27:56 +0800170 "apishim/33/**/*.java",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900171 ],
Rambo Wang1a6e89c2022-02-18 10:29:38 -0800172 static_libs: [
173 "net-utils-framework-common",
174 ],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900175 libs: [
176 "NetworkStackShimsCommon",
177 "NetworkStackApi29Shims",
178 "NetworkStackApi30Shims",
179 "NetworkStackApi31Shims",
Roopa Sattirajueff9ba12022-01-21 20:32:32 -0800180 "framework-bluetooth",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900181 "framework-connectivity",
paulhufe450bf2022-02-08 22:42:47 +0800182 "framework-connectivity-t.stubs.module_lib",
markchien52e30e62021-11-05 01:19:13 +0800183 "framework-tethering",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900184 ],
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +0900185 sdk_version: module_33_version,
186 visibility: ["//visibility:private"],
187}
188
189// Shims for APIs being added to the current development version of Android. These APIs are not
190// stable and have no defined version number. These could be called 10000, but they use the next
191// integer so if the next SDK release happens to use that integer, we don't need to rename them.
192java_library {
193 name: "NetworkStackApi34Shims",
194 defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"],
195 srcs: [
196 "apishim/34/**/*.java",
197 ],
198 static_libs: [
199 "net-utils-framework-common",
200 ],
201 libs: [
202 "NetworkStackShimsCommon",
203 "NetworkStackApi29Shims",
204 "NetworkStackApi30Shims",
205 "NetworkStackApi31Shims",
206 "NetworkStackApi33Shims",
207 "framework-bluetooth",
208 "framework-connectivity",
209 "framework-connectivity-t.stubs.module_lib",
210 "framework-tethering",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +0900211 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800212 sdk_version: "module_current",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900213 visibility: ["//visibility:private"],
214}
215
216// API current uses the API current shims directly.
217// The current (in-progress) shims are in the com.android.networkstack.apishim package and are
218// called directly by the networkstack code.
219java_library {
220 name: "NetworkStackApiCurrentShims",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +0900221 defaults: [
222 "NetworkStackShimsDefaults",
223 "NetworkStackDevApiLevel",
224 "ConnectivityNextEnableDefaults",
225 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900226 static_libs: [
227 "NetworkStackShimsCommon",
228 "NetworkStackApi29Shims",
229 "NetworkStackApi30Shims",
230 "NetworkStackApi31Shims",
Chiachang Wang9dee53b2022-01-06 15:27:56 +0800231 "NetworkStackApi33Shims",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +0900232 "NetworkStackApi34Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900233 ],
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800234 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900235 "//packages/modules/Connectivity/Tethering",
Chalard Jean08a7aeb2022-01-26 19:26:11 +0900236 "//packages/modules/Connectivity/service",
237 "//packages/modules/Connectivity/service-t",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800238 "//packages/modules/Connectivity/tests/cts/net",
Taras Antoshchukdf3c0342022-01-07 18:48:25 +0000239 "//packages/modules/Connectivity/tests/cts/hostside/app",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800240 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900241}
242
243// API stable uses jarjar to rename the latest stable apishim package from
244// com.android.networkstack.apishim.apiXX to com.android.networkstack.apishim, which is called by
245// the networkstack code.
246java_library {
247 name: "NetworkStackApiStableShims",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +0900248 defaults: ["NetworkStackShimsDefaults", "NetworkStackReleaseApiLevel"],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900249 static_libs: [
250 "NetworkStackShimsCommon",
251 "NetworkStackApi29Shims",
252 "NetworkStackApi30Shims",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900253 "NetworkStackApi31Shims",
Remi NGUYEN VAN38a6de02022-05-02 14:07:43 +0900254 "NetworkStackApi33Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900255 ],
256 jarjar_rules: "apishim/jarjar-rules-compat.txt",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800257 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900258 "//packages/modules/Connectivity/Tethering",
Chalard Jean08a7aeb2022-01-26 19:26:11 +0900259 "//packages/modules/Connectivity/service",
260 "//packages/modules/Connectivity/service-t",
Michael Groover24054d12022-02-07 14:47:00 -0800261 "//packages/modules/Connectivity/tests/cts:__subpackages__",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800262 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900263}
264
265// Common defaults for android libraries containing network stack code, used to compile variants of
266// the network stack in the system process and in the network_stack process
267java_defaults {
268 name: "NetworkStackAndroidLibraryDefaults",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900269 srcs: [
Remi NGUYEN VAN82b4b422019-01-20 09:35:10 +0900270 ":framework-networkstack-shared-srcs",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900271 ":networkstack-module-utils-srcs",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900272 ],
Artur Satayev0eb158a2019-12-10 12:54:01 +0000273 libs: ["unsupportedappusage"],
Remi NGUYEN VAN057bf202018-12-04 12:13:09 +0900274 static_libs: [
Niklas Lindgren0c904882018-12-07 11:08:04 +0100275 "androidx.annotation_annotation",
Remi NGUYEN VAN1b7a0632021-07-07 17:54:09 +0900276 "modules-utils-build_system",
William Escandef51eb692021-08-19 12:30:12 +0200277 "modules-utils-preconditions",
278 "modules-utils-statemachine",
Jeongik Cha848a5b52021-01-26 22:35:03 +0900279 "netd_aidl_interface-lateststable-java",
Remi NGUYEN VANbbb97032019-08-08 15:53:54 +0900280 "networkstack-client",
Remi NGUYEN VAN5b00d422020-06-08 15:34:22 +0900281 "net-utils-framework-common",
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900282 // See note on statsprotos when adding/updating proto build rules
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800283 "datastallprotosnano",
lifrcb15db32020-05-21 20:32:36 +0800284 "statsprotos",
paulhu5982eff2019-03-29 19:21:30 +0800285 "captiveportal-lib",
Chalard Jean6f675212020-06-25 23:41:16 +0900286 "net-utils-device-common",
Xiao Ma6f4019c2021-07-01 13:53:48 +0000287 "net-utils-device-common-netlink",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900288 ],
Kun Niuf3b69042019-07-01 17:03:20 -0700289 plugins: ["java_api_finder"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900290}
291
Lorenzo Colittid6709182021-02-22 01:38:39 +0900292// The versions of the android library containing network stack code compiled for each SDK variant.
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900293android_library {
294 name: "NetworkStackApiCurrentLib",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900295 defaults: [
296 "NetworkStackDevApiLevel",
297 "NetworkStackAndroidLibraryDefaults",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900298 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900299 ],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800300 srcs: [
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800301 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000302 ":statslog-networkstack-java-gen-current"
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800303 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900304 static_libs: ["NetworkStackApiCurrentShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900305 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900306 visibility: [
307 "//frameworks/base/tests/net/integration",
308 "//packages/modules/Connectivity/Tethering/tests/integration",
309 "//packages/modules/Connectivity/tests/cts/net",
310 "//packages/modules/NetworkStack/tests/unit",
311 "//packages/modules/NetworkStack/tests/integration",
312 ],
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800313 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900314}
315
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900316android_library {
317 name: "NetworkStackApiStableLib",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900318 defaults: ["NetworkStackReleaseApiLevel", "NetworkStackAndroidLibraryDefaults"],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800319 srcs: [
320 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000321 ":statslog-networkstack-java-gen-stable",
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800322 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900323 static_libs: ["NetworkStackApiStableShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900324 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900325 visibility: [
Remi NGUYEN VAN170801b2021-05-11 15:09:29 +0000326 "//frameworks/base/packages/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900327 "//frameworks/base/tests/net/integration",
328 "//packages/modules/Connectivity/Tethering/tests/integration",
329 "//packages/modules/Connectivity/tests/cts/net",
Remi NGUYEN VAN170801b2021-05-11 15:09:29 +0000330 "//packages/modules/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900331 "//packages/modules/NetworkStack/tests/unit",
332 "//packages/modules/NetworkStack/tests/integration",
333 ],
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800334 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900335}
336
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900337filegroup {
338 name: "NetworkStackJarJarRules",
339 srcs: ["jarjar-rules-shared.txt"],
340 visibility: [
341 "//packages/modules/NetworkStack/tests/unit",
342 "//packages/modules/NetworkStack/tests/integration",
Remi NGUYEN VAN22601e62021-07-27 14:47:50 +0900343 "//packages/modules/Connectivity/tests:__subpackages__",
Baligh Uddin1151e2e2020-10-29 02:12:29 +0000344 "//packages/modules/Connectivity/Tethering/tests/integration",
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900345 ]
346}
347
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900348// Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries
349java_defaults {
350 name: "NetworkStackAppDefaults",
351 privileged: true,
352 jni_libs: [
353 "libnativehelper_compat_libc++",
354 "libnetworkstackutilsjni",
355 ],
356 // Resources already included in NetworkStackBase
357 resource_dirs: [],
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900358 jarjar_rules: ":NetworkStackJarJarRules",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900359 use_embedded_native_libs: true,
360 optimize: {
361 proguard_flags_files: ["proguard.flags"],
362 },
363}
364
365// Non-updatable network stack running in the system server process for devices not using the module
366android_app {
367 name: "InProcessNetworkStack",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900368 defaults: [
369 "NetworkStackAppDefaults",
370 "NetworkStackDevApiLevel",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900371 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900372 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900373 static_libs: ["NetworkStackApiCurrentLib"],
374 certificate: "platform",
375 manifest: "AndroidManifest_InProcess.xml",
376 // InProcessNetworkStack is a replacement for NetworkStack
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000377 overrides: ["NetworkStack", "NetworkStackNext"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900378 // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
379 // the default CaptivePortalLogin.
Aaron Huang187e9482021-04-27 20:37:07 +0800380 required: [
Aaron Huang187e9482021-04-27 20:37:07 +0800381 "PlatformCaptivePortalLogin",
382 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900383}
384
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900385// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
386android_library {
387 name: "NetworkStackNextManifestBase",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900388 defaults: [
389 "NetworkStackAppDefaults",
390 "NetworkStackDevApiLevel",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900391 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900392 ],
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900393 static_libs: ["NetworkStackApiCurrentLib"],
394 manifest: "AndroidManifest.xml"
395}
396
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900397// NetworkStack build targeting the current API release, for testing on in-development SDK
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900398android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000399 name: "NetworkStackNext",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900400 defaults: [
401 "NetworkStackAppDefaults",
402 "NetworkStackDevApiLevel",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900403 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900404 ],
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900405 static_libs: ["NetworkStackNextManifestBase"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900406 certificate: "networkstack",
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900407 manifest: "AndroidManifest_Next.xml",
Aaron Huang187e9482021-04-27 20:37:07 +0800408 required: [
Aaron Huang187e9482021-04-27 20:37:07 +0800409 "privapp_whitelist_com.android.networkstack",
410 ],
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800411 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900412}
413
414// Updatable network stack for finalized API
415android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000416 name: "NetworkStack",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900417 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900418 static_libs: ["NetworkStackApiStableLib"],
419 certificate: "networkstack",
420 manifest: "AndroidManifest.xml",
Aaron Huang187e9482021-04-27 20:37:07 +0800421 required: [
Aaron Huang187e9482021-04-27 20:37:07 +0800422 "privapp_whitelist_com.android.networkstack",
423 ],
Artur Satayev862a1a12020-04-09 11:35:52 +0100424 updatable: true,
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800425 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900426}
427
paulhue455e2a2019-03-29 17:22:20 +0800428cc_library_shared {
429 name: "libnetworkstackutilsjni",
430 srcs: [
431 "jni/network_stack_utils_jni.cpp"
432 ],
Jooyung Hand3fb9f52020-04-29 02:43:03 +0900433 sdk_version: "29",
434 min_sdk_version: "29",
paulhue455e2a2019-03-29 17:22:20 +0800435 shared_libs: [
436 "liblog",
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900437 "libnativehelper_compat_libc++",
paulhue455e2a2019-03-29 17:22:20 +0800438 ],
Orion Hodson94561f62020-12-08 09:56:29 +0000439 static_libs: [
440 "libnetjniutils",
441 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900442
443 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
444 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
445 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
446 // build because soong complains of:
447 // module NetworkStack missing dependencies: libc++_shared
448 //
449 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
450 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
451 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
452 //
453 // TODO: find a better solution for this in R.
454 stl: "c++_static",
paulhue455e2a2019-03-29 17:22:20 +0800455 cflags: [
456 "-Wall",
457 "-Werror",
458 "-Wno-unused-parameter",
459 ],
460}
461
Chiachang Wang80242272019-04-11 21:24:28 +0800462genrule {
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000463 name: "statslog-networkstack-java-gen-current",
Chiachang Wang80242272019-04-11 21:24:28 +0800464 tools: ["stats-log-api-gen"],
465 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
Muhammad Qureshi8e0e9bc2019-12-31 11:26:33 -0800466 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000467 " --minApiLevel 29",
Chiachang Wang80242272019-04-11 21:24:28 +0800468 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
469}
Kun Niu8e89dd42019-07-16 18:33:45 -0700470
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000471genrule {
472 name: "statslog-networkstack-java-gen-stable",
473 tools: ["stats-log-api-gen"],
474 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
475 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
476 " --minApiLevel 29 --compileApiLevel 30",
477 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
478}
479
480
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900481version_code_networkstack_next = "300000000"
482version_code_networkstack_test = "999999999"
483
Kun Niu8e89dd42019-07-16 18:33:45 -0700484genrule {
485 name: "NetworkStackTestAndroidManifest",
486 srcs: ["AndroidManifest.xml"],
487 out: ["TestAndroidManifest.xml"],
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900488 cmd: "sed -E 's/versionCode=\"[0-9]+\"/versionCode=\""
489 + version_code_networkstack_test
490 + "\"/' $(in) > $(out)",
491 visibility: ["//visibility:private"],
492}
493
Kun Niu8e89dd42019-07-16 18:33:45 -0700494android_app {
495 name: "TestNetworkStack",
Remi NGUYEN VAN1d52af02020-12-22 02:08:55 +0000496 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
497 static_libs: ["NetworkStackApiStableLib"],
Kun Niu8e89dd42019-07-16 18:33:45 -0700498 certificate: "networkstack",
499 manifest: ":NetworkStackTestAndroidManifest",
Aaron Huang187e9482021-04-27 20:37:07 +0800500 required: [
Aaron Huang187e9482021-04-27 20:37:07 +0800501 "privapp_whitelist_com.android.networkstack",
502 ],
Kun Niu8e89dd42019-07-16 18:33:45 -0700503}
lifrcb15db32020-05-21 20:32:36 +0800504
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900505// When adding or modifying protos, the jarjar rules and possibly proguard rules need
506// to be updated: proto libraries may pull additional static libraries.
lifrcb15db32020-05-21 20:32:36 +0800507java_library_static {
508 name: "statsprotos",
509 proto: {
510 type: "lite",
511 },
512 srcs: [
513 "src/com/android/networkstack/metrics/stats.proto",
514 ],
515 static_libs: [
516 "networkstackprotos",
517 ],
518 defaults: ["NetworkStackReleaseApiLevel"],
519}