blob: 1e583e12e6cc1556ebd6911c4d088e20962dfa00 [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 Wang53817ca2019-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: [
Remi NGUYEN VAN9babdec2019-04-09 02:04:54 -070043 "androidx.annotation_annotation",
Chalard Jean5b678762019-01-30 21:04:58 +090044 "ipmemorystore-client",
Lorenzo Colittifabe2f92019-05-22 01:20:45 -070045 "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",
Kun Niu4d1bd9d2019-07-01 17:03:20 -070052 plugins: ["java_api_finder"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090053}
54
Remi NGUYEN VANf38a5642019-04-05 04:44:45 -070055cc_library_shared {
56 name: "libnetworkstackutilsjni",
57 srcs: [
58 "jni/network_stack_utils_jni.cpp"
59 ],
Lorenzo Colittieb2269e2019-05-01 11:54:33 +090060 sdk_version: "current",
Remi NGUYEN VANf38a5642019-04-05 04:44:45 -070061 shared_libs: [
62 "liblog",
Lorenzo Colittieb2269e2019-05-01 11:54:33 +090063 "libnativehelper_compat_libc++",
Remi NGUYEN VANf38a5642019-04-05 04:44:45 -070064 ],
Lorenzo Colittieb2269e2019-05-01 11:54:33 +090065
66 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
67 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
68 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
69 // build because soong complains of:
70 // module NetworkStack missing dependencies: libc++_shared
71 //
72 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
73 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
74 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
75 //
76 // TODO: find a better solution for this in R.
77 stl: "c++_static",
Remi NGUYEN VANf38a5642019-04-05 04:44:45 -070078 cflags: [
79 "-Wall",
80 "-Werror",
81 "-Wno-unused-parameter",
82 ],
83}
84
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090085java_defaults {
86 name: "NetworkStackAppCommon",
87 defaults: ["NetworkStackCommon"],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090088 privileged: true,
89 static_libs: [
90 "NetworkStackBase",
91 ],
Lorenzo Colittieb2269e2019-05-01 11:54:33 +090092 jni_libs: [
93 "libnativehelper_compat_libc++",
94 "libnetworkstackutilsjni",
95 ],
Remi NGUYEN VAN40369562019-03-20 16:40:54 +090096 // Resources already included in NetworkStackBase
97 resource_dirs: [],
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +090098 jarjar_rules: "jarjar-rules-shared.txt",
Remi NGUYEN VAN776d7f72019-03-26 14:58:08 +090099 optimize: {
100 proguard_flags_files: ["proguard.flags"],
101 },
Remi NGUYEN VAN40369562019-03-20 16:40:54 +0900102}
103
104// Non-updatable network stack running in the system server process for devices not using the module
105android_app {
106 name: "InProcessNetworkStack",
107 defaults: ["NetworkStackAppCommon"],
108 certificate: "platform",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900109 manifest: "AndroidManifest_InProcess.xml",
Remi NGUYEN VANd680e282019-05-14 14:08:56 +0900110 // InProcessNetworkStack is a replacement for NetworkStack
111 overrides: ["NetworkStack"],
Remi NGUYEN VANe2503a22019-05-15 16:14:51 +0900112 // The permission configuration *must* be included to ensure security of the device
Remi NGUYEN VAN4f241852019-05-22 11:02:12 +0900113 // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
114 // the default CaptivePortalLogin.
115 required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"],
Remi NGUYEN VANded23152018-12-07 16:52:24 +0900116}
117
118// Updatable network stack packaged as an application
119android_app {
120 name: "NetworkStack",
Remi NGUYEN VAN40369562019-03-20 16:40:54 +0900121 defaults: ["NetworkStackAppCommon"],
Remi NGUYEN VANd8327a22019-02-15 17:45:03 +0900122 certificate: "networkstack",
Remi NGUYEN VAN0a4df5a2019-03-08 17:20:49 +0900123 manifest: "AndroidManifest.xml",
Richard Uhlere5f8c732019-05-13 16:05:51 +0100124 use_embedded_native_libs: true,
Remi NGUYEN VANe2503a22019-05-15 16:14:51 +0900125 // The permission configuration *must* be included to ensure security of the device
126 required: ["NetworkPermissionConfig"],
Chiachang Wang8b5f84a2019-02-22 11:13:07 +0800127}
Chiachang Wang53817ca2019-04-11 21:24:28 +0800128
129genrule {
130 name: "statslog-networkstack-java-gen",
131 tools: ["stats-log-api-gen"],
132 cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" +
133 " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog",
134 out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"],
135}