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 | 53817ca | 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: [ |
Remi NGUYEN VAN | 9babdec | 2019-04-09 02:04:54 -0700 | [diff] [blame] | 43 | "androidx.annotation_annotation", |
Chalard Jean | 5b67876 | 2019-01-30 21:04:58 +0900 | [diff] [blame] | 44 | "ipmemorystore-client", |
Lorenzo Colitti | fabe2f9 | 2019-05-22 01:20:45 -0700 | [diff] [blame] | 45 | "netd_aidl_interface-V2-java", |
| 46 | "networkstack-aidl-interfaces-V3-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", |
Kun Niu | 4d1bd9d | 2019-07-01 17:03:20 -0700 | [diff] [blame] | 52 | plugins: ["java_api_finder"], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 53 | } |
| 54 | |
Remi NGUYEN VAN | f38a564 | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 55 | cc_library_shared { |
| 56 | name: "libnetworkstackutilsjni", |
| 57 | srcs: [ |
| 58 | "jni/network_stack_utils_jni.cpp" |
| 59 | ], |
Lorenzo Colitti | eb2269e | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 60 | sdk_version: "current", |
Remi NGUYEN VAN | f38a564 | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 61 | shared_libs: [ |
| 62 | "liblog", |
Lorenzo Colitti | eb2269e | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 63 | "libnativehelper_compat_libc++", |
Remi NGUYEN VAN | f38a564 | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 64 | ], |
Lorenzo Colitti | eb2269e | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 65 | |
| 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 VAN | f38a564 | 2019-04-05 04:44:45 -0700 | [diff] [blame] | 78 | cflags: [ |
| 79 | "-Wall", |
| 80 | "-Werror", |
| 81 | "-Wno-unused-parameter", |
| 82 | ], |
| 83 | } |
| 84 | |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 85 | java_defaults { |
| 86 | name: "NetworkStackAppCommon", |
| 87 | defaults: ["NetworkStackCommon"], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 88 | privileged: true, |
| 89 | static_libs: [ |
| 90 | "NetworkStackBase", |
| 91 | ], |
Lorenzo Colitti | eb2269e | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 92 | jni_libs: [ |
| 93 | "libnativehelper_compat_libc++", |
| 94 | "libnetworkstackutilsjni", |
| 95 | ], |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 96 | // Resources already included in NetworkStackBase |
| 97 | resource_dirs: [], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 98 | jarjar_rules: "jarjar-rules-shared.txt", |
Remi NGUYEN VAN | 776d7f7 | 2019-03-26 14:58:08 +0900 | [diff] [blame] | 99 | optimize: { |
| 100 | proguard_flags_files: ["proguard.flags"], |
| 101 | }, |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | // Non-updatable network stack running in the system server process for devices not using the module |
| 105 | android_app { |
| 106 | name: "InProcessNetworkStack", |
| 107 | defaults: ["NetworkStackAppCommon"], |
| 108 | certificate: "platform", |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 109 | manifest: "AndroidManifest_InProcess.xml", |
Remi NGUYEN VAN | d680e28 | 2019-05-14 14:08:56 +0900 | [diff] [blame] | 110 | // InProcessNetworkStack is a replacement for NetworkStack |
| 111 | overrides: ["NetworkStack"], |
Remi NGUYEN VAN | e2503a2 | 2019-05-15 16:14:51 +0900 | [diff] [blame] | 112 | // The permission configuration *must* be included to ensure security of the device |
Remi NGUYEN VAN | 4f24185 | 2019-05-22 11:02:12 +0900 | [diff] [blame] | 113 | // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces |
| 114 | // the default CaptivePortalLogin. |
| 115 | required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"], |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | // Updatable network stack packaged as an application |
| 119 | android_app { |
| 120 | name: "NetworkStack", |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 121 | defaults: ["NetworkStackAppCommon"], |
Remi NGUYEN VAN | d8327a2 | 2019-02-15 17:45:03 +0900 | [diff] [blame] | 122 | certificate: "networkstack", |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 123 | manifest: "AndroidManifest.xml", |
Richard Uhler | e5f8c73 | 2019-05-13 16:05:51 +0100 | [diff] [blame] | 124 | use_embedded_native_libs: true, |
Remi NGUYEN VAN | e2503a2 | 2019-05-15 16:14:51 +0900 | [diff] [blame] | 125 | // The permission configuration *must* be included to ensure security of the device |
| 126 | required: ["NetworkPermissionConfig"], |
Chiachang Wang | 8b5f84a | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 127 | } |
Chiachang Wang | 53817ca | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 128 | |
| 129 | genrule { |
| 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 | } |