diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp index 1fe6c2cc2b..904e8c6725 100644 --- a/staticlibs/Android.bp +++ b/staticlibs/Android.bp @@ -328,6 +328,38 @@ java_library { lint: { strict_updatability_linting: true }, } +// Limited set of utilities for use by service-connectivity-mdns-standalone-build-test, to make sure +// the mDNS code can build with only system APIs. +// The mDNS code is platform code so it should use framework-annotations-lib, contrary to apps that +// should use sdk_version: "system_current" and only androidx.annotation_annotation. But this build +// rule verifies that the mDNS code can be built into apps, if code transformations are applied to +// the annotations. +// When using "system_current", framework annotations are not available; they would appear as +// package-private as they are marked as such in the system_current stubs. So build against +// core_platform and add the stubs manually in "libs". See http://b/147773144#comment7. +java_library { + name: "net-utils-device-common-mdns-standalone-build-test", + // Build against core_platform and add the stub libraries manually in "libs", as annotations + // are already included in android_system_stubs_current but package-private, so + // "framework-annotations-lib" needs to be manually included before + // "android_system_stubs_current" (b/272392042) + sdk_version: "core_platform", + srcs: [ + "device/com/android/net/module/util/FdEventsReader.java", + "device/com/android/net/module/util/HexDump.java", + "device/com/android/net/module/util/SharedLog.java", + "framework/com/android/net/module/util/ByteUtils.java", + "framework/com/android/net/module/util/CollectionUtils.java", + "framework/com/android/net/module/util/LinkPropertiesUtils.java", + ], + libs: [ + "framework-annotations-lib", + "android_system_stubs_current", + "androidx.annotation_annotation", + ], + visibility: ["//packages/modules/Connectivity/service-t"], +} + // Use a filegroup and not a library for telephony sources, as framework-annotations cannot be // included either (some annotations would be duplicated on the bootclasspath). filegroup {