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