blob: 62de2ba454550e41ee829f03022414bf41538a98 [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",
Remi NGUYEN VAN6e9fdbd2019-01-29 15:38:52 +090045 "netd_aidl_interface-java",
46 "networkstack-aidl-interfaces-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 VAN0a4df5a2019-03-08 17:20:49 +0900101 // The permission configuration *must* be included to ensure security of the device
Remi NGUYEN VAN288fb702019-03-26 17:24:48 +0900102 required: ["NetworkPermissionConfig"],
Remi NGUYEN VAN40369562019-03-20 16:40:54 +0900103}
104
105// Non-updatable network stack running in the system server process for devices not using the module
106android_app {
107 name: "InProcessNetworkStack",
108 defaults: ["NetworkStackAppCommon"],
109 certificate: "platform",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900110 manifest: "AndroidManifest_InProcess.xml",
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900111}
112
113// Updatable network stack packaged as an application
114android_app {
115 name: "NetworkStack",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +0900116 defaults: ["NetworkStackAppCommon"],
Remi NGUYEN VANd8327a22019-02-15 17:45:03 +0900117 certificate: "networkstack",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900118 manifest: "AndroidManifest.xml",
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800119}
Chiachang Wang80242272019-04-11 21:24:28 +0800120
121genrule {
122 name: "statslog-networkstack-java-gen",
123 tools: ["stats-log-api-gen"],
124 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
125 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog",
126 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
127}