blob: 24c84fe63f9b67941e216a69e6c4f181653ba0de [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
paulhu5982eff2019-03-29 19:21:30 +080017java_library {
18 name: "captiveportal-lib",
19 srcs: ["common/**/*.java"],
20 libs: [
21 "androidx.annotation_annotation",
22 ],
23 sdk_version: "system_current",
24}
25
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090026java_defaults {
27 name: "NetworkStackCommon",
28 sdk_version: "system_current",
29 min_sdk_version: "28",
30}
31
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090032// Library including the network stack, used to compile both variants of the network stack
33android_library {
34 name: "NetworkStackBase",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090035 defaults: ["NetworkStackCommon"],
Remi NGUYEN VANded23152018-12-07 16:52:24 +090036 srcs: [
37 "src/**/*.java",
Remi NGUYEN VAN82b4b422019-01-20 09:35:10 +090038 ":framework-networkstack-shared-srcs",
Remi NGUYEN VAN5daa3702018-12-27 16:43:56 +090039 ":services-networkstack-shared-srcs",
Chiachang Wang80242272019-04-11 21:24:28 +080040 ":statslog-networkstack-java-gen",
Remi NGUYEN VANded23152018-12-07 16:52:24 +090041 ],
Remi NGUYEN VAN057bf202018-12-04 12:13:09 +090042 static_libs: [
Niklas Lindgren0c904882018-12-07 11:08:04 +010043 "androidx.annotation_annotation",
Chalard Jean5b678762019-01-30 21:04:58 +090044 "ipmemorystore-client",
Lorenzo Colitti81fc3e62019-05-21 19:45:09 +090045 "netd_aidl_interface-V2-java",
46 "networkstack-aidl-interfaces-V3-java",
Chiachang Wang8b5f84a2019-02-22 11:13:07 +080047 "datastallprotosnano",
Chiachang Wang54663a82019-03-21 20:40:01 +080048 "networkstackprotosnano",
paulhu5982eff2019-03-29 19:21:30 +080049 "captiveportal-lib",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090050 ],
51 manifest: "AndroidManifestBase.xml",
52}
53
paulhue455e2a2019-03-29 17:22:20 +080054cc_library_shared {
55 name: "libnetworkstackutilsjni",
56 srcs: [
57 "jni/network_stack_utils_jni.cpp"
58 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +090059 sdk_version: "current",
paulhue455e2a2019-03-29 17:22:20 +080060 shared_libs: [
61 "liblog",
Lorenzo Colitti88ddd882019-05-01 11:54:33 +090062 "libnativehelper_compat_libc++",
paulhue455e2a2019-03-29 17:22:20 +080063 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +090064
65 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
66 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
67 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
68 // build because soong complains of:
69 // module NetworkStack missing dependencies: libc++_shared
70 //
71 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
72 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
73 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
74 //
75 // TODO: find a better solution for this in R.
76 stl: "c++_static",
paulhue455e2a2019-03-29 17:22:20 +080077 cflags: [
78 "-Wall",
79 "-Werror",
80 "-Wno-unused-parameter",
81 ],
82}
83
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090084java_defaults {
85 name: "NetworkStackAppCommon",
86 defaults: ["NetworkStackCommon"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090087 privileged: true,
88 static_libs: [
89 "NetworkStackBase",
90 ],
Lorenzo Colitti88ddd882019-05-01 11:54:33 +090091 jni_libs: [
92 "libnativehelper_compat_libc++",
93 "libnetworkstackutilsjni",
94 ],
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090095 // Resources already included in NetworkStackBase
96 resource_dirs: [],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090097 jarjar_rules: "jarjar-rules-shared.txt",
Remi NGUYEN VAN776d7f72019-03-26 14:58:08 +090098 optimize: {
99 proguard_flags_files: ["proguard.flags"],
100 },
Remi NGUYEN VAN40369562019-03-20 16:40:54 +0900101}
102
103// Non-updatable network stack running in the system server process for devices not using the module
104android_app {
105 name: "InProcessNetworkStack",
106 defaults: ["NetworkStackAppCommon"],
107 certificate: "platform",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900108 manifest: "AndroidManifest_InProcess.xml",
Remi NGUYEN VANf2ce7b42019-05-14 14:08:56 +0900109 // InProcessNetworkStack is a replacement for NetworkStack
110 overrides: ["NetworkStack"],
Remi NGUYEN VAN1297e502019-05-15 16:14:51 +0900111 // The permission configuration *must* be included to ensure security of the device
112 required: ["PlatformNetworkPermissionConfig"],
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900113}
114
115// Updatable network stack packaged as an application
116android_app {
117 name: "NetworkStack",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +0900118 defaults: ["NetworkStackAppCommon"],
Remi NGUYEN VANd8327a22019-02-15 17:45:03 +0900119 certificate: "networkstack",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900120 manifest: "AndroidManifest.xml",
Richard Uhler49fea572019-05-13 16:05:51 +0100121 use_embedded_native_libs: true,
Remi NGUYEN VAN1297e502019-05-15 16:14:51 +0900122 // The permission configuration *must* be included to ensure security of the device
123 required: ["NetworkPermissionConfig"],
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800124}
Chiachang Wang80242272019-04-11 21:24:28 +0800125
126genrule {
127 name: "statslog-networkstack-java-gen",
128 tools: ["stats-log-api-gen"],
129 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
130 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog",
131 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
132}
Kun Niu8e89dd42019-07-16 18:33:45 -0700133
134genrule {
135 name: "NetworkStackTestAndroidManifest",
136 srcs: ["AndroidManifest.xml"],
137 out: ["TestAndroidManifest.xml"],
138 cmd: "sed 's/versionCode=\".*\"/versionCode=\"300000000\"/' $(in) > $(out)",
139}
140
141android_app {
142 name: "TestNetworkStack",
143 defaults: ["NetworkStackAppCommon"],
144 certificate: "networkstack",
145 manifest: ":NetworkStackTestAndroidManifest",
146 use_embedded_native_libs: true,
147 // The permission configuration *must* be included to ensure security of the device
148 required: ["NetworkPermissionConfig"],
149}
150