diff --git a/Tethering/Android.bp b/Tethering/Android.bp index e84573ba8e..b4426a6b17 100644 --- a/Tethering/Android.bp +++ b/Tethering/Android.bp @@ -69,13 +69,7 @@ java_defaults { "android.hardware.tetheroffload.control-V1.0-java", "android.hardware.tetheroffload.control-V1.1-java", "android.hidl.manager-V1.2-java", - "net-utils-framework-common", - "net-utils-device-common", - "net-utils-device-common-bpf", - "net-utils-device-common-ip", - "net-utils-device-common-netlink", - "net-utils-device-common-struct", - "net-utils-device-common-struct-base", + "net-utils-tethering", "netd-client", "tetheringstatsprotos", ], diff --git a/framework/Android.bp b/framework/Android.bp index deb1c5ad2e..9c75ea7569 100644 --- a/framework/Android.bp +++ b/framework/Android.bp @@ -95,8 +95,7 @@ java_defaults { "framework-connectivity-javastream-protos", ], impl_only_static_libs: [ - "net-utils-device-common-bpf", - "net-utils-device-common-struct-base", + "net-utils-framework-connectivity", ], libs: [ "androidx.annotation_annotation", @@ -123,8 +122,7 @@ java_library { // to generate the SDK stubs. // Even if the library is included in "impl_only_static_libs" of defaults. This is still // needed because java_library which doesn't understand "impl_only_static_libs". - "net-utils-device-common-bpf", - "net-utils-device-common-struct-base", + "net-utils-framework-connectivity", ], libs: [ // This cannot be in the defaults clause above because if it were, it would be used diff --git a/service/Android.bp b/service/Android.bp index 1dd09a9557..1a0e04555c 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -190,18 +190,12 @@ java_library { "connectivity_native_aidl_interface-lateststable-java", "dnsresolver_aidl_interface-V15-java", "modules-utils-shell-command-handler", - "net-utils-device-common", - "net-utils-device-common-ip", - "net-utils-device-common-netlink", - "net-utils-services-common", + "net-utils-service-connectivity", "netd-client", "networkstack-client", "PlatformProperties", "service-connectivity-protos", "service-connectivity-stats-protos", - // The required dependency net-utils-device-common-struct-base is in the classpath via - // framework-connectivity - "net-utils-device-common-struct", ], apex_available: [ "com.android.tethering", diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp index 34ea9ab6d7..2c3a5580b8 100644 --- a/staticlibs/Android.bp +++ b/staticlibs/Android.bp @@ -456,6 +456,126 @@ java_library { visibility: ["//packages/modules/Connectivity/service-t"], } +java_library { + name: "net-utils-framework-connectivity", + srcs: [ + ":net-utils-framework-connectivity-srcs", + ], + sdk_version: "module_current", + min_sdk_version: "30", + apex_available: [ + "com.android.tethering", + "//apex_available:platform", + ], + visibility: [ + "//packages/modules/Connectivity:__subpackages__", + "//packages/modules/NetworkStack:__subpackages__", + ], + libs: [ + "androidx.annotation_annotation", + "framework-annotations-lib", + "framework-configinfrastructure", + "framework-connectivity.stubs.module_lib", + ], + lint: { + strict_updatability_linting: true, + error_checks: ["NewApi"], + }, +} + +java_defaults { + name: "net-utils-non-bootclasspath-defaults", + sdk_version: "module_current", + min_sdk_version: "30", + jarjar_rules: "jarjar-rules-shared.txt", + libs: [ + "androidx.annotation_annotation", + "framework-annotations-lib", + "framework-configinfrastructure", + "framework-connectivity", + "framework-connectivity.stubs.module_lib", + "framework-connectivity-t.stubs.module_lib", + "framework-location.stubs.module_lib", + "framework-tethering", + "unsupportedappusage", + ], + static_libs: [ + "modules-utils-build_system", + "modules-utils-statemachine", + "net-utils-non-bootclasspath-aidl-java", + "netd-client", + ], + apex_available: [ + "com.android.tethering", + "//apex_available:platform", + ], + visibility: [ + "//packages/modules/Connectivity:__subpackages__", + ], + defaults_visibility: [ + "//visibility:private", + ], + lint: { + strict_updatability_linting: true, + error_checks: ["NewApi"], + }, +} + +java_library { + name: "net-utils-service-connectivity", + srcs: [ + ":net-utils-all-srcs", + ], + exclude_srcs: [ + ":net-utils-framework-connectivity-srcs", + ], + libs: [ + "net-utils-framework-connectivity", + ], + defaults: ["net-utils-non-bootclasspath-defaults"], +} + +java_library { + name: "net-utils-tethering", + srcs: [ + ":net-utils-all-srcs", + ":framework-connectivity-shared-srcs", + ], + defaults: ["net-utils-non-bootclasspath-defaults"], +} + +aidl_interface { + name: "net-utils-non-bootclasspath-aidl", + srcs: [ + ":net-utils-aidl-srcs", + ], + unstable: true, + backend: { + java: { + enabled: true, + min_sdk_version: "30", + apex_available: [ + "com.android.tethering", + ], + }, + cpp: { + enabled: false, + }, + ndk: { + enabled: false, + }, + rust: { + enabled: false, + }, + }, + include_dirs: [ + "packages/modules/Connectivity/framework/aidl-export", + ], + visibility: [ + "//system/tools/aidl/build", + ], +} + // 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 { @@ -507,3 +627,41 @@ filegroup { "//packages/modules/Wifi/service", ], } + +// Use a file group containing classes necessary for framework-connectivity. The file group should +// be as small as possible because because the classes end up in the bootclasspath and R8 is not +// used to remove unused classes. +filegroup { + name: "net-utils-framework-connectivity-srcs", + srcs: [ + "device/com/android/net/module/util/BpfBitmap.java", + "device/com/android/net/module/util/BpfDump.java", + "device/com/android/net/module/util/BpfMap.java", + "device/com/android/net/module/util/BpfUtils.java", + "device/com/android/net/module/util/IBpfMap.java", + "device/com/android/net/module/util/JniUtil.java", + "device/com/android/net/module/util/SingleWriterBpfMap.java", + "device/com/android/net/module/util/Struct.java", + "device/com/android/net/module/util/TcUtils.java", + "framework/com/android/net/module/util/HexDump.java", + ], + visibility: ["//visibility:private"], +} + +filegroup { + name: "net-utils-all-srcs", + srcs: [ + "device/**/*.java", + ":net-utils-framework-common-srcs", + ], + visibility: ["//visibility:private"], +} + +filegroup { + name: "net-utils-aidl-srcs", + srcs: [ + "device/**/*.aidl", + ], + path: "device", + visibility: ["//visibility:private"], +} diff --git a/staticlibs/testutils/Android.bp b/staticlibs/testutils/Android.bp index 8c71a91ea8..4749e75a68 100644 --- a/staticlibs/testutils/Android.bp +++ b/staticlibs/testutils/Android.bp @@ -42,6 +42,7 @@ java_library { "net-utils-device-common-struct", "net-utils-device-common-struct-base", "net-utils-device-common-wear", + "net-utils-framework-connectivity", "modules-utils-build_system", ], lint: {