blob: 99e1ddcccdbcccf9221cde5120ca72ed4340511f [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 VAN9f699212022-01-26 17:39:32 +090048// TODO: remove this default and replace with ConnectivityNextEnableDefaults. This will need to be
49// done separately in each branch due to merge conflicts.
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +090050// Defaults to enable/disable java targets that depend on
51// NetworkStackNext, which uses development APIs. "enabled" may
52// have a different value depending on the branch.
53java_defaults {
54 name: "NetworkStackNextEnableDefaults",
55 enabled: true,
56}
57// This is a placeholder comment to avoid merge conflicts
58// as the above target may have different "enabled" values
59// depending on the branch
60
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090061java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090062 name: "NetworkStackDevApiLevel",
Remi NGUYEN VAN5b3ea2f2020-11-24 02:43:44 +000063 min_sdk_version: "29",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090064 sdk_version: "system_current",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090065}
66
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090067java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090068 name: "NetworkStackReleaseApiLevel",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +090069 sdk_version: "module_31",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090070 min_sdk_version: "29",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +090071 target_sdk_version: "31",
72 libs: [
73 "framework-connectivity",
74 "framework-statsd",
75 "framework-wifi",
76 ]
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090077}
78
Lorenzo Colittid6709182021-02-22 01:38:39 +090079// Libraries for the API shims
80java_defaults {
81 name: "NetworkStackShimsDefaults",
82 libs: [
83 "androidx.annotation_annotation",
Remi NGUYEN VANc0c75412021-11-01 11:56:52 +090084 "networkstack-aidl-latest",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090085 ],
Chiachang Wangb86f43c2021-04-22 10:00:40 +080086 static_libs : [
87 "modules-utils-build_system"
88 ],
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +090089 apex_available: [
90 "com.android.tethering",
91 "//apex_available:platform", // For InProcessNetworkStack and InProcessTethering
92 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +090093 min_sdk_version: "29",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090094}
95
Lorenzo Colittid6709182021-02-22 01:38:39 +090096// Common shim code. This includes the shim interface definitions themselves, and things like
97// ShimUtils and UnsupportedApiLevelException. Compiles against system_current because ShimUtils
98// needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK.
99// TODO: consider moving ShimUtils into a library (or removing it in favour of SdkLevel) and compile
100// this target against the lowest-supported SDK (currently 29).
101java_library {
102 name: "NetworkStackShimsCommon",
103 defaults: ["NetworkStackShimsDefaults"],
104 srcs: ["apishim/common/**/*.java"],
105 sdk_version: "system_current",
106 visibility: ["//visibility:private"],
107}
108
109// Each level of the shims (29, 30, ...) is its own java_library compiled against the corresponding
110// system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level.
111java_library {
112 name: "NetworkStackApi29Shims",
113 defaults: ["NetworkStackShimsDefaults"],
114 srcs: ["apishim/29/**/*.java"],
115 libs: [
116 "NetworkStackShimsCommon",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900117 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900118 sdk_version: "system_29",
119 visibility: ["//visibility:private"],
120}
121
122java_library {
123 name: "NetworkStackApi30Shims",
124 defaults: ["NetworkStackShimsDefaults"],
125 srcs: [
126 "apishim/30/**/*.java",
127 ],
128 libs: [
129 "NetworkStackShimsCommon",
130 "NetworkStackApi29Shims",
131 ],
132 sdk_version: "system_30",
133 visibility: ["//visibility:private"],
Pedro Loureiro633685e2021-02-25 15:32:07 +0000134 lint: {
Chiachang Wang194b36f2021-10-01 11:32:46 +0800135 strict_updatability_linting: true,
Pedro Loureiro633685e2021-02-25 15:32:07 +0000136 },
Lorenzo Colittid6709182021-02-22 01:38:39 +0900137}
138
139// Shims for APIs being added to the current development version of Android. These APIs are not
Lorenzo Colitti52f7eb12021-02-24 17:10:56 +0900140// stable and have no defined version number. These could be called 10000, but they use the next
141// integer so if the next SDK release happens to use that integer, we don't need to rename them.
Lorenzo Colittid6709182021-02-22 01:38:39 +0900142java_library {
143 name: "NetworkStackApi31Shims",
144 defaults: ["NetworkStackShimsDefaults"],
145 srcs: [
146 "apishim/31/**/*.java",
147 ],
148 libs: [
149 "NetworkStackShimsCommon",
150 "NetworkStackApi29Shims",
151 "NetworkStackApi30Shims",
Chiachang Wangffe87162021-02-26 17:36:52 +0800152 "framework-connectivity",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900153 ],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900154 sdk_version: "module_31",
155 visibility: ["//visibility:private"],
156}
157
158
159// Shims for APIs being added to the current development version of Android. These APIs are not
160// stable and have no defined version number. These could be called 10000, but they use the next
161// integer so if the next SDK release happens to use that integer, we don't need to rename them.
162java_library {
Chiachang Wang9dee53b2022-01-06 15:27:56 +0800163 name: "NetworkStackApi33Shims",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900164 defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900165 srcs: [
Chiachang Wang9dee53b2022-01-06 15:27:56 +0800166 "apishim/33/**/*.java",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900167 ],
Rambo Wang1a6e89c2022-02-18 10:29:38 -0800168 static_libs: [
169 "net-utils-framework-common",
170 ],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900171 libs: [
172 "NetworkStackShimsCommon",
173 "NetworkStackApi29Shims",
174 "NetworkStackApi30Shims",
175 "NetworkStackApi31Shims",
Roopa Sattiraju16fdb5f2022-01-21 20:32:32 -0800176 "framework-bluetooth",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900177 "framework-connectivity",
paulhu93404512022-02-08 22:42:47 +0800178 "framework-connectivity-t.stubs.module_lib",
markchien52e30e62021-11-05 01:19:13 +0800179 "framework-tethering",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900180 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800181 sdk_version: "module_current",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900182 visibility: ["//visibility:private"],
183}
184
185// API current uses the API current shims directly.
186// The current (in-progress) shims are in the com.android.networkstack.apishim package and are
187// called directly by the networkstack code.
188java_library {
189 name: "NetworkStackApiCurrentShims",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900190 defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900191 static_libs: [
192 "NetworkStackShimsCommon",
193 "NetworkStackApi29Shims",
194 "NetworkStackApi30Shims",
195 "NetworkStackApi31Shims",
Chiachang Wang9dee53b2022-01-06 15:27:56 +0800196 "NetworkStackApi33Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900197 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800198 sdk_version: "module_current",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800199 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900200 "//packages/modules/Connectivity/Tethering",
Chalard Jean08a7aeb2022-01-26 19:26:11 +0900201 "//packages/modules/Connectivity/service",
202 "//packages/modules/Connectivity/service-t",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800203 "//packages/modules/Connectivity/tests/cts/net",
Taras Antoshchukdf3c0342022-01-07 18:48:25 +0000204 "//packages/modules/Connectivity/tests/cts/hostside/app",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800205 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900206}
207
208// API stable uses jarjar to rename the latest stable apishim package from
209// com.android.networkstack.apishim.apiXX to com.android.networkstack.apishim, which is called by
210// the networkstack code.
211java_library {
212 name: "NetworkStackApiStableShims",
213 defaults: ["NetworkStackShimsDefaults"],
214 static_libs: [
215 "NetworkStackShimsCommon",
216 "NetworkStackApi29Shims",
217 "NetworkStackApi30Shims",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900218 "NetworkStackApi31Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900219 ],
220 jarjar_rules: "apishim/jarjar-rules-compat.txt",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900221 sdk_version: "module_31",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800222 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900223 "//packages/modules/Connectivity/Tethering",
Chalard Jean08a7aeb2022-01-26 19:26:11 +0900224 "//packages/modules/Connectivity/service",
225 "//packages/modules/Connectivity/service-t",
Michael Groover24054d12022-02-07 14:47:00 -0800226 "//packages/modules/Connectivity/tests/cts:__subpackages__",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800227 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900228}
229
230// Common defaults for android libraries containing network stack code, used to compile variants of
231// the network stack in the system process and in the network_stack process
232java_defaults {
233 name: "NetworkStackAndroidLibraryDefaults",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900234 srcs: [
Remi NGUYEN VAN82b4b422019-01-20 09:35:10 +0900235 ":framework-networkstack-shared-srcs",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900236 ":networkstack-module-utils-srcs",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900237 ],
Artur Satayev0eb158a2019-12-10 12:54:01 +0000238 libs: ["unsupportedappusage"],
Remi NGUYEN VAN057bf202018-12-04 12:13:09 +0900239 static_libs: [
Niklas Lindgren0c904882018-12-07 11:08:04 +0100240 "androidx.annotation_annotation",
Remi NGUYEN VAN1b7a0632021-07-07 17:54:09 +0900241 "modules-utils-build_system",
William Escandef51eb692021-08-19 12:30:12 +0200242 "modules-utils-preconditions",
243 "modules-utils-statemachine",
Jeongik Cha848a5b52021-01-26 22:35:03 +0900244 "netd_aidl_interface-lateststable-java",
Remi NGUYEN VANbbb97032019-08-08 15:53:54 +0900245 "networkstack-client",
Remi NGUYEN VAN5b00d422020-06-08 15:34:22 +0900246 "net-utils-framework-common",
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900247 // See note on statsprotos when adding/updating proto build rules
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800248 "datastallprotosnano",
lifrcb15db32020-05-21 20:32:36 +0800249 "statsprotos",
paulhu5982eff2019-03-29 19:21:30 +0800250 "captiveportal-lib",
Chalard Jean6f675212020-06-25 23:41:16 +0900251 "net-utils-device-common",
Xiao Ma6f4019c2021-07-01 13:53:48 +0000252 "net-utils-device-common-netlink",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900253 ],
Kun Niuf3b69042019-07-01 17:03:20 -0700254 plugins: ["java_api_finder"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900255}
256
Lorenzo Colittid6709182021-02-22 01:38:39 +0900257// The versions of the android library containing network stack code compiled for each SDK variant.
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900258android_library {
259 name: "NetworkStackApiCurrentLib",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900260 defaults: [
261 "NetworkStackDevApiLevel",
262 "NetworkStackAndroidLibraryDefaults",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900263 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900264 ],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800265 srcs: [
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800266 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000267 ":statslog-networkstack-java-gen-current"
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800268 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900269 static_libs: ["NetworkStackApiCurrentShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900270 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900271 visibility: [
272 "//frameworks/base/tests/net/integration",
273 "//packages/modules/Connectivity/Tethering/tests/integration",
274 "//packages/modules/Connectivity/tests/cts/net",
275 "//packages/modules/NetworkStack/tests/unit",
276 "//packages/modules/NetworkStack/tests/integration",
277 ],
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800278 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900279}
280
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900281android_library {
282 name: "NetworkStackApiStableLib",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900283 defaults: ["NetworkStackReleaseApiLevel", "NetworkStackAndroidLibraryDefaults"],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800284 srcs: [
285 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000286 ":statslog-networkstack-java-gen-stable",
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800287 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900288 static_libs: ["NetworkStackApiStableShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900289 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900290 visibility: [
Remi NGUYEN VAN170801b2021-05-11 15:09:29 +0000291 "//frameworks/base/packages/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900292 "//frameworks/base/tests/net/integration",
293 "//packages/modules/Connectivity/Tethering/tests/integration",
294 "//packages/modules/Connectivity/tests/cts/net",
Remi NGUYEN VAN170801b2021-05-11 15:09:29 +0000295 "//packages/modules/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900296 "//packages/modules/NetworkStack/tests/unit",
297 "//packages/modules/NetworkStack/tests/integration",
298 ],
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800299 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900300}
301
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900302filegroup {
303 name: "NetworkStackJarJarRules",
304 srcs: ["jarjar-rules-shared.txt"],
305 visibility: [
306 "//packages/modules/NetworkStack/tests/unit",
307 "//packages/modules/NetworkStack/tests/integration",
Remi NGUYEN VAN22601e62021-07-27 14:47:50 +0900308 "//packages/modules/Connectivity/tests:__subpackages__",
Baligh Uddin1151e2e2020-10-29 02:12:29 +0000309 "//packages/modules/Connectivity/Tethering/tests/integration",
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900310 ]
311}
312
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900313// Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries
314java_defaults {
315 name: "NetworkStackAppDefaults",
316 privileged: true,
317 jni_libs: [
318 "libnativehelper_compat_libc++",
319 "libnetworkstackutilsjni",
320 ],
321 // Resources already included in NetworkStackBase
322 resource_dirs: [],
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900323 jarjar_rules: ":NetworkStackJarJarRules",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900324 use_embedded_native_libs: true,
325 optimize: {
326 proguard_flags_files: ["proguard.flags"],
327 },
328}
329
330// Non-updatable network stack running in the system server process for devices not using the module
331android_app {
332 name: "InProcessNetworkStack",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900333 defaults: [
334 "NetworkStackAppDefaults",
335 "NetworkStackDevApiLevel",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900336 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900337 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900338 static_libs: ["NetworkStackApiCurrentLib"],
339 certificate: "platform",
340 manifest: "AndroidManifest_InProcess.xml",
341 // InProcessNetworkStack is a replacement for NetworkStack
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000342 overrides: ["NetworkStack", "NetworkStackNext"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900343 // The permission configuration *must* be included to ensure security of the device
344 // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
345 // the default CaptivePortalLogin.
Aaron Huang187e9482021-04-27 20:37:07 +0800346 required: [
347 "PlatformNetworkPermissionConfig",
348 "PlatformCaptivePortalLogin",
349 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900350}
351
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900352// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
353android_library {
354 name: "NetworkStackNextManifestBase",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900355 defaults: [
356 "NetworkStackAppDefaults",
357 "NetworkStackDevApiLevel",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900358 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900359 ],
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900360 static_libs: ["NetworkStackApiCurrentLib"],
361 manifest: "AndroidManifest.xml"
362}
363
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900364// NetworkStack build targeting the current API release, for testing on in-development SDK
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900365android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000366 name: "NetworkStackNext",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900367 defaults: [
368 "NetworkStackAppDefaults",
369 "NetworkStackDevApiLevel",
Remi NGUYEN VAN9f699212022-01-26 17:39:32 +0900370 "ConnectivityNextEnableDefaults",
Remi NGUYEN VANe1aed9e2021-11-15 11:18:50 +0900371 ],
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900372 static_libs: ["NetworkStackNextManifestBase"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900373 certificate: "networkstack",
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900374 manifest: "AndroidManifest_Next.xml",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900375 // The permission configuration *must* be included to ensure security of the device
Aaron Huang187e9482021-04-27 20:37:07 +0800376 required: [
377 "NetworkPermissionConfig",
378 "privapp_whitelist_com.android.networkstack",
379 ],
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800380 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900381}
382
383// Updatable network stack for finalized API
384android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000385 name: "NetworkStack",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900386 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900387 static_libs: ["NetworkStackApiStableLib"],
388 certificate: "networkstack",
389 manifest: "AndroidManifest.xml",
390 // The permission configuration *must* be included to ensure security of the device
Aaron Huang187e9482021-04-27 20:37:07 +0800391 required: [
392 "NetworkPermissionConfig",
393 "privapp_whitelist_com.android.networkstack",
394 ],
Artur Satayev862a1a12020-04-09 11:35:52 +0100395 updatable: true,
Chiachang Wangd6a4d8f2021-11-01 18:55:14 +0800396 lint: { strict_updatability_linting: true },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900397}
398
paulhue455e2a2019-03-29 17:22:20 +0800399cc_library_shared {
400 name: "libnetworkstackutilsjni",
401 srcs: [
402 "jni/network_stack_utils_jni.cpp"
403 ],
Jooyung Hand3fb9f52020-04-29 02:43:03 +0900404 sdk_version: "29",
405 min_sdk_version: "29",
paulhue455e2a2019-03-29 17:22:20 +0800406 shared_libs: [
407 "liblog",
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900408 "libnativehelper_compat_libc++",
paulhue455e2a2019-03-29 17:22:20 +0800409 ],
Orion Hodson94561f62020-12-08 09:56:29 +0000410 static_libs: [
411 "libnetjniutils",
412 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900413
414 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
415 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
416 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
417 // build because soong complains of:
418 // module NetworkStack missing dependencies: libc++_shared
419 //
420 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
421 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
422 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
423 //
424 // TODO: find a better solution for this in R.
425 stl: "c++_static",
paulhue455e2a2019-03-29 17:22:20 +0800426 cflags: [
427 "-Wall",
428 "-Werror",
429 "-Wno-unused-parameter",
430 ],
431}
432
Chiachang Wang80242272019-04-11 21:24:28 +0800433genrule {
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000434 name: "statslog-networkstack-java-gen-current",
Chiachang Wang80242272019-04-11 21:24:28 +0800435 tools: ["stats-log-api-gen"],
436 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
Muhammad Qureshi8e0e9bc2019-12-31 11:26:33 -0800437 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000438 " --minApiLevel 29",
Chiachang Wang80242272019-04-11 21:24:28 +0800439 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
440}
Kun Niu8e89dd42019-07-16 18:33:45 -0700441
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000442genrule {
443 name: "statslog-networkstack-java-gen-stable",
444 tools: ["stats-log-api-gen"],
445 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
446 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
447 " --minApiLevel 29 --compileApiLevel 30",
448 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
449}
450
451
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900452version_code_networkstack_next = "300000000"
453version_code_networkstack_test = "999999999"
454
Kun Niu8e89dd42019-07-16 18:33:45 -0700455genrule {
456 name: "NetworkStackTestAndroidManifest",
457 srcs: ["AndroidManifest.xml"],
458 out: ["TestAndroidManifest.xml"],
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900459 cmd: "sed -E 's/versionCode=\"[0-9]+\"/versionCode=\""
460 + version_code_networkstack_test
461 + "\"/' $(in) > $(out)",
462 visibility: ["//visibility:private"],
463}
464
Kun Niu8e89dd42019-07-16 18:33:45 -0700465android_app {
466 name: "TestNetworkStack",
Remi NGUYEN VAN1d52af02020-12-22 02:08:55 +0000467 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
468 static_libs: ["NetworkStackApiStableLib"],
Kun Niu8e89dd42019-07-16 18:33:45 -0700469 certificate: "networkstack",
470 manifest: ":NetworkStackTestAndroidManifest",
Kun Niu8e89dd42019-07-16 18:33:45 -0700471 // The permission configuration *must* be included to ensure security of the device
Aaron Huang187e9482021-04-27 20:37:07 +0800472 required: [
473 "NetworkPermissionConfig",
474 "privapp_whitelist_com.android.networkstack",
475 ],
Kun Niu8e89dd42019-07-16 18:33:45 -0700476}
lifrcb15db32020-05-21 20:32:36 +0800477
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900478// When adding or modifying protos, the jarjar rules and possibly proguard rules need
479// to be updated: proto libraries may pull additional static libraries.
lifrcb15db32020-05-21 20:32:36 +0800480java_library_static {
481 name: "statsprotos",
482 proto: {
483 type: "lite",
484 },
485 srcs: [
486 "src/com/android/networkstack/metrics/stats.proto",
487 ],
488 static_libs: [
489 "networkstackprotos",
490 ],
491 defaults: ["NetworkStackReleaseApiLevel"],
492}