1// 2// Copyright (C) 2020 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 17package { 18 default_team: "trendy_team_fwk_core_networking", 19 // See: http://go/android-license-faq 20 default_applicable_licenses: ["Android-Apache-2.0"], 21} 22 23filegroup { 24 name: "framework-connectivity-internal-sources", 25 srcs: [ 26 "src/**/*.java", 27 "src/**/*.aidl", 28 ], 29 path: "src", 30 visibility: [ 31 "//visibility:private", 32 ], 33} 34 35filegroup { 36 name: "framework-connectivity-aidl-export-sources", 37 srcs: [ 38 "aidl-export/**/*.aidl", 39 ], 40 path: "aidl-export", 41 visibility: [ 42 "//visibility:private", 43 ], 44} 45 46// TODO: use a java_library in the bootclasspath instead 47filegroup { 48 name: "framework-connectivity-sources", 49 defaults: ["framework-sources-module-defaults"], 50 srcs: [ 51 ":framework-connectivity-internal-sources", 52 ":framework-connectivity-aidl-export-sources", 53 ], 54 visibility: ["//packages/modules/Connectivity:__subpackages__"], 55} 56 57java_defaults { 58 name: "framework-connectivity-defaults", 59 defaults: ["framework-module-defaults"], 60 sdk_version: "module_current", 61 min_sdk_version: "30", 62 srcs: [ 63 ":framework-connectivity-sources", 64 ":net-utils-framework-common-srcs", 65 ":framework-connectivity-api-shared-srcs", 66 ":framework-networksecurity-sources", 67 ":statslog-framework-connectivity-java-gen", 68 ], 69 aidl: { 70 generate_get_transaction_name: true, 71 include_dirs: [ 72 // Include directories for parcelables that are part of the stable API, and need a 73 // one-line "parcelable X" .aidl declaration to be used in AIDL interfaces. 74 // TODO(b/180293679): remove these dependencies as they should not be necessary once 75 // the module builds against API (the parcelable declarations exist in framework.aidl) 76 "frameworks/base/core/java", // For framework parcelables 77 "frameworks/native/aidl/binder", // For PersistableBundle.aidl 78 ], 79 }, 80 stub_only_libs: [ 81 "framework-connectivity-t.stubs.module_lib", 82 ], 83 impl_only_libs: [ 84 // TODO: figure out why just using "framework-tethering" uses the stubs, even though both 85 // framework-connectivity and framework-tethering are in the same APEX. 86 "framework-location.stubs.module_lib", 87 "framework-tethering.impl", 88 "framework-wifi.stubs.module_lib", 89 ], 90 static_libs: [ 91 "com.android.net.flags-aconfig-java", 92 // Not using the latest stable version because all functions in the latest version of 93 // mdns_aidl_interface are deprecated. 94 "mdns_aidl_interface-V1-java", 95 "modules-utils-backgroundthread", 96 "modules-utils-build", 97 "modules-utils-preconditions", 98 "networksecurity_flags_java_lib", 99 "framework-connectivity-javastream-protos", 100 ], 101 impl_only_static_libs: [ 102 "net-utils-framework-connectivity", 103 ], 104 libs: [ 105 "androidx.annotation_annotation", 106 "app-compat-annotations", 107 "framework-connectivity-t.stubs.module_lib", 108 "framework-statsd.stubs.module_lib", 109 "unsupportedappusage", 110 ], 111 apex_available: [ 112 "com.android.tethering", 113 ], 114} 115 116// Library to allow Cronet to use hidden APIs 117java_library { 118 name: "framework-connectivity-pre-jarjar-without-cronet", 119 defaults: [ 120 "framework-connectivity-defaults", 121 ], 122 static_libs: [ 123 // Framework-connectivity-pre-jarjar is identical to framework-connectivity 124 // implementation, but without the jarjar rules. However, framework-connectivity 125 // is not based on framework-connectivity-pre-jarjar, it's rebuilt from source 126 // to generate the SDK stubs. 127 // Even if the library is included in "impl_only_static_libs" of defaults. This is still 128 // needed because java_library which doesn't understand "impl_only_static_libs". 129 "net-utils-framework-connectivity", 130 ], 131 libs: [ 132 // This cannot be in the defaults clause above because if it were, it would be used 133 // to generate the connectivity stubs. That would create a circular dependency 134 // because the tethering impl depend on the connectivity stubs (e.g., 135 // TetheringRequest depends on LinkAddress). 136 "framework-location.stubs.module_lib", 137 "framework-tethering.impl", 138 "framework-wifi.stubs.module_lib", 139 ], 140 visibility: ["//external/cronet:__subpackages__"], 141} 142 143java_library { 144 name: "framework-connectivity-pre-jarjar", 145 defaults: ["framework-module-defaults"], 146 min_sdk_version: "30", 147 static_libs: [ 148 "framework-connectivity-pre-jarjar-without-cronet", 149 "httpclient_api", 150 "httpclient_impl", 151 ], 152 apex_available: [ 153 "com.android.tethering", 154 ], 155 visibility: ["//packages/modules/Connectivity:__subpackages__"], 156} 157 158java_defaults { 159 name: "CronetJavaDefaults", 160 srcs: [":httpclient_api_sources"], 161 static_libs: ["com.android.net.http.flags-aconfig-java"], 162 libs: [ 163 "androidx.annotation_annotation", 164 ], 165 impl_only_static_libs: [ 166 "httpclient_impl", 167 ], 168} 169 170java_sdk_library { 171 name: "framework-connectivity", 172 defaults: [ 173 "framework-connectivity-defaults", 174 "CronetJavaDefaults", 175 ], 176 installable: true, 177 jarjar_rules: ":framework-connectivity-jarjar-rules", 178 permitted_packages: ["android.net"], 179 impl_library_visibility: [ 180 "//packages/modules/Connectivity/Tethering/apex", 181 // In preparation for future move 182 "//packages/modules/Connectivity/apex", 183 "//packages/modules/Connectivity/framework-t", 184 "//packages/modules/Connectivity/remoteauth/service", 185 "//packages/modules/Connectivity/service", 186 "//packages/modules/Connectivity/service-t", 187 "//packages/modules/Connectivity/staticlibs", 188 "//frameworks/base", 189 190 // Tests using hidden APIs 191 "//cts/tests/netlegacy22.api", 192 "//cts/tests/tests/app.usage", // NetworkUsageStatsTest 193 194 // TODO: b/374174952 Remove it when VCN CTS is moved to Connectivity/ 195 "//cts/tests/tests/vcn", 196 197 "//external/sl4a:__subpackages__", 198 "//frameworks/base/core/tests/bandwidthtests", 199 "//frameworks/base/core/tests/benchmarks", 200 "//frameworks/base/core/tests/utillib", 201 "//frameworks/base/services/tests/VpnTests", 202 "//frameworks/base/tests/vcn", 203 "//frameworks/opt/net/ethernet/tests:__subpackages__", 204 "//frameworks/opt/telephony/tests/telephonytests", 205 "//packages/modules/CaptivePortalLogin/tests", 206 "//packages/modules/Connectivity/staticlibs/testutils", 207 "//packages/modules/Connectivity/staticlibs/tests:__subpackages__", 208 "//packages/modules/Connectivity/Cronet/tests:__subpackages__", 209 "//packages/modules/Connectivity/Tethering/tests:__subpackages__", 210 "//packages/modules/Connectivity/tests:__subpackages__", 211 "//packages/modules/Connectivity/thread/tests:__subpackages__", 212 "//packages/modules/IPsec/tests/iketests", 213 "//packages/modules/NetworkStack", 214 "//packages/modules/NetworkStack/tests:__subpackages__", 215 "//packages/modules/Wifi/service/tests/wifitests", 216 ], 217 lint: { 218 baseline_filename: "lint-baseline.xml", 219 }, 220 aconfig_declarations: [ 221 "com.android.net.flags-aconfig", 222 "com.android.net.http.flags-aconfig", 223 "com.android.networksecurity.flags-aconfig", 224 ], 225} 226 227platform_compat_config { 228 name: "connectivity-platform-compat-config", 229 src: ":framework-connectivity", 230} 231 232cc_library_shared { 233 name: "libframework-connectivity-jni", 234 min_sdk_version: "30", 235 cflags: [ 236 "-Wall", 237 "-Werror", 238 "-Wno-unused-parameter", 239 // Don't warn about S API usage even with 240 // min_sdk 30: the library is only loaded 241 // on S+ devices 242 "-Wno-unguarded-availability", 243 "-Wthread-safety", 244 ], 245 srcs: [ 246 "jni/android_net_NetworkUtils.cpp", 247 "jni/onload.cpp", 248 ], 249 shared_libs: [ 250 "libandroid", 251 "liblog", 252 "libnativehelper", 253 ], 254 header_libs: [ 255 "bpf_headers", 256 "dnsproxyd_protocol_headers", 257 ], 258 stl: "none", 259 apex_available: [ 260 "com.android.tethering", 261 ], 262} 263 264filegroup { 265 name: "framework-connectivity-protos", 266 srcs: [ 267 "proto/**/*.proto", 268 ], 269 visibility: ["//frameworks/base"], 270} 271 272java_library { 273 name: "framework-connectivity-javastream-protos", 274 proto: { 275 type: "stream", 276 }, 277 srcs: [":framework-connectivity-protos"], 278 installable: false, 279 sdk_version: "module_current", 280 min_sdk_version: "30", 281 apex_available: [ 282 "com.android.tethering", 283 ], 284} 285 286java_genrule { 287 name: "framework-connectivity-jarjar-rules", 288 tool_files: [ 289 ":connectivity-hiddenapi-files", 290 ":framework-connectivity-pre-jarjar{.jar}", 291 ":framework-connectivity-t-pre-jarjar{.jar}", 292 ":framework-connectivity.stubs.module_lib{.jar}", 293 ":framework-connectivity-t.stubs.module_lib{.jar}", 294 ":framework-connectivity-module-api-stubs-including-flagged{.jar}", 295 "jarjar-excludes.txt", 296 ], 297 tools: [ 298 "jarjar-rules-generator", 299 ], 300 out: ["framework_connectivity_jarjar_rules.txt"], 301 cmd: "$(location jarjar-rules-generator) " + 302 "$(location :framework-connectivity-pre-jarjar{.jar}) " + 303 "$(location :framework-connectivity-t-pre-jarjar{.jar}) " + 304 "--prefix android.net.connectivity " + 305 "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " + 306 "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " + 307 "--apistubs $(location :framework-connectivity-module-api-stubs-including-flagged{.jar}) " + 308 // Make a ":"-separated list. There will be an extra ":" but empty items are ignored. 309 "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " + 310 "--excludes $(location jarjar-excludes.txt) " + 311 "--output $(out)", 312 visibility: [ 313 "//packages/modules/Connectivity/framework:__subpackages__", 314 "//packages/modules/Connectivity/framework-t:__subpackages__", 315 "//packages/modules/Connectivity/service", 316 ], 317} 318 319droidstubs { 320 name: "framework-connectivity-module-api-stubs-including-flagged-droidstubs", 321 srcs: [ 322 ":framework-connectivity-sources", 323 ":framework-connectivity-tiramisu-updatable-sources", 324 ":framework-networksecurity-sources", 325 ":framework-nearby-java-sources", 326 ":framework-thread-sources", 327 ], 328 flags: [ 329 "--show-for-stub-purposes-annotation android.annotation.SystemApi" + 330 "\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)", 331 "--show-for-stub-purposes-annotation android.annotation.SystemApi" + 332 "\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)", 333 ], 334 aidl: { 335 include_dirs: [ 336 "packages/modules/Connectivity/framework/aidl-export", 337 "frameworks/native/aidl/binder", // For PersistableBundle.aidl 338 ], 339 }, 340} 341 342java_library { 343 name: "framework-connectivity-module-api-stubs-including-flagged", 344 srcs: [":framework-connectivity-module-api-stubs-including-flagged-droidstubs"], 345} 346 347// Library providing limited APIs within the connectivity module, so that R+ components like 348// Tethering have a controlled way to depend on newer components like framework-connectivity that 349// are not loaded on R. 350// Note that this target needs to have access to hidden classes, and as such needs to list 351// the full libraries instead of the .impl lib (which only expose API classes). 352java_library { 353 name: "connectivity-internal-api-util", 354 sdk_version: "module_current", 355 libs: [ 356 "androidx.annotation_annotation", 357 "framework-connectivity-pre-jarjar", 358 ], 359 jarjar_rules: ":framework-connectivity-jarjar-rules", 360 srcs: [ 361 // Files listed here MUST all be annotated with @RequiresApi(Build.VERSION_CODES.S) 362 // or above as appropriate so that API checks are enforced for R+ users of this library 363 "src/android/net/connectivity/ConnectivityInternalApiUtil.java", 364 ], 365 visibility: [ 366 "//packages/modules/Connectivity/Tethering:__subpackages__", 367 ], 368} 369