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