Refactor staticlibs

This CL introduces net-utils-framework-connectivity, net-utils-tethering
and net-utils-service-connectivity as staticlibs.

- net-utils-framework-connectivity will be used by
  framework-connectivity-pre-jarjar.
- net-utils-service-connectivity and net-utils-tethering are the
  static liraries used by service-connectivity-pre-jarjar and Tethering
  respectively.

Bug: 350699020
Test: CI

Change-Id: I4dbb2b0de905a576cfcf24d2d5d1f1a261d2bd68
This commit is contained in:
Handa Wang 2024-07-02 13:17:43 +00:00
commit 9b0df36ea4
5 changed files with 163 additions and 18 deletions

View file

@ -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",
],

View file

@ -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

View file

@ -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",

View file

@ -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"],
}

View file

@ -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: {