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