blob: 44e91bca201d751d9c64fc71498886c896c56f49 [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 VAN40369562019-03-20 16:40:54 +090048java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090049 name: "NetworkStackDevApiLevel",
Remi NGUYEN VAN5b3ea2f2020-11-24 02:43:44 +000050 min_sdk_version: "29",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090051 sdk_version: "system_current",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090052}
53
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090054java_defaults {
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090055 name: "NetworkStackReleaseApiLevel",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +090056 sdk_version: "module_31",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +090057 min_sdk_version: "29",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +090058 target_sdk_version: "31",
59 libs: [
60 "framework-connectivity",
61 "framework-statsd",
62 "framework-wifi",
63 ]
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090064}
65
Lorenzo Colittid6709182021-02-22 01:38:39 +090066// Libraries for the API shims
67java_defaults {
68 name: "NetworkStackShimsDefaults",
69 libs: [
70 "androidx.annotation_annotation",
71 "networkstack-client",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090072 ],
Chiachang Wangb86f43c2021-04-22 10:00:40 +080073 static_libs : [
74 "modules-utils-build_system"
75 ],
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +090076 apex_available: [
77 "com.android.tethering",
78 "//apex_available:platform", // For InProcessNetworkStack and InProcessTethering
79 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +090080 min_sdk_version: "29",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +090081}
82
Lorenzo Colittid6709182021-02-22 01:38:39 +090083// Common shim code. This includes the shim interface definitions themselves, and things like
84// ShimUtils and UnsupportedApiLevelException. Compiles against system_current because ShimUtils
85// needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK.
86// TODO: consider moving ShimUtils into a library (or removing it in favour of SdkLevel) and compile
87// this target against the lowest-supported SDK (currently 29).
88java_library {
89 name: "NetworkStackShimsCommon",
90 defaults: ["NetworkStackShimsDefaults"],
91 srcs: ["apishim/common/**/*.java"],
92 sdk_version: "system_current",
93 visibility: ["//visibility:private"],
94}
95
96// Each level of the shims (29, 30, ...) is its own java_library compiled against the corresponding
97// system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level.
98java_library {
99 name: "NetworkStackApi29Shims",
100 defaults: ["NetworkStackShimsDefaults"],
101 srcs: ["apishim/29/**/*.java"],
102 libs: [
103 "NetworkStackShimsCommon",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900104 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900105 sdk_version: "system_29",
106 visibility: ["//visibility:private"],
107}
108
109java_library {
110 name: "NetworkStackApi30Shims",
111 defaults: ["NetworkStackShimsDefaults"],
112 srcs: [
113 "apishim/30/**/*.java",
114 ],
115 libs: [
116 "NetworkStackShimsCommon",
117 "NetworkStackApi29Shims",
118 ],
119 sdk_version: "system_30",
120 visibility: ["//visibility:private"],
Pedro Loureiro633685e2021-02-25 15:32:07 +0000121 lint: {
122 baseline_filename: "lint-baseline-api-30-shims.xml",
123 },
Lorenzo Colittid6709182021-02-22 01:38:39 +0900124}
125
126// Shims for APIs being added to the current development version of Android. These APIs are not
Lorenzo Colitti52f7eb12021-02-24 17:10:56 +0900127// stable and have no defined version number. These could be called 10000, but they use the next
128// 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 +0900129java_library {
130 name: "NetworkStackApi31Shims",
131 defaults: ["NetworkStackShimsDefaults"],
132 srcs: [
133 "apishim/31/**/*.java",
134 ],
135 libs: [
136 "NetworkStackShimsCommon",
137 "NetworkStackApi29Shims",
138 "NetworkStackApi30Shims",
Chiachang Wangffe87162021-02-26 17:36:52 +0800139 "framework-connectivity",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900140 ],
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900141 sdk_version: "module_31",
142 visibility: ["//visibility:private"],
143}
144
145
146// Shims for APIs being added to the current development version of Android. These APIs are not
147// stable and have no defined version number. These could be called 10000, but they use the next
148// integer so if the next SDK release happens to use that integer, we don't need to rename them.
149java_library {
150 name: "NetworkStackApi32Shims",
151 defaults: ["NetworkStackShimsDefaults"],
152 srcs: [
153 "apishim/32/**/*.java",
154 ],
155 libs: [
156 "NetworkStackShimsCommon",
157 "NetworkStackApi29Shims",
158 "NetworkStackApi30Shims",
159 "NetworkStackApi31Shims",
160 "framework-connectivity",
161 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800162 sdk_version: "module_current",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900163 visibility: ["//visibility:private"],
164}
165
166// API current uses the API current shims directly.
167// The current (in-progress) shims are in the com.android.networkstack.apishim package and are
168// called directly by the networkstack code.
169java_library {
170 name: "NetworkStackApiCurrentShims",
171 defaults: ["NetworkStackShimsDefaults"],
172 static_libs: [
173 "NetworkStackShimsCommon",
174 "NetworkStackApi29Shims",
175 "NetworkStackApi30Shims",
176 "NetworkStackApi31Shims",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900177 "NetworkStackApi32Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900178 ],
Chiachang Wangffe87162021-02-26 17:36:52 +0800179 sdk_version: "module_current",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800180 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900181 "//packages/modules/Connectivity/Tethering",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800182 "//packages/modules/Connectivity/tests/cts/net",
183 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900184}
185
186// API stable uses jarjar to rename the latest stable apishim package from
187// com.android.networkstack.apishim.apiXX to com.android.networkstack.apishim, which is called by
188// the networkstack code.
189java_library {
190 name: "NetworkStackApiStableShims",
191 defaults: ["NetworkStackShimsDefaults"],
192 static_libs: [
193 "NetworkStackShimsCommon",
194 "NetworkStackApi29Shims",
195 "NetworkStackApi30Shims",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900196 "NetworkStackApi31Shims",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900197 ],
198 jarjar_rules: "apishim/jarjar-rules-compat.txt",
Remi NGUYEN VAN71489ae2021-06-08 12:18:15 +0900199 sdk_version: "module_31",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800200 visibility: [
Lorenzo Colitti0ef45d42021-03-04 09:35:46 +0900201 "//packages/modules/Connectivity/Tethering",
Chiachang Wanga331c3a2021-02-26 18:01:18 +0800202 "//packages/modules/Connectivity/tests/cts/net",
203 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900204}
205
206// Common defaults for android libraries containing network stack code, used to compile variants of
207// the network stack in the system process and in the network_stack process
208java_defaults {
209 name: "NetworkStackAndroidLibraryDefaults",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900210 srcs: [
Remi NGUYEN VAN82b4b422019-01-20 09:35:10 +0900211 ":framework-networkstack-shared-srcs",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900212 ":networkstack-module-utils-srcs",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900213 ],
Artur Satayev0eb158a2019-12-10 12:54:01 +0000214 libs: ["unsupportedappusage"],
Remi NGUYEN VAN057bf202018-12-04 12:13:09 +0900215 static_libs: [
Niklas Lindgren0c904882018-12-07 11:08:04 +0100216 "androidx.annotation_annotation",
Remi NGUYEN VAN1b7a0632021-07-07 17:54:09 +0900217 "modules-utils-build_system",
Jeongik Cha848a5b52021-01-26 22:35:03 +0900218 "netd_aidl_interface-lateststable-java",
Remi NGUYEN VAN1fc930c2019-08-09 13:23:47 +0900219 "netlink-client",
Remi NGUYEN VANbbb97032019-08-08 15:53:54 +0900220 "networkstack-client",
Remi NGUYEN VAN5b00d422020-06-08 15:34:22 +0900221 "net-utils-framework-common",
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900222 // See note on statsprotos when adding/updating proto build rules
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800223 "datastallprotosnano",
lifrcb15db32020-05-21 20:32:36 +0800224 "statsprotos",
paulhu5982eff2019-03-29 19:21:30 +0800225 "captiveportal-lib",
Chalard Jean6f675212020-06-25 23:41:16 +0900226 "net-utils-device-common",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900227 ],
Kun Niuf3b69042019-07-01 17:03:20 -0700228 plugins: ["java_api_finder"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900229}
230
Lorenzo Colittid6709182021-02-22 01:38:39 +0900231// The versions of the android library containing network stack code compiled for each SDK variant.
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900232android_library {
233 name: "NetworkStackApiCurrentLib",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900234 defaults: ["NetworkStackDevApiLevel", "NetworkStackAndroidLibraryDefaults"],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800235 srcs: [
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800236 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000237 ":statslog-networkstack-java-gen-current"
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800238 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900239 static_libs: ["NetworkStackApiCurrentShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900240 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900241 visibility: [
242 "//frameworks/base/tests/net/integration",
243 "//packages/modules/Connectivity/Tethering/tests/integration",
244 "//packages/modules/Connectivity/tests/cts/net",
245 "//packages/modules/NetworkStack/tests/unit",
246 "//packages/modules/NetworkStack/tests/integration",
247 ],
Pedro Loureiro633685e2021-02-25 15:32:07 +0000248 lint: {
249 baseline_filename: "lint-baseline-current-lib.xml",
250 },
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900251}
252
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900253android_library {
254 name: "NetworkStackApiStableLib",
Lorenzo Colittid6709182021-02-22 01:38:39 +0900255 defaults: ["NetworkStackReleaseApiLevel", "NetworkStackAndroidLibraryDefaults"],
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800256 srcs: [
257 "src/**/*.java",
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000258 ":statslog-networkstack-java-gen-stable",
Muhammad Qureshiaa428cc2020-01-29 11:15:16 -0800259 ],
Lorenzo Colittid6709182021-02-22 01:38:39 +0900260 static_libs: ["NetworkStackApiStableShims"],
Remi NGUYEN VAN794a4b52019-09-06 13:00:33 +0900261 manifest: "AndroidManifestBase.xml",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900262 visibility: [
Remi NGUYEN VAN170801b2021-05-11 15:09:29 +0000263 "//frameworks/base/packages/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900264 "//frameworks/base/tests/net/integration",
265 "//packages/modules/Connectivity/Tethering/tests/integration",
266 "//packages/modules/Connectivity/tests/cts/net",
Remi NGUYEN VAN170801b2021-05-11 15:09:29 +0000267 "//packages/modules/Connectivity/tests/integration",
Lorenzo Colitti55672ee2021-03-01 16:10:19 +0900268 "//packages/modules/NetworkStack/tests/unit",
269 "//packages/modules/NetworkStack/tests/integration",
270 ],
Pedro Loureiro633685e2021-02-25 15:32:07 +0000271 lint: {
272 baseline_filename: "lint-baseline-stable-lib.xml",
273 },
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900274}
275
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900276filegroup {
277 name: "NetworkStackJarJarRules",
278 srcs: ["jarjar-rules-shared.txt"],
279 visibility: [
280 "//packages/modules/NetworkStack/tests/unit",
281 "//packages/modules/NetworkStack/tests/integration",
Baligh Uddin1151e2e2020-10-29 02:12:29 +0000282 "//packages/modules/Connectivity/Tethering/tests/integration",
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900283 ]
284}
285
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900286// Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries
287java_defaults {
288 name: "NetworkStackAppDefaults",
289 privileged: true,
290 jni_libs: [
291 "libnativehelper_compat_libc++",
292 "libnetworkstackutilsjni",
293 ],
294 // Resources already included in NetworkStackBase
295 resource_dirs: [],
Lorenzo Colittib891b5e2020-02-05 16:48:09 +0900296 jarjar_rules: ":NetworkStackJarJarRules",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900297 use_embedded_native_libs: true,
298 optimize: {
299 proguard_flags_files: ["proguard.flags"],
300 },
301}
302
303// Non-updatable network stack running in the system server process for devices not using the module
304android_app {
305 name: "InProcessNetworkStack",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900306 defaults: [ "NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900307 static_libs: ["NetworkStackApiCurrentLib"],
308 certificate: "platform",
309 manifest: "AndroidManifest_InProcess.xml",
310 // InProcessNetworkStack is a replacement for NetworkStack
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000311 overrides: ["NetworkStack", "NetworkStackNext"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900312 // The permission configuration *must* be included to ensure security of the device
313 // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
314 // the default CaptivePortalLogin.
Aaron Huang187e9482021-04-27 20:37:07 +0800315 required: [
316 "PlatformNetworkPermissionConfig",
317 "PlatformCaptivePortalLogin",
318 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900319}
320
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900321// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
322android_library {
323 name: "NetworkStackNextManifestBase",
324 defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
325 static_libs: ["NetworkStackApiCurrentLib"],
326 manifest: "AndroidManifest.xml"
327}
328
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900329// NetworkStack build targeting the current API release, for testing on in-development SDK
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900330android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000331 name: "NetworkStackNext",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900332 defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900333 static_libs: ["NetworkStackNextManifestBase"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900334 certificate: "networkstack",
Remi NGUYEN VAN255d4912020-02-05 13:42:45 +0900335 manifest: "AndroidManifest_Next.xml",
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900336 // The permission configuration *must* be included to ensure security of the device
Aaron Huang187e9482021-04-27 20:37:07 +0800337 required: [
338 "NetworkPermissionConfig",
339 "privapp_whitelist_com.android.networkstack",
340 ],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900341}
342
343// Updatable network stack for finalized API
344android_app {
Remi NGUYEN VANec9d8a62019-11-11 03:52:43 +0000345 name: "NetworkStack",
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900346 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900347 static_libs: ["NetworkStackApiStableLib"],
348 certificate: "networkstack",
349 manifest: "AndroidManifest.xml",
350 // The permission configuration *must* be included to ensure security of the device
Aaron Huang187e9482021-04-27 20:37:07 +0800351 required: [
352 "NetworkPermissionConfig",
353 "privapp_whitelist_com.android.networkstack",
354 ],
Artur Satayev862a1a12020-04-09 11:35:52 +0100355 updatable: true,
Remi NGUYEN VAN99645762019-07-11 14:33:15 +0900356}
357
paulhue455e2a2019-03-29 17:22:20 +0800358cc_library_shared {
359 name: "libnetworkstackutilsjni",
360 srcs: [
361 "jni/network_stack_utils_jni.cpp"
362 ],
Jooyung Hand3fb9f52020-04-29 02:43:03 +0900363 sdk_version: "29",
364 min_sdk_version: "29",
paulhue455e2a2019-03-29 17:22:20 +0800365 shared_libs: [
366 "liblog",
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900367 "libnativehelper_compat_libc++",
paulhue455e2a2019-03-29 17:22:20 +0800368 ],
Orion Hodson94561f62020-12-08 09:56:29 +0000369 static_libs: [
370 "libnetjniutils",
371 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +0900372
373 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
374 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
375 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
376 // build because soong complains of:
377 // module NetworkStack missing dependencies: libc++_shared
378 //
379 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
380 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
381 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
382 //
383 // TODO: find a better solution for this in R.
384 stl: "c++_static",
paulhue455e2a2019-03-29 17:22:20 +0800385 cflags: [
386 "-Wall",
387 "-Werror",
388 "-Wno-unused-parameter",
389 ],
390}
391
Chiachang Wang80242272019-04-11 21:24:28 +0800392genrule {
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000393 name: "statslog-networkstack-java-gen-current",
Chiachang Wang80242272019-04-11 21:24:28 +0800394 tools: ["stats-log-api-gen"],
395 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
Muhammad Qureshi8e0e9bc2019-12-31 11:26:33 -0800396 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000397 " --minApiLevel 29",
Chiachang Wang80242272019-04-11 21:24:28 +0800398 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
399}
Kun Niu8e89dd42019-07-16 18:33:45 -0700400
Muhammad Qureshicd7415e2021-02-11 01:54:48 +0000401genrule {
402 name: "statslog-networkstack-java-gen-stable",
403 tools: ["stats-log-api-gen"],
404 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
405 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" +
406 " --minApiLevel 29 --compileApiLevel 30",
407 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
408}
409
410
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900411version_code_networkstack_next = "300000000"
412version_code_networkstack_test = "999999999"
413
Kun Niu8e89dd42019-07-16 18:33:45 -0700414genrule {
415 name: "NetworkStackTestAndroidManifest",
416 srcs: ["AndroidManifest.xml"],
417 out: ["TestAndroidManifest.xml"],
Remi NGUYEN VAN16fe4542020-01-16 13:48:38 +0900418 cmd: "sed -E 's/versionCode=\"[0-9]+\"/versionCode=\""
419 + version_code_networkstack_test
420 + "\"/' $(in) > $(out)",
421 visibility: ["//visibility:private"],
422}
423
Kun Niu8e89dd42019-07-16 18:33:45 -0700424android_app {
425 name: "TestNetworkStack",
Remi NGUYEN VAN1d52af02020-12-22 02:08:55 +0000426 defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
427 static_libs: ["NetworkStackApiStableLib"],
Kun Niu8e89dd42019-07-16 18:33:45 -0700428 certificate: "networkstack",
429 manifest: ":NetworkStackTestAndroidManifest",
Kun Niu8e89dd42019-07-16 18:33:45 -0700430 // The permission configuration *must* be included to ensure security of the device
Aaron Huang187e9482021-04-27 20:37:07 +0800431 required: [
432 "NetworkPermissionConfig",
433 "privapp_whitelist_com.android.networkstack",
434 ],
Kun Niu8e89dd42019-07-16 18:33:45 -0700435}
lifrcb15db32020-05-21 20:32:36 +0800436
Remi NGUYEN VAN84ba8152020-06-22 18:50:20 +0900437// When adding or modifying protos, the jarjar rules and possibly proguard rules need
438// to be updated: proto libraries may pull additional static libraries.
lifrcb15db32020-05-21 20:32:36 +0800439java_library_static {
440 name: "statsprotos",
441 proto: {
442 type: "lite",
443 },
444 srcs: [
445 "src/com/android/networkstack/metrics/stats.proto",
446 ],
447 static_libs: [
448 "networkstackprotos",
449 ],
450 defaults: ["NetworkStackReleaseApiLevel"],
451}