blob: dd2d391c613fb3801bb6de2c50a1c4587c520d5a [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
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +090048// Whether to enable the targets in this file that target current SDKs.
49// Set to false in branches like mainline-prod where API classes are too old to build current code.
50enable_current_sdk_targets = true
51
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090052java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090053 name: "NetworkStackDevApiLevel",
Remi NGUYEN VAN5b3ea2f2020-11-24 02:43:44 +000054 min_sdk_version: "29",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090055 sdk_version: "system_current",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090056}
57
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090058java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090059 name: "NetworkStackReleaseApiLevel",
Remi NGUYEN VANd8c1cba2021-06-09 19:43:28 +090060 sdk_version: "module_current",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090061 min_sdk_version: "29",
Remi NGUYEN VAN32cea1b2021-06-08 12:18:15 +090062 target_sdk_version: "31",
63 libs: [
64 "framework-connectivity",
65 "framework-statsd",
66 "framework-wifi",
67 ]
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090068}
69
Lorenzo Colittid6709182021-02-22 01:38:39 +090070// Libraries for the API shims
71java_defaults {
72 name: "NetworkStackShimsDefaults",
73 libs: [
74 "androidx.annotation_annotation",
75 "networkstack-client",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090076 ],
Chiachang Wangb86f43c2021-04-22 10:00:40 +080077 static_libs : [
78 "modules-utils-build_system"
79 ],
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +090080 apex_available: [
81 "com.android.tethering",
82 "//apex_available:platform", // For InProcessNetworkStack and InProcessTethering
83 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +090084 min_sdk_version: "29",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090085}
86
Lorenzo Colittid6709182021-02-22 01:38:39 +090087// Common shim code. This includes the shim interface definitions themselves, and things like
88// ShimUtils and UnsupportedApiLevelException. Compiles against system_current because ShimUtils
89// needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK.
90// TODO: consider moving ShimUtils into a library (or removing it in favour of SdkLevel) and compile
91// this target against the lowest-supported SDK (currently 29).
92java_library {
93 name: "NetworkStackShimsCommon",
94 defaults: ["NetworkStackShimsDefaults"],
95 srcs: ["apishim/common/**/*.java"],
96 sdk_version: "system_current",
97 visibility: ["//visibility:private"],
98}
99
100// Each level of the shims (29, 30, ...) is its own java_library compiled against the corresponding
101// system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level.
102java_library {
103 name: "NetworkStackApi29Shims",
104 defaults: ["NetworkStackShimsDefaults"],
105 srcs: ["apishim/29/**/*.java"],
106 libs: [
107 "NetworkStackShimsCommon",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900108 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900109 sdk_version: "system_29",
110 visibility: ["//visibility:private"],
111}
112
113java_library {
114 name: "NetworkStackApi30Shims",
115 defaults: ["NetworkStackShimsDefaults"],
116 srcs: [
117 "apishim/30/**/*.java",
118 ],
119 libs: [
120 "NetworkStackShimsCommon",
121 "NetworkStackApi29Shims",
122 ],
123 sdk_version: "system_30",
124 visibility: ["//visibility:private"],
Pedro Loureirod443fb12021-02-25 15:32:07 +0000125 lint: {
126 baseline_filename: "lint-baseline-api-30-shims.xml",
127 },
Lorenzo Colittid6709182021-02-22 01:38:39 +0900128}
129
130// Shims for APIs being added to the current development version of Android. These APIs are not
Lorenzo Colitti52f7eb12021-02-24 17:10:56 +0900131// stable and have no defined version number. These could be called 10000, but they use the next
132// 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 +0900133java_library {
134 name: "NetworkStackApi31Shims",
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +0900135 enabled: enable_current_sdk_targets,
Lorenzo Colittid6709182021-02-22 01:38:39 +0900136 defaults: ["NetworkStackShimsDefaults"],
137 srcs: [
138 "apishim/31/**/*.java",
139 ],
140 libs: [
141 "NetworkStackShimsCommon",
142 "NetworkStackApi29Shims",
143 "NetworkStackApi30Shims",
Chiachang Wangffe87162021-02-26 17:36:52 +0800144 "framework-connectivity",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900145 ],
Remi NGUYEN VANd8c1cba2021-06-09 19:43:28 +0900146 sdk_version: "module_current",
Remi NGUYEN VAN32cea1b2021-06-08 12:18:15 +0900147 visibility: ["//visibility:private"],
148}
149
150
151// Shims for APIs being added to the current development version of Android. These APIs are not
152// stable and have no defined version number. These could be called 10000, but they use the next
153// integer so if the next SDK release happens to use that integer, we don't need to rename them.
154java_library {
155 name: "NetworkStackApi32Shims",
156 defaults: ["NetworkStackShimsDefaults"],
157 srcs: [
158 "apishim/32/**/*.java",
159 ],
160 libs: [
161 "NetworkStackShimsCommon",
162 "NetworkStackApi29Shims",
163 "NetworkStackApi30Shims",
164 "NetworkStackApi31Shims",
165 "framework-connectivity",
166 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800167 sdk_version: "module_current",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900168 visibility: ["//visibility:private"],
169}
170
171// API current uses the API current shims directly.
172// The current (in-progress) shims are in the com.android.networkstack.apishim package and are
173// called directly by the networkstack code.
174java_library {
175 name: "NetworkStackApiCurrentShims",
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +0900176 enabled: enable_current_sdk_targets,
Lorenzo Colittid6709182021-02-22 01:38:39 +0900177 defaults: ["NetworkStackShimsDefaults"],
178 static_libs: [
179 "NetworkStackShimsCommon",
180 "NetworkStackApi29Shims",
181 "NetworkStackApi30Shims",
182 "NetworkStackApi31Shims",
Remi NGUYEN VAN32cea1b2021-06-08 12:18:15 +0900183 "NetworkStackApi32Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900184 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800185 sdk_version: "module_current",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800186 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900187 "//packages/modules/Connectivity/Tethering",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800188 "//packages/modules/Connectivity/tests/cts/net",
189 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900190}
191
192// API stable uses jarjar to rename the latest stable apishim package from
193// com.android.networkstack.apishim.apiXX to com.android.networkstack.apishim, which is called by
194// the networkstack code.
195java_library {
196 name: "NetworkStackApiStableShims",
197 defaults: ["NetworkStackShimsDefaults"],
198 static_libs: [
199 "NetworkStackShimsCommon",
200 "NetworkStackApi29Shims",
201 "NetworkStackApi30Shims",
Remi NGUYEN VAN32cea1b2021-06-08 12:18:15 +0900202 "NetworkStackApi31Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900203 ],
204 jarjar_rules: "apishim/jarjar-rules-compat.txt",
Remi NGUYEN VANd8c1cba2021-06-09 19:43:28 +0900205 sdk_version: "module_current",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800206 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900207 "//packages/modules/Connectivity/Tethering",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800208 "//packages/modules/Connectivity/tests/cts/net",
209 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900210}
211
212// Common defaults for android libraries containing network stack code, used to compile variants of
213// the network stack in the system process and in the network_stack process
214java_defaults {
215 name: "NetworkStackAndroidLibraryDefaults",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900216 srcs: [
Remi NGUYEN VAN82b4b422019-01-20 09:35:10 +0900217 ":framework-networkstack-shared-srcs",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900218 ":networkstack-module-utils-srcs",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900219 ],
Artur Satayev0eb158a2019-12-10 12:54:01 +0000220 libs: ["unsupportedappusage"],
Remi NGUYEN VAN057bf202018-12-04 12:13:09 +0900221 static_libs: [
Niklas Lindgren0c904882018-12-07 11:08:04 +0100222 "androidx.annotation_annotation",
Remi NGUYEN VAN1b7a0632021-07-07 17:54:09 +0900223 "modules-utils-build_system",
Jeongik Cha848a5b52021-01-26 22:35:03 +0900224 "netd_aidl_interface-lateststable-java",
Remi NGUYEN VAN1fc930c2019-08-09 13:23:47 +0900225 "netlink-client",
Remi NGUYEN VANbbb97032019-08-08 15:53:54 +0900226 "networkstack-client",
Remi NGUYEN VAN5b00d422020-06-08 15:34:22 +0900227 "net-utils-framework-common",
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900228 // See note on statsprotos when adding/updating proto build rules
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800229 "datastallprotosnano",
lifrcb15db32020-05-21 20:32:36 +0800230 "statsprotos",
paulhu5982eff2019-03-29 19:21:30 +0800231 "captiveportal-lib",
Chalard Jean6f675212020-06-25 23:41:16 +0900232 "net-utils-device-common",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900233 ],
Kun Niuf3b69042019-07-01 17:03:20 -0700234 plugins: ["java_api_finder"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900235}
236
Lorenzo Colittid6709182021-02-22 01:38:39 +0900237// The versions of the android library containing network stack code compiled for each SDK variant.
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900238android_library {
239 name: "NetworkStackApiCurrentLib",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900240 defaults: ["NetworkStackDevApiLevel", "NetworkStackAndroidLibraryDefaults"],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800241 srcs: [
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800242 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000243 ":statslog-networkstack-java-gen-current"
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800244 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900245 static_libs: ["NetworkStackApiCurrentShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900246 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +0900247 enabled: enable_current_sdk_targets,
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900248 visibility: [
249 "//frameworks/base/tests/net/integration",
250 "//packages/modules/Connectivity/Tethering/tests/integration",
251 "//packages/modules/Connectivity/tests/cts/net",
252 "//packages/modules/NetworkStack/tests/unit",
253 "//packages/modules/NetworkStack/tests/integration",
254 ],
Pedro Loureirod443fb12021-02-25 15:32:07 +0000255 lint: {
256 baseline_filename: "lint-baseline-current-lib.xml",
257 },
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900258}
259
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900260android_library {
261 name: "NetworkStackApiStableLib",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900262 defaults: ["NetworkStackReleaseApiLevel", "NetworkStackAndroidLibraryDefaults"],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800263 srcs: [
264 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000265 ":statslog-networkstack-java-gen-stable",
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800266 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900267 static_libs: ["NetworkStackApiStableShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900268 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900269 visibility: [
Remi NGUYEN VANb01e7192021-05-11 15:09:29 +0000270 "//frameworks/base/packages/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900271 "//frameworks/base/tests/net/integration",
272 "//packages/modules/Connectivity/Tethering/tests/integration",
273 "//packages/modules/Connectivity/tests/cts/net",
Remi NGUYEN VANb01e7192021-05-11 15:09:29 +0000274 "//packages/modules/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900275 "//packages/modules/NetworkStack/tests/unit",
276 "//packages/modules/NetworkStack/tests/integration",
277 ],
Pedro Loureirod443fb12021-02-25 15:32:07 +0000278 lint: {
279 baseline_filename: "lint-baseline-stable-lib.xml",
280 },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900281}
282
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900283filegroup {
284 name: "NetworkStackJarJarRules",
285 srcs: ["jarjar-rules-shared.txt"],
286 visibility: [
287 "//packages/modules/NetworkStack/tests/unit",
288 "//packages/modules/NetworkStack/tests/integration",
Baligh Uddin1151e2e2020-10-29 02:12:29 +0000289 "//packages/modules/Connectivity/Tethering/tests/integration",
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900290 ]
291}
292
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900293// Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries
294java_defaults {
295 name: "NetworkStackAppDefaults",
296 privileged: true,
297 jni_libs: [
298 "libnativehelper_compat_libc++",
299 "libnetworkstackutilsjni",
300 ],
301 // Resources already included in NetworkStackBase
302 resource_dirs: [],
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900303 jarjar_rules: ":NetworkStackJarJarRules",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900304 use_embedded_native_libs: true,
305 optimize: {
306 proguard_flags_files: ["proguard.flags"],
307 },
308}
309
310// Non-updatable network stack running in the system server process for devices not using the module
311android_app {
312 name: "InProcessNetworkStack",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900313 defaults: [ "NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900314 static_libs: ["NetworkStackApiCurrentLib"],
315 certificate: "platform",
316 manifest: "AndroidManifest_InProcess.xml",
317 // InProcessNetworkStack is a replacement for NetworkStack
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000318 overrides: ["NetworkStack", "NetworkStackNext"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900319 // The permission configuration *must* be included to ensure security of the device
320 // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
321 // the default CaptivePortalLogin.
Aaron Huang788f37a2021-04-27 20:37:07 +0800322 required: [
323 "PlatformNetworkPermissionConfig",
324 "PlatformCaptivePortalLogin",
325 ],
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +0900326 enabled: enable_current_sdk_targets,
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900327}
328
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900329// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
330android_library {
331 name: "NetworkStackNextManifestBase",
332 defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
333 static_libs: ["NetworkStackApiCurrentLib"],
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +0900334 manifest: "AndroidManifest.xml",
335 enabled: enable_current_sdk_targets,
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900336}
337
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900338// NetworkStack build targeting the current API release, for testing on in-development SDK
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900339android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000340 name: "NetworkStackNext",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900341 defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900342 static_libs: ["NetworkStackNextManifestBase"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900343 certificate: "networkstack",
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900344 manifest: "AndroidManifest_Next.xml",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900345 // The permission configuration *must* be included to ensure security of the device
Aaron Huang788f37a2021-04-27 20:37:07 +0800346 required: [
347 "NetworkPermissionConfig",
348 "privapp_whitelist_com.android.networkstack",
349 ],
Lorenzo Colitti0600a8a2021-03-04 15:50:27 +0900350 enabled: enable_current_sdk_targets,
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900351}
352
353// Updatable network stack for finalized API
354android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000355 name: "NetworkStack",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900356 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900357 static_libs: ["NetworkStackApiStableLib"],
358 certificate: "networkstack",
359 manifest: "AndroidManifest.xml",
360 // The permission configuration *must* be included to ensure security of the device
Aaron Huang788f37a2021-04-27 20:37:07 +0800361 required: [
362 "NetworkPermissionConfig",
363 "privapp_whitelist_com.android.networkstack",
364 ],
Artur Satayev862a1a12020-04-09 11:35:52 +0100365 updatable: true,
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900366}
367
paulhue455e2a2019-03-29 17:22:20 +0800368cc_library_shared {
369 name: "libnetworkstackutilsjni",
370 srcs: [
371 "jni/network_stack_utils_jni.cpp"
372 ],
Jooyung Hand3fb9f52020-04-29 02:43:03 +0900373 sdk_version: "29",
374 min_sdk_version: "29",
paulhue455e2a2019-03-29 17:22:20 +0800375 shared_libs: [
376 "liblog",
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900377 "libnativehelper_compat_libc++",
paulhue455e2a2019-03-29 17:22:20 +0800378 ],
Orion Hodson94561f62020-12-08 09:56:29 +0000379 static_libs: [
380 "libnetjniutils",
381 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900382
383 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
384 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
385 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
386 // build because soong complains of:
387 // module NetworkStack missing dependencies: libc++_shared
388 //
389 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
390 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
391 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
392 //
393 // TODO: find a better solution for this in R.
394 stl: "c++_static",
paulhue455e2a2019-03-29 17:22:20 +0800395 cflags: [
396 "-Wall",
397 "-Werror",
398 "-Wno-unused-parameter",
399 ],
400}
401
Chiachang Wang80242272019-04-11 21:24:28 +0800402genrule {
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000403 name: "statslog-networkstack-java-gen-current",
Chiachang Wang80242272019-04-11 21:24:28 +0800404 tools: ["stats-log-api-gen"],
405 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
Muhammad Qureshi8e0e9bc2019-12-31 11:26:33 -0800406 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000407 " --minApiLevel 29",
Chiachang Wang80242272019-04-11 21:24:28 +0800408 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
409}
Kun Niu8e89dd42019-07-16 18:33:45 -0700410
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000411genrule {
412 name: "statslog-networkstack-java-gen-stable",
413 tools: ["stats-log-api-gen"],
414 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
415 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
416 " --minApiLevel 29 --compileApiLevel 30",
417 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
418}
419
420
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900421version_code_networkstack_next = "300000000"
422version_code_networkstack_test = "999999999"
423
Kun Niu8e89dd42019-07-16 18:33:45 -0700424genrule {
425 name: "NetworkStackTestAndroidManifest",
426 srcs: ["AndroidManifest.xml"],
427 out: ["TestAndroidManifest.xml"],
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900428 cmd: "sed -E 's/versionCode=\"[0-9]+\"/versionCode=\""
429 + version_code_networkstack_test
430 + "\"/' $(in) > $(out)",
431 visibility: ["//visibility:private"],
432}
433
Kun Niu8e89dd42019-07-16 18:33:45 -0700434android_app {
435 name: "TestNetworkStack",
Remi NGUYEN VAN1d52af02020-12-22 02:08:55 +0000436 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
437 static_libs: ["NetworkStackApiStableLib"],
Kun Niu8e89dd42019-07-16 18:33:45 -0700438 certificate: "networkstack",
439 manifest: ":NetworkStackTestAndroidManifest",
Kun Niu8e89dd42019-07-16 18:33:45 -0700440 // The permission configuration *must* be included to ensure security of the device
Aaron Huang788f37a2021-04-27 20:37:07 +0800441 required: [
442 "NetworkPermissionConfig",
443 "privapp_whitelist_com.android.networkstack",
444 ],
Kun Niu8e89dd42019-07-16 18:33:45 -0700445}
lifrcb15db32020-05-21 20:32:36 +0800446
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900447// When adding or modifying protos, the jarjar rules and possibly proguard rules need
448// to be updated: proto libraries may pull additional static libraries.
lifrcb15db32020-05-21 20:32:36 +0800449java_library_static {
450 name: "statsprotos",
451 proto: {
452 type: "lite",
453 },
454 srcs: [
455 "src/com/android/networkstack/metrics/stats.proto",
456 ],
457 static_libs: [
458 "networkstackprotos",
459 ],
460 defaults: ["NetworkStackReleaseApiLevel"],
461}