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