Remi NGUYEN VAN | ded2315 | 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 | 5982eff | 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 | 4036956 | 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 | 0a4df5a | 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 | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 35 | defaults: ["NetworkStackCommon"], |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 36 | srcs: [ |
| 37 | "src/**/*.java", |
Remi NGUYEN VAN | 82b4b42 | 2019-01-20 09:35:10 +0900 | [diff] [blame] | 38 | ":framework-networkstack-shared-srcs", |
Remi NGUYEN VAN | 5daa370 | 2018-12-27 16:43:56 +0900 | [diff] [blame] | 39 | ":services-networkstack-shared-srcs", |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 40 | ":statslog-networkstack-java-gen", |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 41 | ], |
Remi NGUYEN VAN | 057bf20 | 2018-12-04 12:13:09 +0900 | [diff] [blame] | 42 | static_libs: [ |
Niklas Lindgren | 0c90488 | 2018-12-07 11:08:04 +0100 | [diff] [blame] | 43 | "androidx.annotation_annotation", |
Chalard Jean | 5b67876 | 2019-01-30 21:04:58 +0900 | [diff] [blame] | 44 | "ipmemorystore-client", |
Remi NGUYEN VAN | 6e9fdbd | 2019-01-29 15:38:52 +0900 | [diff] [blame] | 45 | "netd_aidl_interface-java", |
| 46 | "networkstack-aidl-interfaces-java", |
Chiachang Wang | 8b5f84a | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 47 | "datastallprotosnano", |
Chiachang Wang | 54663a8 | 2019-03-21 20:40:01 +0800 | [diff] [blame] | 48 | "networkstackprotosnano", |
paulhu | 5982eff | 2019-03-29 19:21:30 +0800 | [diff] [blame] | 49 | "captiveportal-lib", |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 50 | ], |
| 51 | manifest: "AndroidManifestBase.xml", |
| 52 | } |
| 53 | |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 54 | cc_library_shared { |
| 55 | name: "libnetworkstackutilsjni", |
| 56 | srcs: [ |
| 57 | "jni/network_stack_utils_jni.cpp" |
| 58 | ], |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame^] | 59 | sdk_version: "current", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 60 | shared_libs: [ |
| 61 | "liblog", |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame^] | 62 | "libnativehelper_compat_libc++", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 63 | ], |
Lorenzo Colitti | 88ddd88 | 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", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 77 | cflags: [ |
| 78 | "-Wall", |
| 79 | "-Werror", |
| 80 | "-Wno-unused-parameter", |
| 81 | ], |
| 82 | } |
| 83 | |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 84 | java_defaults { |
| 85 | name: "NetworkStackAppCommon", |
| 86 | defaults: ["NetworkStackCommon"], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 87 | privileged: true, |
| 88 | static_libs: [ |
| 89 | "NetworkStackBase", |
| 90 | ], |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame^] | 91 | jni_libs: [ |
| 92 | "libnativehelper_compat_libc++", |
| 93 | "libnetworkstackutilsjni", |
| 94 | ], |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 95 | // Resources already included in NetworkStackBase |
| 96 | resource_dirs: [], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 97 | jarjar_rules: "jarjar-rules-shared.txt", |
Remi NGUYEN VAN | 776d7f7 | 2019-03-26 14:58:08 +0900 | [diff] [blame] | 98 | optimize: { |
| 99 | proguard_flags_files: ["proguard.flags"], |
| 100 | }, |
Remi NGUYEN VAN | 0a4df5a | 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 | 288fb70 | 2019-03-26 17:24:48 +0900 | [diff] [blame] | 102 | required: ["NetworkPermissionConfig"], |
Remi NGUYEN VAN | 4036956 | 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 | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 110 | manifest: "AndroidManifest_InProcess.xml", |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | // Updatable network stack packaged as an application |
| 114 | android_app { |
| 115 | name: "NetworkStack", |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 116 | defaults: ["NetworkStackAppCommon"], |
Remi NGUYEN VAN | d8327a2 | 2019-02-15 17:45:03 +0900 | [diff] [blame] | 117 | certificate: "networkstack", |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 118 | manifest: "AndroidManifest.xml", |
Chiachang Wang | 8b5f84a | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 119 | } |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 120 | |
| 121 | genrule { |
| 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 | } |