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 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 17 | // The network stack can be compiled using system_current (non-finalized) SDK, or finalized system_X |
| 18 | // SDK. There is also a variant that uses system_current SDK and runs in the system process |
| 19 | // (InProcessNetworkStack). The following structure is used to create the build rules: |
| 20 | // |
| 21 | // NetworkStackAndroidLibraryDefaults <-- common defaults for android libs |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 22 | // / \ |
| 23 | // +NetworkStackApiStableShims --> / \ <-- +NetworkStackApiCurrentShims |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 24 | // +NetworkStackReleaseApiLevel / \ +NetworkStackDevApiLevel |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 25 | // +jarjar apishim.api[latest].* / \ |
| 26 | // to apishim.* / \ |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 27 | // / \ |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 28 | // / \ |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 29 | // / \ android libs w/ all code |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 30 | // / <- +module src/ -> \ (also used in unit tests) |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 31 | // / \ | |
| 32 | // NetworkStackApiStableLib NetworkStackApiCurrentLib <--* |
| 33 | // | | |
| 34 | // | <-- +NetworkStackAppDefaults --> | |
| 35 | // | (APK build params) | |
| 36 | // | | |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 37 | // | <-- +NetworkStackReleaseApiLevel | <-- +NetworkStackDevApiLevel |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 38 | // | | |
| 39 | // | | |
| 40 | // NetworkStackApiStable NetworkStack, InProcessNetworkStack, <-- APKs |
| 41 | // TestNetworkStack |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 42 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 43 | // Common defaults to define SDK level |
Bob Badour | dd48697 | 2021-02-12 15:05:06 -0800 | [diff] [blame] | 44 | package { |
| 45 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 46 | } |
| 47 | |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 48 | java_defaults { |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 49 | name: "NetworkStackDevApiLevel", |
Remi NGUYEN VAN | 5b3ea2f | 2020-11-24 02:43:44 +0000 | [diff] [blame] | 50 | min_sdk_version: "29", |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 51 | sdk_version: "system_current", |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 52 | } |
| 53 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 54 | java_defaults { |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 55 | name: "NetworkStackReleaseApiLevel", |
Remi NGUYEN VAN | 38dc834 | 2020-05-18 18:09:28 +0900 | [diff] [blame] | 56 | sdk_version: "system_30", |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 57 | min_sdk_version: "29", |
Remi NGUYEN VAN | 6793314 | 2020-05-07 18:53:35 +0900 | [diff] [blame] | 58 | target_sdk_version: "30", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 59 | } |
| 60 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 61 | // Libraries for the API shims |
| 62 | java_defaults { |
| 63 | name: "NetworkStackShimsDefaults", |
| 64 | libs: [ |
| 65 | "androidx.annotation_annotation", |
| 66 | "networkstack-client", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 67 | ], |
Lorenzo Colitti | 0ef45d4 | 2021-03-04 09:35:46 +0900 | [diff] [blame] | 68 | apex_available: [ |
| 69 | "com.android.tethering", |
| 70 | "//apex_available:platform", // For InProcessNetworkStack and InProcessTethering |
| 71 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 72 | min_sdk_version: "29", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 73 | } |
| 74 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 75 | // Common shim code. This includes the shim interface definitions themselves, and things like |
| 76 | // ShimUtils and UnsupportedApiLevelException. Compiles against system_current because ShimUtils |
| 77 | // needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK. |
| 78 | // TODO: consider moving ShimUtils into a library (or removing it in favour of SdkLevel) and compile |
| 79 | // this target against the lowest-supported SDK (currently 29). |
| 80 | java_library { |
| 81 | name: "NetworkStackShimsCommon", |
| 82 | defaults: ["NetworkStackShimsDefaults"], |
| 83 | srcs: ["apishim/common/**/*.java"], |
| 84 | sdk_version: "system_current", |
| 85 | visibility: ["//visibility:private"], |
| 86 | } |
| 87 | |
| 88 | // Each level of the shims (29, 30, ...) is its own java_library compiled against the corresponding |
| 89 | // system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level. |
| 90 | java_library { |
| 91 | name: "NetworkStackApi29Shims", |
| 92 | defaults: ["NetworkStackShimsDefaults"], |
| 93 | srcs: ["apishim/29/**/*.java"], |
| 94 | libs: [ |
| 95 | "NetworkStackShimsCommon", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 96 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 97 | sdk_version: "system_29", |
| 98 | visibility: ["//visibility:private"], |
| 99 | } |
| 100 | |
| 101 | java_library { |
| 102 | name: "NetworkStackApi30Shims", |
| 103 | defaults: ["NetworkStackShimsDefaults"], |
| 104 | srcs: [ |
| 105 | "apishim/30/**/*.java", |
| 106 | ], |
| 107 | libs: [ |
| 108 | "NetworkStackShimsCommon", |
| 109 | "NetworkStackApi29Shims", |
| 110 | ], |
| 111 | sdk_version: "system_30", |
| 112 | visibility: ["//visibility:private"], |
| 113 | } |
| 114 | |
| 115 | // Shims for APIs being added to the current development version of Android. These APIs are not |
Lorenzo Colitti | 52f7eb1 | 2021-02-24 17:10:56 +0900 | [diff] [blame] | 116 | // stable and have no defined version number. These could be called 10000, but they use the next |
| 117 | // integer so if the next SDK release happens to use that integer, we don't need to rename them. |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 118 | java_library { |
| 119 | name: "NetworkStackApi31Shims", |
| 120 | defaults: ["NetworkStackShimsDefaults"], |
| 121 | srcs: [ |
| 122 | "apishim/31/**/*.java", |
| 123 | ], |
| 124 | libs: [ |
| 125 | "NetworkStackShimsCommon", |
| 126 | "NetworkStackApi29Shims", |
| 127 | "NetworkStackApi30Shims", |
Chiachang Wang | ffe8716 | 2021-02-26 17:36:52 +0800 | [diff] [blame] | 128 | "framework-connectivity", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 129 | ], |
Chiachang Wang | ffe8716 | 2021-02-26 17:36:52 +0800 | [diff] [blame] | 130 | sdk_version: "module_current", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 131 | visibility: ["//visibility:private"], |
| 132 | } |
| 133 | |
| 134 | // API current uses the API current shims directly. |
| 135 | // The current (in-progress) shims are in the com.android.networkstack.apishim package and are |
| 136 | // called directly by the networkstack code. |
| 137 | java_library { |
| 138 | name: "NetworkStackApiCurrentShims", |
| 139 | defaults: ["NetworkStackShimsDefaults"], |
| 140 | static_libs: [ |
| 141 | "NetworkStackShimsCommon", |
| 142 | "NetworkStackApi29Shims", |
| 143 | "NetworkStackApi30Shims", |
| 144 | "NetworkStackApi31Shims", |
| 145 | ], |
Chiachang Wang | ffe8716 | 2021-02-26 17:36:52 +0800 | [diff] [blame] | 146 | sdk_version: "module_current", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 147 | visibility: [ |
Lorenzo Colitti | 0ef45d4 | 2021-03-04 09:35:46 +0900 | [diff] [blame] | 148 | "//packages/modules/Connectivity/Tethering", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 149 | "//packages/modules/Connectivity/tests/cts/net", |
| 150 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | // API stable uses jarjar to rename the latest stable apishim package from |
| 154 | // com.android.networkstack.apishim.apiXX to com.android.networkstack.apishim, which is called by |
| 155 | // the networkstack code. |
| 156 | java_library { |
| 157 | name: "NetworkStackApiStableShims", |
| 158 | defaults: ["NetworkStackShimsDefaults"], |
| 159 | static_libs: [ |
| 160 | "NetworkStackShimsCommon", |
| 161 | "NetworkStackApi29Shims", |
| 162 | "NetworkStackApi30Shims", |
| 163 | ], |
| 164 | jarjar_rules: "apishim/jarjar-rules-compat.txt", |
| 165 | sdk_version: "system_30", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 166 | visibility: [ |
Lorenzo Colitti | 0ef45d4 | 2021-03-04 09:35:46 +0900 | [diff] [blame] | 167 | "//packages/modules/Connectivity/Tethering", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 168 | "//packages/modules/Connectivity/tests/cts/net", |
| 169 | ], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | // Common defaults for android libraries containing network stack code, used to compile variants of |
| 173 | // the network stack in the system process and in the network_stack process |
| 174 | java_defaults { |
| 175 | name: "NetworkStackAndroidLibraryDefaults", |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 176 | srcs: [ |
Remi NGUYEN VAN | 82b4b42 | 2019-01-20 09:35:10 +0900 | [diff] [blame] | 177 | ":framework-networkstack-shared-srcs", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 178 | ":networkstack-module-utils-srcs", |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 179 | ], |
Artur Satayev | 0eb158a | 2019-12-10 12:54:01 +0000 | [diff] [blame] | 180 | libs: ["unsupportedappusage"], |
Remi NGUYEN VAN | 057bf20 | 2018-12-04 12:13:09 +0900 | [diff] [blame] | 181 | static_libs: [ |
Niklas Lindgren | 0c90488 | 2018-12-07 11:08:04 +0100 | [diff] [blame] | 182 | "androidx.annotation_annotation", |
Jeongik Cha | 848a5b5 | 2021-01-26 22:35:03 +0900 | [diff] [blame] | 183 | "netd_aidl_interface-lateststable-java", |
Remi NGUYEN VAN | 1fc930c | 2019-08-09 13:23:47 +0900 | [diff] [blame] | 184 | "netlink-client", |
Remi NGUYEN VAN | bbb9703 | 2019-08-08 15:53:54 +0900 | [diff] [blame] | 185 | "networkstack-client", |
Remi NGUYEN VAN | 5b00d42 | 2020-06-08 15:34:22 +0900 | [diff] [blame] | 186 | "net-utils-framework-common", |
Remi NGUYEN VAN | 84ba815 | 2020-06-22 18:50:20 +0900 | [diff] [blame] | 187 | // See note on statsprotos when adding/updating proto build rules |
Chiachang Wang | 8b5f84a | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 188 | "datastallprotosnano", |
lifr | cb15db3 | 2020-05-21 20:32:36 +0800 | [diff] [blame] | 189 | "statsprotos", |
paulhu | 5982eff | 2019-03-29 19:21:30 +0800 | [diff] [blame] | 190 | "captiveportal-lib", |
Chalard Jean | 6f67521 | 2020-06-25 23:41:16 +0900 | [diff] [blame] | 191 | "net-utils-device-common", |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 192 | ], |
Kun Niu | f3b6904 | 2019-07-01 17:03:20 -0700 | [diff] [blame] | 193 | plugins: ["java_api_finder"], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 194 | } |
| 195 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 196 | // The versions of the android library containing network stack code compiled for each SDK variant. |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 197 | android_library { |
| 198 | name: "NetworkStackApiCurrentLib", |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 199 | defaults: ["NetworkStackDevApiLevel", "NetworkStackAndroidLibraryDefaults"], |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 200 | srcs: [ |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 201 | "src/**/*.java", |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 202 | ":statslog-networkstack-java-gen-current" |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 203 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 204 | static_libs: ["NetworkStackApiCurrentShims"], |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 205 | manifest: "AndroidManifestBase.xml", |
Lorenzo Colitti | 55672ee | 2021-03-01 16:10:19 +0900 | [diff] [blame] | 206 | visibility: [ |
| 207 | "//frameworks/base/tests/net/integration", |
| 208 | "//packages/modules/Connectivity/Tethering/tests/integration", |
| 209 | "//packages/modules/Connectivity/tests/cts/net", |
| 210 | "//packages/modules/NetworkStack/tests/unit", |
| 211 | "//packages/modules/NetworkStack/tests/integration", |
| 212 | ], |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 213 | } |
| 214 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 215 | android_library { |
| 216 | name: "NetworkStackApiStableLib", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 217 | defaults: ["NetworkStackReleaseApiLevel", "NetworkStackAndroidLibraryDefaults"], |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 218 | srcs: [ |
| 219 | "src/**/*.java", |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 220 | ":statslog-networkstack-java-gen-stable", |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 221 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 222 | static_libs: ["NetworkStackApiStableShims"], |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 223 | manifest: "AndroidManifestBase.xml", |
Lorenzo Colitti | 55672ee | 2021-03-01 16:10:19 +0900 | [diff] [blame] | 224 | visibility: [ |
| 225 | "//frameworks/base/tests/net/integration", |
| 226 | "//packages/modules/Connectivity/Tethering/tests/integration", |
| 227 | "//packages/modules/Connectivity/tests/cts/net", |
| 228 | "//packages/modules/NetworkStack/tests/unit", |
| 229 | "//packages/modules/NetworkStack/tests/integration", |
| 230 | ], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 231 | } |
| 232 | |
Lorenzo Colitti | b891b5e | 2020-02-05 16:48:09 +0900 | [diff] [blame] | 233 | filegroup { |
| 234 | name: "NetworkStackJarJarRules", |
| 235 | srcs: ["jarjar-rules-shared.txt"], |
| 236 | visibility: [ |
| 237 | "//packages/modules/NetworkStack/tests/unit", |
| 238 | "//packages/modules/NetworkStack/tests/integration", |
Baligh Uddin | 1151e2e | 2020-10-29 02:12:29 +0000 | [diff] [blame] | 239 | "//packages/modules/Connectivity/Tethering/tests/integration", |
Lorenzo Colitti | b891b5e | 2020-02-05 16:48:09 +0900 | [diff] [blame] | 240 | ] |
| 241 | } |
| 242 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 243 | // Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries |
| 244 | java_defaults { |
| 245 | name: "NetworkStackAppDefaults", |
| 246 | privileged: true, |
| 247 | jni_libs: [ |
| 248 | "libnativehelper_compat_libc++", |
| 249 | "libnetworkstackutilsjni", |
| 250 | ], |
| 251 | // Resources already included in NetworkStackBase |
| 252 | resource_dirs: [], |
Lorenzo Colitti | b891b5e | 2020-02-05 16:48:09 +0900 | [diff] [blame] | 253 | jarjar_rules: ":NetworkStackJarJarRules", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 254 | use_embedded_native_libs: true, |
| 255 | optimize: { |
| 256 | proguard_flags_files: ["proguard.flags"], |
| 257 | }, |
| 258 | } |
| 259 | |
| 260 | // Non-updatable network stack running in the system server process for devices not using the module |
| 261 | android_app { |
| 262 | name: "InProcessNetworkStack", |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 263 | defaults: [ "NetworkStackAppDefaults", "NetworkStackDevApiLevel"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 264 | static_libs: ["NetworkStackApiCurrentLib"], |
| 265 | certificate: "platform", |
| 266 | manifest: "AndroidManifest_InProcess.xml", |
| 267 | // InProcessNetworkStack is a replacement for NetworkStack |
Remi NGUYEN VAN | ec9d8a6 | 2019-11-11 03:52:43 +0000 | [diff] [blame] | 268 | overrides: ["NetworkStack", "NetworkStackNext"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 269 | // The permission configuration *must* be included to ensure security of the device |
| 270 | // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces |
| 271 | // the default CaptivePortalLogin. |
| 272 | required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"], |
| 273 | } |
| 274 | |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 275 | // Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top |
| 276 | android_library { |
| 277 | name: "NetworkStackNextManifestBase", |
| 278 | defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], |
| 279 | static_libs: ["NetworkStackApiCurrentLib"], |
| 280 | manifest: "AndroidManifest.xml" |
| 281 | } |
| 282 | |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 283 | // NetworkStack build targeting the current API release, for testing on in-development SDK |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 284 | android_app { |
Remi NGUYEN VAN | ec9d8a6 | 2019-11-11 03:52:43 +0000 | [diff] [blame] | 285 | name: "NetworkStackNext", |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 286 | defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"], |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 287 | static_libs: ["NetworkStackNextManifestBase"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 288 | certificate: "networkstack", |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 289 | manifest: "AndroidManifest_Next.xml", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 290 | // The permission configuration *must* be included to ensure security of the device |
| 291 | required: ["NetworkPermissionConfig"], |
| 292 | } |
| 293 | |
| 294 | // Updatable network stack for finalized API |
| 295 | android_app { |
Remi NGUYEN VAN | ec9d8a6 | 2019-11-11 03:52:43 +0000 | [diff] [blame] | 296 | name: "NetworkStack", |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 297 | defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 298 | static_libs: ["NetworkStackApiStableLib"], |
| 299 | certificate: "networkstack", |
| 300 | manifest: "AndroidManifest.xml", |
| 301 | // The permission configuration *must* be included to ensure security of the device |
| 302 | required: ["NetworkPermissionConfig"], |
Artur Satayev | 862a1a1 | 2020-04-09 11:35:52 +0100 | [diff] [blame] | 303 | updatable: true, |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 304 | } |
| 305 | |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 306 | cc_library_shared { |
| 307 | name: "libnetworkstackutilsjni", |
| 308 | srcs: [ |
| 309 | "jni/network_stack_utils_jni.cpp" |
| 310 | ], |
Jooyung Han | d3fb9f5 | 2020-04-29 02:43:03 +0900 | [diff] [blame] | 311 | sdk_version: "29", |
| 312 | min_sdk_version: "29", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 313 | shared_libs: [ |
| 314 | "liblog", |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 315 | "libnativehelper_compat_libc++", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 316 | ], |
Orion Hodson | 94561f6 | 2020-12-08 09:56:29 +0000 | [diff] [blame] | 317 | static_libs: [ |
| 318 | "libnetjniutils", |
| 319 | ], |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 320 | |
| 321 | // We cannot use plain "libc++" here to link libc++ dynamically because it results in: |
| 322 | // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found |
| 323 | // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't |
| 324 | // build because soong complains of: |
| 325 | // module NetworkStack missing dependencies: libc++_shared |
| 326 | // |
| 327 | // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries |
| 328 | // we depend on do not dynamically link libc++. This is currently the case, because liblog is |
| 329 | // C-only and libnativehelper_compat_libc also uses stl: "c++_static". |
| 330 | // |
| 331 | // TODO: find a better solution for this in R. |
| 332 | stl: "c++_static", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 333 | cflags: [ |
| 334 | "-Wall", |
| 335 | "-Werror", |
| 336 | "-Wno-unused-parameter", |
| 337 | ], |
| 338 | } |
| 339 | |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 340 | genrule { |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 341 | name: "statslog-networkstack-java-gen-current", |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 342 | tools: ["stats-log-api-gen"], |
| 343 | cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" + |
Muhammad Qureshi | 8e0e9bc | 2019-12-31 11:26:33 -0800 | [diff] [blame] | 344 | " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" + |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 345 | " --minApiLevel 29", |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 346 | out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"], |
| 347 | } |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 348 | |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 349 | genrule { |
| 350 | name: "statslog-networkstack-java-gen-stable", |
| 351 | tools: ["stats-log-api-gen"], |
| 352 | cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" + |
| 353 | " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" + |
| 354 | " --minApiLevel 29 --compileApiLevel 30", |
| 355 | out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"], |
| 356 | } |
| 357 | |
| 358 | |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 359 | version_code_networkstack_next = "300000000" |
| 360 | version_code_networkstack_test = "999999999" |
| 361 | |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 362 | genrule { |
| 363 | name: "NetworkStackTestAndroidManifest", |
| 364 | srcs: ["AndroidManifest.xml"], |
| 365 | out: ["TestAndroidManifest.xml"], |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 366 | cmd: "sed -E 's/versionCode=\"[0-9]+\"/versionCode=\"" |
| 367 | + version_code_networkstack_test |
| 368 | + "\"/' $(in) > $(out)", |
| 369 | visibility: ["//visibility:private"], |
| 370 | } |
| 371 | |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 372 | android_app { |
| 373 | name: "TestNetworkStack", |
Remi NGUYEN VAN | 1d52af0 | 2020-12-22 02:08:55 +0000 | [diff] [blame] | 374 | defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"], |
| 375 | static_libs: ["NetworkStackApiStableLib"], |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 376 | certificate: "networkstack", |
| 377 | manifest: ":NetworkStackTestAndroidManifest", |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 378 | // The permission configuration *must* be included to ensure security of the device |
| 379 | required: ["NetworkPermissionConfig"], |
| 380 | } |
lifr | cb15db3 | 2020-05-21 20:32:36 +0800 | [diff] [blame] | 381 | |
Remi NGUYEN VAN | 84ba815 | 2020-06-22 18:50:20 +0900 | [diff] [blame] | 382 | // When adding or modifying protos, the jarjar rules and possibly proguard rules need |
| 383 | // to be updated: proto libraries may pull additional static libraries. |
lifr | cb15db3 | 2020-05-21 20:32:36 +0800 | [diff] [blame] | 384 | java_library_static { |
| 385 | name: "statsprotos", |
| 386 | proto: { |
| 387 | type: "lite", |
| 388 | }, |
| 389 | srcs: [ |
| 390 | "src/com/android/networkstack/metrics/stats.proto", |
| 391 | ], |
| 392 | static_libs: [ |
| 393 | "networkstackprotos", |
| 394 | ], |
| 395 | defaults: ["NetworkStackReleaseApiLevel"], |
| 396 | } |