Remi NGUYEN VAN | c094a54 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 1 | // |
| 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 | |
paulhu | b0f53b8 | 2019-03-29 19:21:30 +0800 | [diff] [blame] | 17 | java_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 VAN | 86c4582 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 26 | java_defaults { |
| 27 | name: "NetworkStackCommon", |
| 28 | sdk_version: "system_current", |
| 29 | min_sdk_version: "28", |
| 30 | } |
| 31 | |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 32 | // Library including the network stack, used to compile both variants of the network stack |
| 33 | android_library { |
| 34 | name: "NetworkStackBase", |
Remi NGUYEN VAN | 86c4582 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 35 | defaults: ["NetworkStackCommon"], |
Remi NGUYEN VAN | c094a54 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 36 | srcs: [ |
| 37 | "src/**/*.java", |
Remi NGUYEN VAN | e88516f | 2019-01-20 09:35:10 +0900 | [diff] [blame] | 38 | ":framework-networkstack-shared-srcs", |
Remi NGUYEN VAN | e67b0c3a | 2018-12-27 16:43:56 +0900 | [diff] [blame] | 39 | ":services-networkstack-shared-srcs", |
Chiachang Wang | e512b26 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 40 | ":statslog-networkstack-java-gen", |
Remi NGUYEN VAN | c094a54 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 41 | ], |
Remi NGUYEN VAN | 0e3d0923 | 2018-12-04 12:13:09 +0900 | [diff] [blame] | 42 | static_libs: [ |
Remi NGUYEN VAN | 9ca4c62 | 2019-04-09 02:04:54 -0700 | [diff] [blame] | 43 | "androidx.annotation_annotation", |
Chalard Jean | 9521351 | 2019-01-30 21:04:58 +0900 | [diff] [blame] | 44 | "ipmemorystore-client", |
Remi NGUYEN VAN | 231b52b | 2019-01-29 15:38:52 +0900 | [diff] [blame] | 45 | "netd_aidl_interface-java", |
| 46 | "networkstack-aidl-interfaces-java", |
Chiachang Wang | f09e3e3 | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 47 | "datastallprotosnano", |
Chiachang Wang | 4d6fe32 | 2019-03-21 20:40:01 +0800 | [diff] [blame] | 48 | "networkstackprotosnano", |
paulhu | b0f53b8 | 2019-03-29 19:21:30 +0800 | [diff] [blame] | 49 | "captiveportal-lib", |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 50 | ], |
| 51 | manifest: "AndroidManifestBase.xml", |
| 52 | } |
| 53 | |
Remi NGUYEN VAN | 995aada | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 54 | cc_library_shared { |
| 55 | name: "libnetworkstackutilsjni", |
| 56 | srcs: [ |
| 57 | "jni/network_stack_utils_jni.cpp" |
| 58 | ], |
Lorenzo Colitti | 3d680e8 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 59 | sdk_version: "current", |
Remi NGUYEN VAN | 995aada | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 60 | shared_libs: [ |
| 61 | "liblog", |
Lorenzo Colitti | 3d680e8 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 62 | "libnativehelper_compat_libc++", |
Remi NGUYEN VAN | 995aada | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 63 | ], |
Lorenzo Colitti | 3d680e8 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 64 | |
| 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 VAN | 995aada | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 77 | cflags: [ |
| 78 | "-Wall", |
| 79 | "-Werror", |
| 80 | "-Wno-unused-parameter", |
| 81 | ], |
| 82 | } |
| 83 | |
Remi NGUYEN VAN | 86c4582 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 84 | java_defaults { |
| 85 | name: "NetworkStackAppCommon", |
| 86 | defaults: ["NetworkStackCommon"], |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 87 | privileged: true, |
| 88 | static_libs: [ |
| 89 | "NetworkStackBase", |
| 90 | ], |
Lorenzo Colitti | 3d680e8 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 91 | jni_libs: [ |
| 92 | "libnativehelper_compat_libc++", |
| 93 | "libnetworkstackutilsjni", |
| 94 | ], |
Remi NGUYEN VAN | 86c4582 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 95 | // Resources already included in NetworkStackBase |
| 96 | resource_dirs: [], |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 97 | jarjar_rules: "jarjar-rules-shared.txt", |
Remi NGUYEN VAN | aaa7ecfd | 2019-03-26 14:58:08 +0900 | [diff] [blame] | 98 | optimize: { |
| 99 | proguard_flags_files: ["proguard.flags"], |
| 100 | }, |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 101 | // The permission configuration *must* be included to ensure security of the device |
Remi NGUYEN VAN | fc6b247 | 2019-03-26 17:24:48 +0900 | [diff] [blame] | 102 | required: ["NetworkPermissionConfig"], |
Remi NGUYEN VAN | 86c4582 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | // Non-updatable network stack running in the system server process for devices not using the module |
| 106 | android_app { |
| 107 | name: "InProcessNetworkStack", |
| 108 | defaults: ["NetworkStackAppCommon"], |
| 109 | certificate: "platform", |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 110 | manifest: "AndroidManifest_InProcess.xml", |
Remi NGUYEN VAN | 3cc6d23 | 2019-05-14 14:08:56 +0900 | [diff] [blame^] | 111 | // InProcessNetworkStack is a replacement for NetworkStack |
| 112 | overrides: ["NetworkStack"], |
Remi NGUYEN VAN | c094a54 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | // Updatable network stack packaged as an application |
| 116 | android_app { |
| 117 | name: "NetworkStack", |
Remi NGUYEN VAN | 86c4582 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 118 | defaults: ["NetworkStackAppCommon"], |
Remi NGUYEN VAN | ab96bc7 | 2019-02-15 17:45:03 +0900 | [diff] [blame] | 119 | certificate: "networkstack", |
Remi NGUYEN VAN | 8acc99a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 120 | manifest: "AndroidManifest.xml", |
Chiachang Wang | f09e3e3 | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 121 | } |
Chiachang Wang | e512b26 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 122 | |
| 123 | genrule { |
| 124 | name: "statslog-networkstack-java-gen", |
| 125 | tools: ["stats-log-api-gen"], |
| 126 | cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" + |
| 127 | " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog", |
| 128 | out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"], |
| 129 | } |