1// Copyright (C) 2019 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// 1. The "net-utils-framework-common" library is also compiled into the framework and placed on the 16// boot classpath. It uses jarjar rules so that anything outside the framework can use this 17// library directly. 18// 2. The "net-utils-services-common" library is for use by modules and frameworks/base/services. 19// It does not need to be jarjared because it is not placed on the bootclasspath. 20// 3. The "net-utils-telephony-common-srcs" filegroup is for use specifically by telephony, which 21// places many of its classes, even non-API service classes, on the boot classpath. Any file that 22// is added to this filegroup *must* have a corresponding jarjar rule in the telephony jarjar 23// rules file. Otherwise, it will end up on the boot classpath and other modules will not be able 24// to provide their own copy. 25 26// Note: all filegroups here must have the right path attribute because otherwise, if they are 27// included in the bootclasspath, they could incorrectly be included in the SDK documentation even 28// though they are not in the current.txt files. 29 30package { 31 default_team: "trendy_team_fwk_core_networking", 32 default_applicable_licenses: ["Android-Apache-2.0"], 33} 34 35java_library { 36 name: "net-utils-device-common", 37 srcs: [ 38 "device/com/android/net/module/util/arp/ArpPacket.java", 39 "device/com/android/net/module/util/DeviceConfigUtils.java", 40 "device/com/android/net/module/util/DomainUtils.java", 41 "device/com/android/net/module/util/FdEventsReader.java", 42 "device/com/android/net/module/util/NetworkMonitorUtils.java", 43 "device/com/android/net/module/util/PacketReader.java", 44 "device/com/android/net/module/util/SharedLog.java", 45 "device/com/android/net/module/util/SocketUtils.java", 46 "device/com/android/net/module/util/FeatureVersions.java", 47 "device/com/android/net/module/util/HandlerUtils.java", 48 // This library is used by system modules, for which the system health impact of Kotlin 49 // has not yet been evaluated. Annotations may need jarjar'ing. 50 // "src_devicecommon/**/*.kt", 51 ], 52 sdk_version: "module_current", 53 min_sdk_version: "30", 54 target_sdk_version: "30", 55 apex_available: [ 56 "//apex_available:anyapex", 57 "//apex_available:platform", 58 ], 59 visibility: [ 60 "//frameworks/base/packages/Tethering", 61 "//packages/modules/Connectivity:__subpackages__", 62 "//packages/modules/Connectivity/framework:__subpackages__", 63 "//frameworks/opt/net/ike", 64 "//frameworks/opt/net/wifi/service", 65 "//packages/modules/Wifi/service", 66 "//frameworks/opt/net/telephony", 67 "//packages/modules/NetworkStack:__subpackages__", 68 "//packages/modules/CaptivePortalLogin", 69 ], 70 static_libs: [ 71 "net-utils-framework-common", 72 ], 73 libs: [ 74 "androidx.annotation_annotation", 75 "framework-annotations-lib", 76 "framework-configinfrastructure", 77 "framework-connectivity.stubs.module_lib", 78 ], 79 lint: { 80 strict_updatability_linting: true, 81 error_checks: ["NewApi"], 82 }, 83} 84 85java_defaults { 86 name: "lib_mockito_extended", 87 static_libs: [ 88 "mockito-target-extended-minus-junit4", 89 ], 90 jni_libs: [ 91 "libdexmakerjvmtiagent", 92 "libstaticjvmtiagent", 93 ], 94} 95 96java_library { 97 name: "net-utils-dnspacket-common", 98 srcs: [ 99 "framework/**/DnsPacket.java", 100 "framework/**/DnsPacketUtils.java", 101 "framework/**/DnsSvcbPacket.java", 102 "framework/**/DnsSvcbRecord.java", 103 "framework/**/HexDump.java", 104 "framework/**/NetworkStackConstants.java", 105 ], 106 sdk_version: "module_current", 107 visibility: [ 108 "//packages/services/Iwlan:__subpackages__", 109 ], 110 libs: [ 111 "androidx.annotation_annotation", 112 "framework-annotations-lib", 113 "framework-connectivity.stubs.module_lib", 114 ], 115} 116 117filegroup { 118 name: "net-utils-framework-common-srcs", 119 srcs: ["framework/**/*.java"], 120 path: "framework", 121 visibility: [ 122 "//frameworks/base", 123 "//packages/modules/Connectivity:__subpackages__", 124 ], 125} 126 127// The net-utils-device-common-bpf library requires the callers to contain 128// net-utils-device-common-struct-base. 129java_library { 130 name: "net-utils-device-common-bpf", 131 srcs: [ 132 "device/com/android/net/module/util/BpfBitmap.java", 133 "device/com/android/net/module/util/BpfDump.java", 134 "device/com/android/net/module/util/BpfMap.java", 135 "device/com/android/net/module/util/BpfUtils.java", 136 "device/com/android/net/module/util/IBpfMap.java", 137 "device/com/android/net/module/util/JniUtil.java", 138 "device/com/android/net/module/util/SingleWriterBpfMap.java", 139 "device/com/android/net/module/util/TcUtils.java", 140 ], 141 sdk_version: "module_current", 142 min_sdk_version: "30", 143 visibility: [ 144 "//packages/modules/Connectivity:__subpackages__", 145 "//packages/modules/NetworkStack:__subpackages__", 146 ], 147 libs: [ 148 "androidx.annotation_annotation", 149 "framework-connectivity.stubs.module_lib", 150 "net-utils-device-common-struct-base", 151 ], 152 apex_available: [ 153 "com.android.tethering", 154 "//apex_available:platform", 155 ], 156 lint: { 157 strict_updatability_linting: true, 158 error_checks: ["NewApi"], 159 }, 160} 161 162java_library { 163 name: "net-utils-device-common-struct-base", 164 srcs: [ 165 "device/com/android/net/module/util/Struct.java", 166 ], 167 sdk_version: "module_current", 168 min_sdk_version: "30", 169 visibility: [ 170 "//packages/modules/Connectivity:__subpackages__", 171 "//packages/modules/NetworkStack:__subpackages__", 172 ], 173 static_libs: [ 174 "net-utils-framework-common", 175 ], 176 libs: [ 177 "androidx.annotation_annotation", 178 "framework-annotations-lib", // Required by InetAddressUtils.java 179 "framework-connectivity.stubs.module_lib", 180 ], 181 apex_available: [ 182 "com.android.tethering", 183 "//apex_available:platform", 184 ], 185 lint: { 186 strict_updatability_linting: true, 187 error_checks: ["NewApi"], 188 }, 189} 190 191// The net-utils-device-common-struct library requires the callers to contain 192// net-utils-device-common-struct-base. 193java_library { 194 name: "net-utils-device-common-struct", 195 srcs: [ 196 "device/com/android/net/module/util/Ipv6Utils.java", 197 "device/com/android/net/module/util/PacketBuilder.java", 198 "device/com/android/net/module/util/structs/*.java", 199 ], 200 sdk_version: "module_current", 201 min_sdk_version: "30", 202 visibility: [ 203 "//packages/modules/Connectivity:__subpackages__", 204 "//packages/modules/NetworkStack:__subpackages__", 205 ], 206 libs: [ 207 "androidx.annotation_annotation", 208 "framework-annotations-lib", // Required by IpUtils.java 209 "framework-connectivity.stubs.module_lib", 210 "net-utils-device-common-struct-base", 211 ], 212 apex_available: [ 213 "com.android.tethering", 214 "//apex_available:platform", 215 ], 216 lint: { 217 strict_updatability_linting: true, 218 error_checks: ["NewApi"], 219 }, 220} 221 222// The net-utils-device-common-netlink library requires the callers to contain 223// net-utils-device-common-struct and net-utils-device-common-struct-base. 224java_library { 225 name: "net-utils-device-common-netlink", 226 srcs: [ 227 "device/com/android/net/module/util/netlink/**/*.java", 228 ], 229 sdk_version: "module_current", 230 min_sdk_version: "30", 231 visibility: [ 232 "//packages/modules/Connectivity:__subpackages__", 233 "//packages/modules/NetworkStack:__subpackages__", 234 ], 235 libs: [ 236 "androidx.annotation_annotation", 237 "framework-connectivity.stubs.module_lib", 238 // For libraries which are statically linked in framework-connectivity, do not 239 // statically link here because callers of this library might already have a static 240 // version linked. 241 "net-utils-device-common-struct", 242 "net-utils-device-common-struct-base", 243 ], 244 apex_available: [ 245 "com.android.tethering", 246 "//apex_available:platform", 247 ], 248 lint: { 249 strict_updatability_linting: true, 250 error_checks: ["NewApi"], 251 }, 252} 253 254// The net-utils-device-common-ip library requires the callers to contain 255// net-utils-device-common-struct and net-utils-device-common-struct-base. 256java_library { 257 // TODO : this target should probably be folded into net-utils-device-common 258 name: "net-utils-device-common-ip", 259 srcs: [ 260 "device/com/android/net/module/util/ip/*.java", 261 ], 262 sdk_version: "module_current", 263 min_sdk_version: "30", 264 visibility: [ 265 "//packages/modules/Connectivity:__subpackages__", 266 "//packages/modules/NetworkStack:__subpackages__", 267 ], 268 libs: [ 269 "framework-annotations-lib", 270 "framework-connectivity", 271 ], 272 static_libs: [ 273 "net-utils-device-common", 274 "net-utils-device-common-netlink", 275 "net-utils-framework-common", 276 "netd-client", 277 ], 278 apex_available: [ 279 "com.android.tethering", 280 "//apex_available:platform", 281 ], 282 lint: { 283 baseline_filename: "lint-baseline.xml", 284 error_checks: ["NewApi"], 285 }, 286} 287 288java_library { 289 name: "net-utils-framework-common", 290 srcs: [ 291 ":net-utils-framework-common-srcs", 292 ], 293 sdk_version: "module_current", 294 min_sdk_version: "30", 295 libs: [ 296 "androidx.annotation_annotation", 297 "framework-annotations-lib", 298 "framework-connectivity.stubs.module_lib", 299 "framework-connectivity-t.stubs.module_lib", 300 "framework-location.stubs.module_lib", 301 ], 302 jarjar_rules: "jarjar-rules-shared.txt", 303 visibility: [ 304 "//cts/tests/tests/net", 305 "//cts/tests/tests/wifi", 306 "//packages/modules/Connectivity/tests/cts/net", 307 "//packages/modules/Connectivity/Tethering", 308 "//frameworks/base/tests:__subpackages__", 309 "//frameworks/opt/net/ike", 310 "//frameworks/opt/telephony", 311 "//frameworks/base/wifi:__subpackages__", 312 "//packages/modules/Connectivity:__subpackages__", 313 "//packages/modules/NetworkStack:__subpackages__", 314 "//packages/modules/CaptivePortalLogin", 315 "//packages/modules/Wifi/framework/tests:__subpackages__", 316 "//packages/apps/Settings", 317 ], 318 lint: { 319 strict_updatability_linting: true, 320 error_checks: ["NewApi"], 321 }, 322 errorprone: { 323 enabled: true, 324 // Error-prone checking only warns of problems when building. To make the build fail with 325 // these errors, list the specific error-prone problems below. 326 javacflags: [ 327 "-Xep:NullablePrimitive:ERROR", 328 ], 329 }, 330 apex_available: [ 331 "//apex_available:platform", 332 "com.android.tethering", 333 ], 334} 335 336java_library { 337 name: "net-utils-services-common", 338 srcs: [ 339 "device/android/net/NetworkFactory.java", 340 "device/android/net/NetworkFactoryImpl.java", 341 "device/android/net/NetworkFactoryLegacyImpl.java", 342 "device/android/net/NetworkFactoryShim.java", 343 ], 344 sdk_version: "module_current", 345 min_sdk_version: "30", 346 static_libs: [ 347 "modules-utils-build_system", 348 ], 349 libs: [ 350 "framework-annotations-lib", 351 "framework-connectivity", 352 ], 353 // TODO: remove "apex_available:platform". 354 apex_available: [ 355 "//apex_available:platform", 356 "com.android.btservices", 357 "com.android.tethering", 358 "com.android.wifi", 359 ], 360 visibility: [ 361 // TODO: remove after NetworkStatsService moves to the module. 362 "//frameworks/base/services/net", 363 "//packages/modules/Connectivity/service", 364 "//packages/modules/Connectivity/tests:__subpackages__", 365 "//packages/modules/Bluetooth/android/app", 366 "//packages/modules/Wifi/service:__subpackages__", 367 ], 368 lint: { 369 strict_updatability_linting: true, 370 error_checks: ["NewApi"], 371 }, 372} 373 374java_library { 375 name: "net-utils-device-common-async", 376 srcs: [ 377 "device/com/android/net/module/util/async/*.java", 378 ], 379 sdk_version: "module_current", 380 min_sdk_version: "30", 381 visibility: [ 382 "//packages/modules/Connectivity:__subpackages__", 383 ], 384 libs: [ 385 "framework-annotations-lib", 386 ], 387 static_libs: [ 388 ], 389 apex_available: [ 390 "com.android.tethering", 391 "//apex_available:platform", 392 ], 393 lint: { 394 strict_updatability_linting: true, 395 error_checks: ["NewApi"], 396 }, 397} 398 399java_library { 400 name: "net-utils-device-common-wear", 401 srcs: [ 402 "device/com/android/net/module/util/wear/*.java", 403 ], 404 sdk_version: "module_current", 405 min_sdk_version: "30", 406 visibility: [ 407 "//packages/modules/Connectivity:__subpackages__", 408 ], 409 libs: [ 410 "framework-annotations-lib", 411 ], 412 static_libs: [ 413 "net-utils-device-common-async", 414 ], 415 apex_available: [ 416 "com.android.tethering", 417 "//apex_available:platform", 418 ], 419 lint: { 420 strict_updatability_linting: true, 421 error_checks: ["NewApi"], 422 }, 423} 424 425// Limited set of utilities for use by service-connectivity-mdns-standalone-build-test, to make sure 426// the mDNS code can build with only system APIs. 427// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that 428// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build 429// rule verifies that the mDNS code can be built into apps, if code transformations are applied to 430// the annotations. 431// When using "system_current", framework annotations are not available; they would appear as 432// package-private as they are marked as such in the system_current stubs. So build against 433// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7. 434java_library { 435 name: "net-utils-device-common-mdns-standalone-build-test", 436 // Build against core_platform and add the stub libraries manually in "libs", as annotations 437 // are already included in android_system_stubs_current but package-private, so 438 // "framework-annotations-lib" needs to be manually included before 439 // "android_system_stubs_current" (b/272392042) 440 sdk_version: "core_platform", 441 srcs: [ 442 "device/com/android/net/module/util/FdEventsReader.java", 443 "device/com/android/net/module/util/SharedLog.java", 444 "framework/com/android/net/module/util/ByteUtils.java", 445 "framework/com/android/net/module/util/CollectionUtils.java", 446 "framework/com/android/net/module/util/HexDump.java", 447 "framework/com/android/net/module/util/LinkPropertiesUtils.java", 448 ], 449 libs: [ 450 "framework-annotations-lib", 451 "android_system_stubs_current", 452 "androidx.annotation_annotation", 453 ], 454 visibility: ["//packages/modules/Connectivity/service-t"], 455} 456 457// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be 458// included either (some annotations would be duplicated on the bootclasspath). 459filegroup { 460 name: "net-utils-telephony-common-srcs", 461 srcs: [ 462 // Any class here *must* have a corresponding jarjar rule in the telephony build rules. 463 "device/android/net/NetworkFactory.java", 464 "device/android/net/NetworkFactoryImpl.java", 465 "device/android/net/NetworkFactoryLegacyImpl.java", 466 "device/android/net/NetworkFactoryShim.java", 467 ], 468 path: "device", 469 visibility: [ 470 "//frameworks/opt/telephony", 471 ], 472} 473 474// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar 475// rules on the wifi side. 476// Any class here *must* have a corresponding jarjar rule in the wifi build rules. 477filegroup { 478 name: "net-utils-framework-wifi-common-srcs", 479 srcs: [ 480 "framework/com/android/net/module/util/DnsSdTxtRecord.java", 481 "framework/com/android/net/module/util/Inet4AddressUtils.java", 482 "framework/com/android/net/module/util/InetAddressUtils.java", 483 "framework/com/android/net/module/util/MacAddressUtils.java", 484 "framework/com/android/net/module/util/NetUtils.java", 485 ], 486 path: "framework", 487 visibility: [ 488 "//frameworks/base", 489 ], 490} 491 492// Use a filegroup and not a library for wifi sources, as this needs corresponding jar-jar 493// rules on the wifi side. 494// Any class here *must* have a corresponding jarjar rule in the wifi build rules. 495filegroup { 496 name: "net-utils-wifi-service-common-srcs", 497 srcs: [ 498 "device/android/net/NetworkFactory.java", 499 "device/android/net/NetworkFactoryImpl.java", 500 "device/android/net/NetworkFactoryLegacyImpl.java", 501 "device/android/net/NetworkFactoryShim.java", 502 ], 503 visibility: [ 504 "//frameworks/opt/net/wifi/service", 505 "//packages/modules/Wifi/service", 506 ], 507} 508