blob: e15526a571f5ee0ece93470d1600b66fe86b2df3 [file] [log] [blame]
Remi NGUYEN VANc094a542018-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
paulhub0f53b82019-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 VAN86c45822019-03-20 16:40:54 +090026java_defaults {
27 name: "NetworkStackCommon",
28 sdk_version: "system_current",
29 min_sdk_version: "28",
30}
31
Remi NGUYEN VAN8acc99a2019-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 VAN86c45822019-03-20 16:40:54 +090035 defaults: ["NetworkStackCommon"],
Remi NGUYEN VANc094a542018-12-07 16:52:24 +090036 srcs: [
37 "src/**/*.java",
Remi NGUYEN VANe88516f2019-01-20 09:35:10 +090038 ":framework-networkstack-shared-srcs",
Remi NGUYEN VANe67b0c3a2018-12-27 16:43:56 +090039 ":services-networkstack-shared-srcs",
Chiachang Wange512b262019-04-11 21:24:28 +080040 ":statslog-networkstack-java-gen",
Remi NGUYEN VANc094a542018-12-07 16:52:24 +090041 ],
Remi NGUYEN VAN0e3d09232018-12-04 12:13:09 +090042 static_libs: [
Remi NGUYEN VAN9ca4c622019-04-09 02:04:54 -070043 "androidx.annotation_annotation",
Chalard Jean95213512019-01-30 21:04:58 +090044 "ipmemorystore-client",
Remi NGUYEN VAN231b52b2019-01-29 15:38:52 +090045 "netd_aidl_interface-java",
46 "networkstack-aidl-interfaces-java",
Chiachang Wangf09e3e32019-02-22 11:13:07 +080047 "datastallprotosnano",
Chiachang Wang4d6fe322019-03-21 20:40:01 +080048 "networkstackprotosnano",
paulhub0f53b82019-03-29 19:21:30 +080049 "captiveportal-lib",
Remi NGUYEN VAN8acc99a2019-03-08 17:20:49 +090050 ],
51 manifest: "AndroidManifestBase.xml",
52}
53
Remi NGUYEN VAN995aada2019-04-05 04:44:45 -070054cc_library_shared {
55 name: "libnetworkstackutilsjni",
56 srcs: [
57 "jni/network_stack_utils_jni.cpp"
58 ],
Lorenzo Colitti3d680e82019-05-01 11:54:33 +090059 sdk_version: "current",
Remi NGUYEN VAN995aada2019-04-05 04:44:45 -070060 shared_libs: [
61 "liblog",
Lorenzo Colitti3d680e82019-05-01 11:54:33 +090062 "libnativehelper_compat_libc++",
Remi NGUYEN VAN995aada2019-04-05 04:44:45 -070063 ],
Lorenzo Colitti3d680e82019-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",
Remi NGUYEN VAN995aada2019-04-05 04:44:45 -070077 cflags: [
78 "-Wall",
79 "-Werror",
80 "-Wno-unused-parameter",
81 ],
82}
83
Remi NGUYEN VAN86c45822019-03-20 16:40:54 +090084java_defaults {
85 name: "NetworkStackAppCommon",
86 defaults: ["NetworkStackCommon"],
Remi NGUYEN VAN8acc99a2019-03-08 17:20:49 +090087 privileged: true,
88 static_libs: [
89 "NetworkStackBase",
90 ],
Lorenzo Colitti3d680e82019-05-01 11:54:33 +090091 jni_libs: [
92 "libnativehelper_compat_libc++",
93 "libnetworkstackutilsjni",
94 ],
Remi NGUYEN VAN86c45822019-03-20 16:40:54 +090095 // Resources already included in NetworkStackBase
96 resource_dirs: [],
Remi NGUYEN VAN8acc99a2019-03-08 17:20:49 +090097 jarjar_rules: "jarjar-rules-shared.txt",
Remi NGUYEN VANaaa7ecfd2019-03-26 14:58:08 +090098 optimize: {
99 proguard_flags_files: ["proguard.flags"],
100 },
Remi NGUYEN VAN86c45822019-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 VAN8acc99a2019-03-08 17:20:49 +0900108 manifest: "AndroidManifest_InProcess.xml",
Remi NGUYEN VAN3cc6d232019-05-14 14:08:56 +0900109 // InProcessNetworkStack is a replacement for NetworkStack
110 overrides: ["NetworkStack"],
Remi NGUYEN VANfc4a83b2019-05-15 16:14:51 +0900111 // The permission configuration *must* be included to ensure security of the device
112 required: ["PlatformNetworkPermissionConfig"],
Remi NGUYEN VANc094a542018-12-07 16:52:24 +0900113}
114
115// Updatable network stack packaged as an application
116android_app {
117 name: "NetworkStack",
Remi NGUYEN VAN86c45822019-03-20 16:40:54 +0900118 defaults: ["NetworkStackAppCommon"],
Remi NGUYEN VANab96bc72019-02-15 17:45:03 +0900119 certificate: "networkstack",
Remi NGUYEN VAN8acc99a2019-03-08 17:20:49 +0900120 manifest: "AndroidManifest.xml",
Richard Uhler103dbe32019-05-13 16:05:51 +0100121 use_embedded_native_libs: true,
Remi NGUYEN VANfc4a83b2019-05-15 16:14:51 +0900122 // The permission configuration *must* be included to ensure security of the device
123 required: ["NetworkPermissionConfig"],
Chiachang Wangf09e3e32019-02-22 11:13:07 +0800124}
Chiachang Wange512b262019-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}