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