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 | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 48 | // In some branches, this may be module_current instead of module_33 if the SDK prebuilts are not |
| 49 | // yet dropped there, meaning module_33 cannot be used yet. |
| 50 | module_33_version = "module_33" |
| 51 | |
Remi NGUYEN VAN | 9f69921 | 2022-01-26 17:39:32 +0900 | [diff] [blame] | 52 | // TODO: remove this default and replace with ConnectivityNextEnableDefaults. This will need to be |
| 53 | // done separately in each branch due to merge conflicts. |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 54 | // Defaults to enable/disable java targets that depend on |
| 55 | // NetworkStackNext, which uses development APIs. "enabled" may |
| 56 | // have a different value depending on the branch. |
| 57 | java_defaults { |
| 58 | name: "NetworkStackNextEnableDefaults", |
| 59 | enabled: true, |
| 60 | } |
| 61 | // This is a placeholder comment to avoid merge conflicts |
| 62 | // as the above target may have different "enabled" values |
| 63 | // depending on the branch |
| 64 | |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 65 | java_defaults { |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 66 | name: "NetworkStackDevApiLevel", |
Remi NGUYEN VAN | 5b3ea2f | 2020-11-24 02:43:44 +0000 | [diff] [blame] | 67 | min_sdk_version: "29", |
Chiachang Wang | e8486de | 2022-03-21 09:53:41 +0800 | [diff] [blame] | 68 | sdk_version: "module_current", |
| 69 | libs: [ |
| 70 | "framework-connectivity", |
Chiachang Wang | e377041 | 2022-03-28 10:07:08 +0800 | [diff] [blame] | 71 | "framework-connectivity-t", |
Chiachang Wang | e8486de | 2022-03-21 09:53:41 +0800 | [diff] [blame] | 72 | "framework-statsd", |
| 73 | "framework-wifi", |
| 74 | ] |
Remi NGUYEN VAN | 4036956 | 2019-03-20 16:40:54 +0900 | [diff] [blame] | 75 | } |
| 76 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 77 | java_defaults { |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 78 | name: "NetworkStackReleaseApiLevel", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 79 | sdk_version: module_33_version, |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 80 | min_sdk_version: "29", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 81 | target_sdk_version: "33", |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 82 | libs: [ |
| 83 | "framework-connectivity", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 84 | "framework-connectivity-t", |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 85 | "framework-statsd", |
| 86 | "framework-wifi", |
| 87 | ] |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 88 | } |
| 89 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 90 | // Libraries for the API shims |
| 91 | java_defaults { |
| 92 | name: "NetworkStackShimsDefaults", |
| 93 | libs: [ |
| 94 | "androidx.annotation_annotation", |
Remi NGUYEN VAN | c0c7541 | 2021-11-01 11:56:52 +0900 | [diff] [blame] | 95 | "networkstack-aidl-latest", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 96 | ], |
Chiachang Wang | b86f43c | 2021-04-22 10:00:40 +0800 | [diff] [blame] | 97 | static_libs : [ |
| 98 | "modules-utils-build_system" |
| 99 | ], |
Lorenzo Colitti | 0ef45d4 | 2021-03-04 09:35:46 +0900 | [diff] [blame] | 100 | apex_available: [ |
| 101 | "com.android.tethering", |
| 102 | "//apex_available:platform", // For InProcessNetworkStack and InProcessTethering |
| 103 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 104 | min_sdk_version: "29", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 105 | } |
| 106 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 107 | // Common shim code. This includes the shim interface definitions themselves, and things like |
| 108 | // ShimUtils and UnsupportedApiLevelException. Compiles against system_current because ShimUtils |
| 109 | // needs access to all Build.VERSION_CODES.*, which by definition are only in the newest SDK. |
| 110 | // TODO: consider moving ShimUtils into a library (or removing it in favour of SdkLevel) and compile |
| 111 | // this target against the lowest-supported SDK (currently 29). |
| 112 | java_library { |
| 113 | name: "NetworkStackShimsCommon", |
| 114 | defaults: ["NetworkStackShimsDefaults"], |
| 115 | srcs: ["apishim/common/**/*.java"], |
| 116 | sdk_version: "system_current", |
| 117 | visibility: ["//visibility:private"], |
| 118 | } |
| 119 | |
| 120 | // Each level of the shims (29, 30, ...) is its own java_library compiled against the corresponding |
| 121 | // system_X SDK. this ensures that each shim can only use SDK classes that exist in its SDK level. |
| 122 | java_library { |
| 123 | name: "NetworkStackApi29Shims", |
| 124 | defaults: ["NetworkStackShimsDefaults"], |
| 125 | srcs: ["apishim/29/**/*.java"], |
| 126 | libs: [ |
| 127 | "NetworkStackShimsCommon", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 128 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 129 | sdk_version: "system_29", |
| 130 | visibility: ["//visibility:private"], |
| 131 | } |
| 132 | |
| 133 | java_library { |
| 134 | name: "NetworkStackApi30Shims", |
| 135 | defaults: ["NetworkStackShimsDefaults"], |
| 136 | srcs: [ |
| 137 | "apishim/30/**/*.java", |
| 138 | ], |
| 139 | libs: [ |
| 140 | "NetworkStackShimsCommon", |
| 141 | "NetworkStackApi29Shims", |
| 142 | ], |
| 143 | sdk_version: "system_30", |
| 144 | visibility: ["//visibility:private"], |
Pedro Loureiro | 633685e | 2021-02-25 15:32:07 +0000 | [diff] [blame] | 145 | lint: { |
Chiachang Wang | 194b36f | 2021-10-01 11:32:46 +0800 | [diff] [blame] | 146 | strict_updatability_linting: true, |
Pedro Loureiro | 633685e | 2021-02-25 15:32:07 +0000 | [diff] [blame] | 147 | }, |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 148 | } |
| 149 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 150 | java_library { |
| 151 | name: "NetworkStackApi31Shims", |
| 152 | defaults: ["NetworkStackShimsDefaults"], |
| 153 | srcs: [ |
| 154 | "apishim/31/**/*.java", |
| 155 | ], |
| 156 | libs: [ |
| 157 | "NetworkStackShimsCommon", |
| 158 | "NetworkStackApi29Shims", |
| 159 | "NetworkStackApi30Shims", |
Chiachang Wang | ffe8716 | 2021-02-26 17:36:52 +0800 | [diff] [blame] | 160 | "framework-connectivity", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 161 | ], |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 162 | sdk_version: "module_31", |
| 163 | visibility: ["//visibility:private"], |
| 164 | } |
| 165 | |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 166 | java_library { |
Chiachang Wang | 9dee53b | 2022-01-06 15:27:56 +0800 | [diff] [blame] | 167 | name: "NetworkStackApi33Shims", |
Remi NGUYEN VAN | 9f69921 | 2022-01-26 17:39:32 +0900 | [diff] [blame] | 168 | defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"], |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 169 | srcs: [ |
Chiachang Wang | 9dee53b | 2022-01-06 15:27:56 +0800 | [diff] [blame] | 170 | "apishim/33/**/*.java", |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 171 | ], |
Rambo Wang | 1a6e89c | 2022-02-18 10:29:38 -0800 | [diff] [blame] | 172 | static_libs: [ |
| 173 | "net-utils-framework-common", |
| 174 | ], |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 175 | libs: [ |
| 176 | "NetworkStackShimsCommon", |
| 177 | "NetworkStackApi29Shims", |
| 178 | "NetworkStackApi30Shims", |
| 179 | "NetworkStackApi31Shims", |
Roopa Sattiraju | eff9ba1 | 2022-01-21 20:32:32 -0800 | [diff] [blame] | 180 | "framework-bluetooth", |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 181 | "framework-connectivity", |
paulhu | fe450bf | 2022-02-08 22:42:47 +0800 | [diff] [blame] | 182 | "framework-connectivity-t.stubs.module_lib", |
markchien | 52e30e6 | 2021-11-05 01:19:13 +0800 | [diff] [blame] | 183 | "framework-tethering", |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 184 | ], |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 185 | sdk_version: module_33_version, |
| 186 | visibility: ["//visibility:private"], |
| 187 | } |
| 188 | |
| 189 | // Shims for APIs being added to the current development version of Android. These APIs are not |
| 190 | // stable and have no defined version number. These could be called 10000, but they use the next |
| 191 | // integer so if the next SDK release happens to use that integer, we don't need to rename them. |
| 192 | java_library { |
| 193 | name: "NetworkStackApi34Shims", |
| 194 | defaults: ["NetworkStackShimsDefaults", "ConnectivityNextEnableDefaults"], |
| 195 | srcs: [ |
| 196 | "apishim/34/**/*.java", |
| 197 | ], |
| 198 | static_libs: [ |
| 199 | "net-utils-framework-common", |
| 200 | ], |
| 201 | libs: [ |
| 202 | "NetworkStackShimsCommon", |
| 203 | "NetworkStackApi29Shims", |
| 204 | "NetworkStackApi30Shims", |
| 205 | "NetworkStackApi31Shims", |
| 206 | "NetworkStackApi33Shims", |
| 207 | "framework-bluetooth", |
| 208 | "framework-connectivity", |
| 209 | "framework-connectivity-t.stubs.module_lib", |
| 210 | "framework-tethering", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 211 | ], |
Chiachang Wang | ffe8716 | 2021-02-26 17:36:52 +0800 | [diff] [blame] | 212 | sdk_version: "module_current", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 213 | visibility: ["//visibility:private"], |
| 214 | } |
| 215 | |
| 216 | // API current uses the API current shims directly. |
| 217 | // The current (in-progress) shims are in the com.android.networkstack.apishim package and are |
| 218 | // called directly by the networkstack code. |
| 219 | java_library { |
| 220 | name: "NetworkStackApiCurrentShims", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 221 | defaults: [ |
| 222 | "NetworkStackShimsDefaults", |
| 223 | "NetworkStackDevApiLevel", |
| 224 | "ConnectivityNextEnableDefaults", |
| 225 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 226 | static_libs: [ |
| 227 | "NetworkStackShimsCommon", |
| 228 | "NetworkStackApi29Shims", |
| 229 | "NetworkStackApi30Shims", |
| 230 | "NetworkStackApi31Shims", |
Chiachang Wang | 9dee53b | 2022-01-06 15:27:56 +0800 | [diff] [blame] | 231 | "NetworkStackApi33Shims", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 232 | "NetworkStackApi34Shims", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 233 | ], |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 234 | visibility: [ |
Lorenzo Colitti | 0ef45d4 | 2021-03-04 09:35:46 +0900 | [diff] [blame] | 235 | "//packages/modules/Connectivity/Tethering", |
Chalard Jean | 08a7aeb | 2022-01-26 19:26:11 +0900 | [diff] [blame] | 236 | "//packages/modules/Connectivity/service", |
| 237 | "//packages/modules/Connectivity/service-t", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 238 | "//packages/modules/Connectivity/tests/cts/net", |
Taras Antoshchuk | df3c034 | 2022-01-07 18:48:25 +0000 | [diff] [blame] | 239 | "//packages/modules/Connectivity/tests/cts/hostside/app", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 240 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | // API stable uses jarjar to rename the latest stable apishim package from |
| 244 | // com.android.networkstack.apishim.apiXX to com.android.networkstack.apishim, which is called by |
| 245 | // the networkstack code. |
| 246 | java_library { |
| 247 | name: "NetworkStackApiStableShims", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 248 | defaults: ["NetworkStackShimsDefaults", "NetworkStackReleaseApiLevel"], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 249 | static_libs: [ |
| 250 | "NetworkStackShimsCommon", |
| 251 | "NetworkStackApi29Shims", |
| 252 | "NetworkStackApi30Shims", |
Remi NGUYEN VAN | 71489ae | 2021-06-08 12:18:15 +0900 | [diff] [blame] | 253 | "NetworkStackApi31Shims", |
Remi NGUYEN VAN | 38a6de0 | 2022-05-02 14:07:43 +0900 | [diff] [blame] | 254 | "NetworkStackApi33Shims", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 255 | ], |
| 256 | jarjar_rules: "apishim/jarjar-rules-compat.txt", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 257 | visibility: [ |
Lorenzo Colitti | 0ef45d4 | 2021-03-04 09:35:46 +0900 | [diff] [blame] | 258 | "//packages/modules/Connectivity/Tethering", |
Chalard Jean | 08a7aeb | 2022-01-26 19:26:11 +0900 | [diff] [blame] | 259 | "//packages/modules/Connectivity/service", |
| 260 | "//packages/modules/Connectivity/service-t", |
Michael Groover | 24054d1 | 2022-02-07 14:47:00 -0800 | [diff] [blame] | 261 | "//packages/modules/Connectivity/tests/cts:__subpackages__", |
Chiachang Wang | a331c3a | 2021-02-26 18:01:18 +0800 | [diff] [blame] | 262 | ], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | // Common defaults for android libraries containing network stack code, used to compile variants of |
| 266 | // the network stack in the system process and in the network_stack process |
| 267 | java_defaults { |
| 268 | name: "NetworkStackAndroidLibraryDefaults", |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 269 | srcs: [ |
Remi NGUYEN VAN | 82b4b42 | 2019-01-20 09:35:10 +0900 | [diff] [blame] | 270 | ":framework-networkstack-shared-srcs", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 271 | ":networkstack-module-utils-srcs", |
Remi NGUYEN VAN | ded2315 | 2018-12-07 16:52:24 +0900 | [diff] [blame] | 272 | ], |
Artur Satayev | 0eb158a | 2019-12-10 12:54:01 +0000 | [diff] [blame] | 273 | libs: ["unsupportedappusage"], |
Remi NGUYEN VAN | 057bf20 | 2018-12-04 12:13:09 +0900 | [diff] [blame] | 274 | static_libs: [ |
Niklas Lindgren | 0c90488 | 2018-12-07 11:08:04 +0100 | [diff] [blame] | 275 | "androidx.annotation_annotation", |
Remi NGUYEN VAN | 1b7a063 | 2021-07-07 17:54:09 +0900 | [diff] [blame] | 276 | "modules-utils-build_system", |
William Escande | f51eb69 | 2021-08-19 12:30:12 +0200 | [diff] [blame] | 277 | "modules-utils-preconditions", |
| 278 | "modules-utils-statemachine", |
Jeongik Cha | 848a5b5 | 2021-01-26 22:35:03 +0900 | [diff] [blame] | 279 | "netd_aidl_interface-lateststable-java", |
Remi NGUYEN VAN | bbb9703 | 2019-08-08 15:53:54 +0900 | [diff] [blame] | 280 | "networkstack-client", |
Remi NGUYEN VAN | 5b00d42 | 2020-06-08 15:34:22 +0900 | [diff] [blame] | 281 | "net-utils-framework-common", |
Remi NGUYEN VAN | 84ba815 | 2020-06-22 18:50:20 +0900 | [diff] [blame] | 282 | // See note on statsprotos when adding/updating proto build rules |
Chiachang Wang | 8b5f84a | 2019-02-22 11:13:07 +0800 | [diff] [blame] | 283 | "datastallprotosnano", |
lifr | cb15db3 | 2020-05-21 20:32:36 +0800 | [diff] [blame] | 284 | "statsprotos", |
paulhu | 5982eff | 2019-03-29 19:21:30 +0800 | [diff] [blame] | 285 | "captiveportal-lib", |
Chalard Jean | 6f67521 | 2020-06-25 23:41:16 +0900 | [diff] [blame] | 286 | "net-utils-device-common", |
Xiao Ma | 6f4019c | 2021-07-01 13:53:48 +0000 | [diff] [blame] | 287 | "net-utils-device-common-netlink", |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 288 | ], |
Kun Niu | f3b6904 | 2019-07-01 17:03:20 -0700 | [diff] [blame] | 289 | plugins: ["java_api_finder"], |
Remi NGUYEN VAN | 0a4df5a | 2019-03-08 17:20:49 +0900 | [diff] [blame] | 290 | } |
| 291 | |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 292 | // 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] | 293 | android_library { |
| 294 | name: "NetworkStackApiCurrentLib", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 295 | defaults: [ |
| 296 | "NetworkStackDevApiLevel", |
| 297 | "NetworkStackAndroidLibraryDefaults", |
Remi NGUYEN VAN | 9f69921 | 2022-01-26 17:39:32 +0900 | [diff] [blame] | 298 | "ConnectivityNextEnableDefaults", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 299 | ], |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 300 | srcs: [ |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 301 | "src/**/*.java", |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 302 | ":statslog-networkstack-java-gen-current" |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 303 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 304 | static_libs: ["NetworkStackApiCurrentShims"], |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 305 | manifest: "AndroidManifestBase.xml", |
Lorenzo Colitti | 55672ee | 2021-03-01 16:10:19 +0900 | [diff] [blame] | 306 | visibility: [ |
| 307 | "//frameworks/base/tests/net/integration", |
| 308 | "//packages/modules/Connectivity/Tethering/tests/integration", |
| 309 | "//packages/modules/Connectivity/tests/cts/net", |
| 310 | "//packages/modules/NetworkStack/tests/unit", |
| 311 | "//packages/modules/NetworkStack/tests/integration", |
| 312 | ], |
Chiachang Wang | d6a4d8f | 2021-11-01 18:55:14 +0800 | [diff] [blame] | 313 | lint: { strict_updatability_linting: true }, |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 314 | } |
| 315 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 316 | android_library { |
| 317 | name: "NetworkStackApiStableLib", |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 318 | defaults: ["NetworkStackReleaseApiLevel", "NetworkStackAndroidLibraryDefaults"], |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 319 | srcs: [ |
| 320 | "src/**/*.java", |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 321 | ":statslog-networkstack-java-gen-stable", |
Muhammad Qureshi | aa428cc | 2020-01-29 11:15:16 -0800 | [diff] [blame] | 322 | ], |
Lorenzo Colitti | d670918 | 2021-02-22 01:38:39 +0900 | [diff] [blame] | 323 | static_libs: ["NetworkStackApiStableShims"], |
Remi NGUYEN VAN | 794a4b5 | 2019-09-06 13:00:33 +0900 | [diff] [blame] | 324 | manifest: "AndroidManifestBase.xml", |
Lorenzo Colitti | 55672ee | 2021-03-01 16:10:19 +0900 | [diff] [blame] | 325 | visibility: [ |
Remi NGUYEN VAN | 170801b | 2021-05-11 15:09:29 +0000 | [diff] [blame] | 326 | "//frameworks/base/packages/Connectivity/tests/integration", |
Lorenzo Colitti | 55672ee | 2021-03-01 16:10:19 +0900 | [diff] [blame] | 327 | "//frameworks/base/tests/net/integration", |
| 328 | "//packages/modules/Connectivity/Tethering/tests/integration", |
| 329 | "//packages/modules/Connectivity/tests/cts/net", |
Remi NGUYEN VAN | 170801b | 2021-05-11 15:09:29 +0000 | [diff] [blame] | 330 | "//packages/modules/Connectivity/tests/integration", |
Lorenzo Colitti | 55672ee | 2021-03-01 16:10:19 +0900 | [diff] [blame] | 331 | "//packages/modules/NetworkStack/tests/unit", |
| 332 | "//packages/modules/NetworkStack/tests/integration", |
| 333 | ], |
Chiachang Wang | d6a4d8f | 2021-11-01 18:55:14 +0800 | [diff] [blame] | 334 | lint: { strict_updatability_linting: true }, |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 335 | } |
| 336 | |
Lorenzo Colitti | b891b5e | 2020-02-05 16:48:09 +0900 | [diff] [blame] | 337 | filegroup { |
| 338 | name: "NetworkStackJarJarRules", |
| 339 | srcs: ["jarjar-rules-shared.txt"], |
| 340 | visibility: [ |
| 341 | "//packages/modules/NetworkStack/tests/unit", |
| 342 | "//packages/modules/NetworkStack/tests/integration", |
Remi NGUYEN VAN | 22601e6 | 2021-07-27 14:47:50 +0900 | [diff] [blame] | 343 | "//packages/modules/Connectivity/tests:__subpackages__", |
Baligh Uddin | 1151e2e | 2020-10-29 02:12:29 +0000 | [diff] [blame] | 344 | "//packages/modules/Connectivity/Tethering/tests/integration", |
Lorenzo Colitti | b891b5e | 2020-02-05 16:48:09 +0900 | [diff] [blame] | 345 | ] |
| 346 | } |
| 347 | |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 348 | // Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries |
| 349 | java_defaults { |
| 350 | name: "NetworkStackAppDefaults", |
| 351 | privileged: true, |
| 352 | jni_libs: [ |
| 353 | "libnativehelper_compat_libc++", |
| 354 | "libnetworkstackutilsjni", |
| 355 | ], |
| 356 | // Resources already included in NetworkStackBase |
| 357 | resource_dirs: [], |
Lorenzo Colitti | b891b5e | 2020-02-05 16:48:09 +0900 | [diff] [blame] | 358 | jarjar_rules: ":NetworkStackJarJarRules", |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 359 | use_embedded_native_libs: true, |
| 360 | optimize: { |
| 361 | proguard_flags_files: ["proguard.flags"], |
| 362 | }, |
| 363 | } |
| 364 | |
| 365 | // Non-updatable network stack running in the system server process for devices not using the module |
| 366 | android_app { |
| 367 | name: "InProcessNetworkStack", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 368 | defaults: [ |
| 369 | "NetworkStackAppDefaults", |
| 370 | "NetworkStackDevApiLevel", |
Remi NGUYEN VAN | 9f69921 | 2022-01-26 17:39:32 +0900 | [diff] [blame] | 371 | "ConnectivityNextEnableDefaults", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 372 | ], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 373 | static_libs: ["NetworkStackApiCurrentLib"], |
| 374 | certificate: "platform", |
| 375 | manifest: "AndroidManifest_InProcess.xml", |
| 376 | // InProcessNetworkStack is a replacement for NetworkStack |
Remi NGUYEN VAN | ec9d8a6 | 2019-11-11 03:52:43 +0000 | [diff] [blame] | 377 | overrides: ["NetworkStack", "NetworkStackNext"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 378 | // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces |
| 379 | // the default CaptivePortalLogin. |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 380 | required: [ |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 381 | "PlatformCaptivePortalLogin", |
| 382 | ], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 383 | } |
| 384 | |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 385 | // Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top |
| 386 | android_library { |
| 387 | name: "NetworkStackNextManifestBase", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 388 | defaults: [ |
| 389 | "NetworkStackAppDefaults", |
| 390 | "NetworkStackDevApiLevel", |
Remi NGUYEN VAN | 9f69921 | 2022-01-26 17:39:32 +0900 | [diff] [blame] | 391 | "ConnectivityNextEnableDefaults", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 392 | ], |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 393 | static_libs: ["NetworkStackApiCurrentLib"], |
| 394 | manifest: "AndroidManifest.xml" |
| 395 | } |
| 396 | |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 397 | // 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] | 398 | android_app { |
Remi NGUYEN VAN | ec9d8a6 | 2019-11-11 03:52:43 +0000 | [diff] [blame] | 399 | name: "NetworkStackNext", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 400 | defaults: [ |
| 401 | "NetworkStackAppDefaults", |
| 402 | "NetworkStackDevApiLevel", |
Remi NGUYEN VAN | 9f69921 | 2022-01-26 17:39:32 +0900 | [diff] [blame] | 403 | "ConnectivityNextEnableDefaults", |
Remi NGUYEN VAN | e1aed9e | 2021-11-15 11:18:50 +0900 | [diff] [blame] | 404 | ], |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 405 | static_libs: ["NetworkStackNextManifestBase"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 406 | certificate: "networkstack", |
Remi NGUYEN VAN | 255d491 | 2020-02-05 13:42:45 +0900 | [diff] [blame] | 407 | manifest: "AndroidManifest_Next.xml", |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 408 | required: [ |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 409 | "privapp_whitelist_com.android.networkstack", |
| 410 | ], |
Chiachang Wang | d6a4d8f | 2021-11-01 18:55:14 +0800 | [diff] [blame] | 411 | lint: { strict_updatability_linting: true }, |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | // Updatable network stack for finalized API |
| 415 | android_app { |
Remi NGUYEN VAN | ec9d8a6 | 2019-11-11 03:52:43 +0000 | [diff] [blame] | 416 | name: "NetworkStack", |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 417 | defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"], |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 418 | static_libs: ["NetworkStackApiStableLib"], |
| 419 | certificate: "networkstack", |
| 420 | manifest: "AndroidManifest.xml", |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 421 | required: [ |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 422 | "privapp_whitelist_com.android.networkstack", |
| 423 | ], |
Artur Satayev | 862a1a1 | 2020-04-09 11:35:52 +0100 | [diff] [blame] | 424 | updatable: true, |
Chiachang Wang | d6a4d8f | 2021-11-01 18:55:14 +0800 | [diff] [blame] | 425 | lint: { strict_updatability_linting: true }, |
Remi NGUYEN VAN | 9964576 | 2019-07-11 14:33:15 +0900 | [diff] [blame] | 426 | } |
| 427 | |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 428 | cc_library_shared { |
| 429 | name: "libnetworkstackutilsjni", |
| 430 | srcs: [ |
| 431 | "jni/network_stack_utils_jni.cpp" |
| 432 | ], |
Jooyung Han | d3fb9f5 | 2020-04-29 02:43:03 +0900 | [diff] [blame] | 433 | sdk_version: "29", |
| 434 | min_sdk_version: "29", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 435 | shared_libs: [ |
| 436 | "liblog", |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 437 | "libnativehelper_compat_libc++", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 438 | ], |
Orion Hodson | 94561f6 | 2020-12-08 09:56:29 +0000 | [diff] [blame] | 439 | static_libs: [ |
| 440 | "libnetjniutils", |
| 441 | ], |
Lorenzo Colitti | 88ddd88 | 2019-05-01 11:54:33 +0900 | [diff] [blame] | 442 | |
| 443 | // We cannot use plain "libc++" here to link libc++ dynamically because it results in: |
| 444 | // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found |
| 445 | // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't |
| 446 | // build because soong complains of: |
| 447 | // module NetworkStack missing dependencies: libc++_shared |
| 448 | // |
| 449 | // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries |
| 450 | // we depend on do not dynamically link libc++. This is currently the case, because liblog is |
| 451 | // C-only and libnativehelper_compat_libc also uses stl: "c++_static". |
| 452 | // |
| 453 | // TODO: find a better solution for this in R. |
| 454 | stl: "c++_static", |
paulhu | e455e2a | 2019-03-29 17:22:20 +0800 | [diff] [blame] | 455 | cflags: [ |
| 456 | "-Wall", |
| 457 | "-Werror", |
| 458 | "-Wno-unused-parameter", |
| 459 | ], |
| 460 | } |
| 461 | |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 462 | genrule { |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 463 | name: "statslog-networkstack-java-gen-current", |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 464 | tools: ["stats-log-api-gen"], |
| 465 | cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" + |
Muhammad Qureshi | 8e0e9bc | 2019-12-31 11:26:33 -0800 | [diff] [blame] | 466 | " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" + |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 467 | " --minApiLevel 29", |
Chiachang Wang | 8024227 | 2019-04-11 21:24:28 +0800 | [diff] [blame] | 468 | out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"], |
| 469 | } |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 470 | |
Muhammad Qureshi | cd7415e | 2021-02-11 01:54:48 +0000 | [diff] [blame] | 471 | genrule { |
| 472 | name: "statslog-networkstack-java-gen-stable", |
| 473 | tools: ["stats-log-api-gen"], |
| 474 | cmd: "$(location stats-log-api-gen) --java $(out) --module network_stack" + |
| 475 | " --javaPackage com.android.networkstack.metrics --javaClass NetworkStackStatsLog" + |
| 476 | " --minApiLevel 29 --compileApiLevel 30", |
| 477 | out: ["com/android/networkstack/metrics/NetworkStackStatsLog.java"], |
| 478 | } |
| 479 | |
| 480 | |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 481 | version_code_networkstack_next = "300000000" |
| 482 | version_code_networkstack_test = "999999999" |
| 483 | |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 484 | genrule { |
| 485 | name: "NetworkStackTestAndroidManifest", |
| 486 | srcs: ["AndroidManifest.xml"], |
| 487 | out: ["TestAndroidManifest.xml"], |
Remi NGUYEN VAN | 16fe454 | 2020-01-16 13:48:38 +0900 | [diff] [blame] | 488 | cmd: "sed -E 's/versionCode=\"[0-9]+\"/versionCode=\"" |
| 489 | + version_code_networkstack_test |
| 490 | + "\"/' $(in) > $(out)", |
| 491 | visibility: ["//visibility:private"], |
| 492 | } |
| 493 | |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 494 | android_app { |
| 495 | name: "TestNetworkStack", |
Remi NGUYEN VAN | 1d52af0 | 2020-12-22 02:08:55 +0000 | [diff] [blame] | 496 | defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"], |
| 497 | static_libs: ["NetworkStackApiStableLib"], |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 498 | certificate: "networkstack", |
| 499 | manifest: ":NetworkStackTestAndroidManifest", |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 500 | required: [ |
Aaron Huang | 187e948 | 2021-04-27 20:37:07 +0800 | [diff] [blame] | 501 | "privapp_whitelist_com.android.networkstack", |
| 502 | ], |
Kun Niu | 8e89dd4 | 2019-07-16 18:33:45 -0700 | [diff] [blame] | 503 | } |
lifr | cb15db3 | 2020-05-21 20:32:36 +0800 | [diff] [blame] | 504 | |
Remi NGUYEN VAN | 84ba815 | 2020-06-22 18:50:20 +0900 | [diff] [blame] | 505 | // When adding or modifying protos, the jarjar rules and possibly proguard rules need |
| 506 | // to be updated: proto libraries may pull additional static libraries. |
lifr | cb15db3 | 2020-05-21 20:32:36 +0800 | [diff] [blame] | 507 | java_library_static { |
| 508 | name: "statsprotos", |
| 509 | proto: { |
| 510 | type: "lite", |
| 511 | }, |
| 512 | srcs: [ |
| 513 | "src/com/android/networkstack/metrics/stats.proto", |
| 514 | ], |
| 515 | static_libs: [ |
| 516 | "networkstackprotos", |
| 517 | ], |
| 518 | defaults: ["NetworkStackReleaseApiLevel"], |
| 519 | } |