2021-01-15 16:22:36 +09:00
|
|
|
//
|
|
|
|
|
// Copyright (C) 2020 The Android Open Source Project
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
//
|
|
|
|
|
|
2021-02-12 17:07:05 -08:00
|
|
|
package {
|
|
|
|
|
// See: http://go/android-license-faq
|
2021-05-24 03:50:01 +00:00
|
|
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
2021-02-12 17:07:05 -08:00
|
|
|
}
|
|
|
|
|
|
2021-01-15 16:22:36 +09:00
|
|
|
filegroup {
|
2021-02-15 20:16:28 +09:00
|
|
|
name: "framework-connectivity-internal-sources",
|
2021-01-15 16:22:36 +09:00
|
|
|
srcs: [
|
|
|
|
|
"src/**/*.java",
|
|
|
|
|
"src/**/*.aidl",
|
|
|
|
|
],
|
|
|
|
|
path: "src",
|
2021-02-15 20:16:28 +09:00
|
|
|
visibility: [
|
|
|
|
|
"//visibility:private",
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filegroup {
|
|
|
|
|
name: "framework-connectivity-aidl-export-sources",
|
|
|
|
|
srcs: [
|
|
|
|
|
"aidl-export/**/*.aidl",
|
|
|
|
|
],
|
|
|
|
|
path: "aidl-export",
|
|
|
|
|
visibility: [
|
|
|
|
|
"//visibility:private",
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: use a java_library in the bootclasspath instead
|
|
|
|
|
filegroup {
|
|
|
|
|
name: "framework-connectivity-sources",
|
|
|
|
|
srcs: [
|
|
|
|
|
":framework-connectivity-internal-sources",
|
|
|
|
|
":framework-connectivity-aidl-export-sources",
|
|
|
|
|
],
|
2021-01-15 16:22:36 +09:00
|
|
|
visibility: [
|
|
|
|
|
"//frameworks/base",
|
|
|
|
|
"//packages/modules/Connectivity:__subpackages__",
|
|
|
|
|
],
|
2021-02-12 17:07:05 -08:00
|
|
|
}
|
2021-01-28 13:37:03 +09:00
|
|
|
|
2022-01-31 11:21:08 +09:00
|
|
|
java_defaults {
|
|
|
|
|
name: "framework-connectivity-defaults",
|
|
|
|
|
defaults: ["framework-module-defaults"],
|
2021-03-24 22:59:50 +09:00
|
|
|
sdk_version: "module_current",
|
|
|
|
|
min_sdk_version: "30",
|
2021-01-28 13:37:03 +09:00
|
|
|
srcs: [
|
|
|
|
|
":framework-connectivity-sources",
|
2021-03-24 22:59:50 +09:00
|
|
|
":net-utils-framework-common-srcs",
|
2022-01-17 11:52:57 +00:00
|
|
|
":framework-connectivity-api-shared-srcs",
|
2022-02-14 21:38:14 +08:00
|
|
|
":framework-connectivity-javastream-protos",
|
2021-01-28 13:37:03 +09:00
|
|
|
],
|
|
|
|
|
aidl: {
|
2021-12-13 15:52:07 +00:00
|
|
|
generate_get_transaction_name: true,
|
2021-01-28 13:37:03 +09:00
|
|
|
include_dirs: [
|
|
|
|
|
// Include directories for parcelables that are part of the stable API, and need a
|
|
|
|
|
// one-line "parcelable X" .aidl declaration to be used in AIDL interfaces.
|
|
|
|
|
// TODO(b/180293679): remove these dependencies as they should not be necessary once
|
|
|
|
|
// the module builds against API (the parcelable declarations exist in framework.aidl)
|
|
|
|
|
"frameworks/base/core/java", // For framework parcelables
|
|
|
|
|
"frameworks/native/aidl/binder", // For PersistableBundle.aidl
|
|
|
|
|
],
|
|
|
|
|
},
|
2022-01-31 11:21:08 +09:00
|
|
|
stub_only_libs: [
|
2022-02-08 21:25:28 +08:00
|
|
|
"framework-connectivity-t.stubs.module_lib",
|
2022-01-31 11:21:08 +09:00
|
|
|
],
|
2021-03-24 22:59:50 +09:00
|
|
|
impl_only_libs: [
|
|
|
|
|
"framework-tethering.stubs.module_lib",
|
|
|
|
|
"framework-wifi.stubs.module_lib",
|
|
|
|
|
"net-utils-device-common",
|
|
|
|
|
],
|
2021-11-15 18:17:33 +09:00
|
|
|
static_libs: [
|
2022-02-09 14:02:43 +08:00
|
|
|
"mdns_aidl_interface-lateststable-java",
|
2022-01-23 16:14:51 +00:00
|
|
|
"modules-utils-backgroundthread",
|
2021-11-15 18:17:33 +09:00
|
|
|
"modules-utils-build",
|
2022-01-31 11:21:08 +09:00
|
|
|
"modules-utils-preconditions",
|
2021-11-15 18:17:33 +09:00
|
|
|
],
|
2021-01-28 13:37:03 +09:00
|
|
|
libs: [
|
2021-08-02 18:06:35 +02:00
|
|
|
"app-compat-annotations",
|
2022-02-08 21:25:28 +08:00
|
|
|
"framework-connectivity-t.stubs.module_lib",
|
2021-01-28 13:37:03 +09:00
|
|
|
"unsupportedappusage",
|
|
|
|
|
],
|
2022-01-31 11:21:08 +09:00
|
|
|
apex_available: [
|
|
|
|
|
"com.android.tethering",
|
|
|
|
|
],
|
|
|
|
|
lint: { strict_updatability_linting: true },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
java_library {
|
|
|
|
|
name: "framework-connectivity-pre-jarjar",
|
|
|
|
|
defaults: ["framework-connectivity-defaults"],
|
|
|
|
|
libs: [
|
|
|
|
|
// This cannot be in the defaults clause above because if it were, it would be used
|
|
|
|
|
// to generate the connectivity stubs. That would create a circular dependency
|
|
|
|
|
// because the tethering stubs depend on the connectivity stubs (e.g.,
|
|
|
|
|
// TetheringRequest depends on LinkAddress).
|
|
|
|
|
"framework-tethering.stubs.module_lib",
|
Autogenerate connectivity jarjar rules
Jarjar rules are hard to keep in sync with code, and hard to maintain
manually as the distinction between what should and should not be
jarjared is not always clear. This results in unsafe binaries that are
manually maintained, and developer frustration when something fails due
to incorrect jarjar rules.
Autogenerate jarjar rules at build time instead. This is achieved by
introducing a jarjar-rules-generator python-based library, which scans
pre-jarjar intermediate artifacts, and outputs jarjar rules for every
class to put it in a package specific to the module. The only exceptions
are:
- Classes that are API (module-lib API is the largest API surface of
the module)
- Classes that have unsupportedappusage symbols
- Classes that are excluded manually (for example, because they have
hardcoded external references, like for
ConnectivityServiceInitializer in SystemServer).
This change causes all classes in framework-connectivity(-t) and
service-connectivity to be jarjared into android.net.connectivity, but
still avoids jarjaring classes in com.android.server as before, to keep
it small.
For many classes this differs from the original jarjar rule.
Notes on implementation:
- connectivity-jarjar-rules now has a subset
framework-connectivity-jarjar-rules containing only the rules
necessary for framework-connectivity. This is necessary because
framework-connectivity cannot depend on rules generated based on
service-connectivity, as there would be a dependency cycle
(service-connectivity depends on framework-connectivity); Soong even
crashes with a stack overflow.
- framework-wifi.stubs.module_lib is added to
framework-connectivity-pre-jarjar as it is necessary to build it (it
is already in impl_only_libs in the defaults).
It is unclear why framework-connectivity-pre-jarjar could build
before that (possibly because it was only used as "lib" ?)
- Fix package-private visibility; for example NattSocketKeepalive,
TcpSocketKeepalive are not API so should be jarjared, but are used
by ConnectivityManager which is not jarjared, so they are not in the
same package after the change. Package-private members in the
former 2 need to be public to be accessible. Changes in this commit
are all that is needed, as demonstrated by followup commits that move
the classes to a different package without further changes, and that
enforce that no class in an API package gets jarjared.
- framework-connectivity-internal-test-defaults is separated from
framework-connectivity-test-defaults, for unit tests that need to
access internal jarjared classes. Such tests need to use the jarjar
rules themselves too, so this is only appropriate for connectivity
internal unit tests.
Test: atest ConnectivityCoverageTests CtsNetTestCases
Bug: 217129444
Change-Id: Ied17c3955ea2fda130089265d02908937ad8af1e
2022-04-20 15:59:16 +09:00
|
|
|
"framework-wifi.stubs.module_lib",
|
2022-01-31 11:21:08 +09:00
|
|
|
],
|
|
|
|
|
visibility: ["//packages/modules/Connectivity:__subpackages__"]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
java_sdk_library {
|
|
|
|
|
name: "framework-connectivity",
|
|
|
|
|
defaults: ["framework-connectivity-defaults"],
|
|
|
|
|
installable: true,
|
Autogenerate connectivity jarjar rules
Jarjar rules are hard to keep in sync with code, and hard to maintain
manually as the distinction between what should and should not be
jarjared is not always clear. This results in unsafe binaries that are
manually maintained, and developer frustration when something fails due
to incorrect jarjar rules.
Autogenerate jarjar rules at build time instead. This is achieved by
introducing a jarjar-rules-generator python-based library, which scans
pre-jarjar intermediate artifacts, and outputs jarjar rules for every
class to put it in a package specific to the module. The only exceptions
are:
- Classes that are API (module-lib API is the largest API surface of
the module)
- Classes that have unsupportedappusage symbols
- Classes that are excluded manually (for example, because they have
hardcoded external references, like for
ConnectivityServiceInitializer in SystemServer).
This change causes all classes in framework-connectivity(-t) and
service-connectivity to be jarjared into android.net.connectivity, but
still avoids jarjaring classes in com.android.server as before, to keep
it small.
For many classes this differs from the original jarjar rule.
Notes on implementation:
- connectivity-jarjar-rules now has a subset
framework-connectivity-jarjar-rules containing only the rules
necessary for framework-connectivity. This is necessary because
framework-connectivity cannot depend on rules generated based on
service-connectivity, as there would be a dependency cycle
(service-connectivity depends on framework-connectivity); Soong even
crashes with a stack overflow.
- framework-wifi.stubs.module_lib is added to
framework-connectivity-pre-jarjar as it is necessary to build it (it
is already in impl_only_libs in the defaults).
It is unclear why framework-connectivity-pre-jarjar could build
before that (possibly because it was only used as "lib" ?)
- Fix package-private visibility; for example NattSocketKeepalive,
TcpSocketKeepalive are not API so should be jarjared, but are used
by ConnectivityManager which is not jarjared, so they are not in the
same package after the change. Package-private members in the
former 2 need to be public to be accessible. Changes in this commit
are all that is needed, as demonstrated by followup commits that move
the classes to a different package without further changes, and that
enforce that no class in an API package gets jarjared.
- framework-connectivity-internal-test-defaults is separated from
framework-connectivity-test-defaults, for unit tests that need to
access internal jarjared classes. Such tests need to use the jarjar
rules themselves too, so this is only appropriate for connectivity
internal unit tests.
Test: atest ConnectivityCoverageTests CtsNetTestCases
Bug: 217129444
Change-Id: Ied17c3955ea2fda130089265d02908937ad8af1e
2022-04-20 15:59:16 +09:00
|
|
|
jarjar_rules: ":framework-connectivity-jarjar-rules",
|
2021-03-19 10:13:40 +00:00
|
|
|
permitted_packages: ["android.net"],
|
2021-03-24 22:59:50 +09:00
|
|
|
impl_library_visibility: [
|
|
|
|
|
"//packages/modules/Connectivity/Tethering/apex",
|
|
|
|
|
// In preparation for future move
|
|
|
|
|
"//packages/modules/Connectivity/apex",
|
2022-01-31 11:21:08 +09:00
|
|
|
"//packages/modules/Connectivity/framework-t",
|
2021-03-24 22:59:50 +09:00
|
|
|
"//packages/modules/Connectivity/service",
|
2021-12-14 01:30:22 +00:00
|
|
|
"//packages/modules/Connectivity/service-t",
|
2021-03-24 22:59:50 +09:00
|
|
|
"//frameworks/base/packages/Connectivity/service",
|
|
|
|
|
"//frameworks/base",
|
2021-03-16 01:31:07 +00:00
|
|
|
|
|
|
|
|
// Tests using hidden APIs
|
2021-04-14 11:48:19 +08:00
|
|
|
"//cts/tests/netlegacy22.api",
|
2022-02-01 13:51:42 +09:00
|
|
|
"//cts/tests/tests/app.usage", // NetworkUsageStatsTest
|
2021-03-16 01:31:07 +00:00
|
|
|
"//external/sl4a:__subpackages__",
|
2021-05-11 13:37:06 +00:00
|
|
|
"//frameworks/base/packages/Connectivity/tests:__subpackages__",
|
2022-02-02 20:06:56 +09:00
|
|
|
"//frameworks/base/core/tests/bandwidthtests",
|
|
|
|
|
"//frameworks/base/core/tests/benchmarks",
|
|
|
|
|
"//frameworks/base/core/tests/utillib",
|
2022-01-26 00:43:10 +08:00
|
|
|
"//frameworks/base/tests/vcn",
|
2021-03-16 01:31:07 +00:00
|
|
|
"//frameworks/libs/net/common/testutils",
|
|
|
|
|
"//frameworks/libs/net/common/tests:__subpackages__",
|
2022-01-23 16:14:51 +00:00
|
|
|
"//frameworks/opt/net/ethernet/tests:__subpackages__",
|
2021-03-16 01:31:07 +00:00
|
|
|
"//frameworks/opt/telephony/tests/telephonytests",
|
2021-04-13 11:15:36 +08:00
|
|
|
"//packages/modules/CaptivePortalLogin/tests",
|
2021-03-16 01:31:07 +00:00
|
|
|
"//packages/modules/Connectivity/Tethering/tests:__subpackages__",
|
|
|
|
|
"//packages/modules/Connectivity/tests:__subpackages__",
|
2022-01-26 00:43:10 +08:00
|
|
|
"//packages/modules/IPsec/tests/iketests",
|
2021-03-16 01:31:07 +00:00
|
|
|
"//packages/modules/NetworkStack/tests:__subpackages__",
|
2021-03-31 16:11:37 +08:00
|
|
|
"//packages/modules/Wifi/service/tests/wifitests",
|
2021-03-24 22:59:50 +09:00
|
|
|
],
|
2021-03-19 10:13:40 +00:00
|
|
|
}
|
|
|
|
|
|
2021-08-02 18:06:35 +02:00
|
|
|
platform_compat_config {
|
|
|
|
|
name: "connectivity-platform-compat-config",
|
|
|
|
|
src: ":framework-connectivity",
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-02 06:38:46 +00:00
|
|
|
cc_library_shared {
|
|
|
|
|
name: "libframework-connectivity-jni",
|
|
|
|
|
min_sdk_version: "30",
|
2021-03-19 10:13:40 +00:00
|
|
|
cflags: [
|
|
|
|
|
"-Wall",
|
|
|
|
|
"-Werror",
|
|
|
|
|
"-Wno-unused-parameter",
|
2021-03-23 14:45:58 +00:00
|
|
|
// Don't warn about S API usage even with
|
|
|
|
|
// min_sdk 30: the library is only loaded
|
|
|
|
|
// on S+ devices
|
|
|
|
|
"-Wno-unguarded-availability",
|
2021-03-19 10:13:40 +00:00
|
|
|
"-Wthread-safety",
|
|
|
|
|
],
|
2021-04-02 06:38:46 +00:00
|
|
|
srcs: [
|
|
|
|
|
"jni/android_net_NetworkUtils.cpp",
|
|
|
|
|
"jni/onload.cpp",
|
|
|
|
|
],
|
2021-03-19 10:13:40 +00:00
|
|
|
shared_libs: [
|
2021-04-02 06:38:46 +00:00
|
|
|
"libandroid",
|
2021-03-19 10:13:40 +00:00
|
|
|
"liblog",
|
|
|
|
|
"libnativehelper",
|
|
|
|
|
],
|
|
|
|
|
header_libs: [
|
|
|
|
|
"dnsproxyd_protocol_headers",
|
|
|
|
|
],
|
2021-04-02 06:38:46 +00:00
|
|
|
stl: "none",
|
2021-03-19 10:13:40 +00:00
|
|
|
apex_available: [
|
|
|
|
|
"com.android.tethering",
|
2021-03-19 00:24:45 +00:00
|
|
|
],
|
2021-01-28 13:37:03 +09:00
|
|
|
}
|
2022-01-17 11:52:57 +00:00
|
|
|
|
2022-02-14 21:38:14 +08:00
|
|
|
filegroup {
|
2022-01-17 11:52:57 +00:00
|
|
|
name: "framework-connectivity-protos",
|
|
|
|
|
srcs: [
|
2022-02-14 21:38:14 +08:00
|
|
|
"proto/**/*.proto",
|
2022-01-17 11:52:57 +00:00
|
|
|
],
|
2022-02-14 21:38:14 +08:00
|
|
|
visibility: ["//frameworks/base"],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gensrcs {
|
|
|
|
|
name: "framework-connectivity-javastream-protos",
|
|
|
|
|
depfile: true,
|
|
|
|
|
|
|
|
|
|
tools: [
|
|
|
|
|
"aprotoc",
|
|
|
|
|
"protoc-gen-javastream",
|
|
|
|
|
"soong_zip",
|
2022-01-17 11:52:57 +00:00
|
|
|
],
|
2022-02-14 21:38:14 +08:00
|
|
|
|
|
|
|
|
cmd: "mkdir -p $(genDir)/$(in) " +
|
|
|
|
|
"&& $(location aprotoc) " +
|
|
|
|
|
" --plugin=$(location protoc-gen-javastream) " +
|
|
|
|
|
" --dependency_out=$(depfile) " +
|
|
|
|
|
" --javastream_out=$(genDir)/$(in) " +
|
|
|
|
|
" -Iexternal/protobuf/src " +
|
|
|
|
|
" -I . " +
|
|
|
|
|
" $(in) " +
|
|
|
|
|
"&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
|
|
|
|
|
|
|
|
|
|
srcs: [
|
|
|
|
|
":framework-connectivity-protos",
|
|
|
|
|
],
|
|
|
|
|
output_extension: "srcjar",
|
2022-01-17 11:52:57 +00:00
|
|
|
}
|
Autogenerate connectivity jarjar rules
Jarjar rules are hard to keep in sync with code, and hard to maintain
manually as the distinction between what should and should not be
jarjared is not always clear. This results in unsafe binaries that are
manually maintained, and developer frustration when something fails due
to incorrect jarjar rules.
Autogenerate jarjar rules at build time instead. This is achieved by
introducing a jarjar-rules-generator python-based library, which scans
pre-jarjar intermediate artifacts, and outputs jarjar rules for every
class to put it in a package specific to the module. The only exceptions
are:
- Classes that are API (module-lib API is the largest API surface of
the module)
- Classes that have unsupportedappusage symbols
- Classes that are excluded manually (for example, because they have
hardcoded external references, like for
ConnectivityServiceInitializer in SystemServer).
This change causes all classes in framework-connectivity(-t) and
service-connectivity to be jarjared into android.net.connectivity, but
still avoids jarjaring classes in com.android.server as before, to keep
it small.
For many classes this differs from the original jarjar rule.
Notes on implementation:
- connectivity-jarjar-rules now has a subset
framework-connectivity-jarjar-rules containing only the rules
necessary for framework-connectivity. This is necessary because
framework-connectivity cannot depend on rules generated based on
service-connectivity, as there would be a dependency cycle
(service-connectivity depends on framework-connectivity); Soong even
crashes with a stack overflow.
- framework-wifi.stubs.module_lib is added to
framework-connectivity-pre-jarjar as it is necessary to build it (it
is already in impl_only_libs in the defaults).
It is unclear why framework-connectivity-pre-jarjar could build
before that (possibly because it was only used as "lib" ?)
- Fix package-private visibility; for example NattSocketKeepalive,
TcpSocketKeepalive are not API so should be jarjared, but are used
by ConnectivityManager which is not jarjared, so they are not in the
same package after the change. Package-private members in the
former 2 need to be public to be accessible. Changes in this commit
are all that is needed, as demonstrated by followup commits that move
the classes to a different package without further changes, and that
enforce that no class in an API package gets jarjared.
- framework-connectivity-internal-test-defaults is separated from
framework-connectivity-test-defaults, for unit tests that need to
access internal jarjared classes. Such tests need to use the jarjar
rules themselves too, so this is only appropriate for connectivity
internal unit tests.
Test: atest ConnectivityCoverageTests CtsNetTestCases
Bug: 217129444
Change-Id: Ied17c3955ea2fda130089265d02908937ad8af1e
2022-04-20 15:59:16 +09:00
|
|
|
|
|
|
|
|
java_genrule {
|
|
|
|
|
name: "framework-connectivity-jarjar-rules",
|
|
|
|
|
tool_files: [
|
|
|
|
|
":connectivity-hiddenapi-files",
|
|
|
|
|
":framework-connectivity-pre-jarjar",
|
|
|
|
|
":framework-connectivity-t-pre-jarjar",
|
|
|
|
|
":framework-connectivity.stubs.module_lib",
|
|
|
|
|
":framework-connectivity-t.stubs.module_lib",
|
|
|
|
|
"jarjar-excludes.txt",
|
|
|
|
|
],
|
|
|
|
|
tools: [
|
|
|
|
|
"jarjar-rules-generator",
|
|
|
|
|
"dexdump",
|
|
|
|
|
],
|
|
|
|
|
out: ["framework_connectivity_jarjar_rules.txt"],
|
|
|
|
|
cmd: "$(location jarjar-rules-generator) " +
|
|
|
|
|
"--jars $(location :framework-connectivity-pre-jarjar) " +
|
|
|
|
|
"$(location :framework-connectivity-t-pre-jarjar) " +
|
|
|
|
|
"--prefix android.net.connectivity " +
|
|
|
|
|
"--apistubs $(location :framework-connectivity.stubs.module_lib) " +
|
|
|
|
|
"$(location :framework-connectivity-t.stubs.module_lib) " +
|
|
|
|
|
"--unsupportedapi $(locations :connectivity-hiddenapi-files) " +
|
|
|
|
|
"--excludes $(location jarjar-excludes.txt) " +
|
|
|
|
|
"--dexdump $(location dexdump) " +
|
|
|
|
|
"--output $(out)",
|
|
|
|
|
visibility: [
|
|
|
|
|
"//packages/modules/Connectivity/framework:__subpackages__",
|
|
|
|
|
"//packages/modules/Connectivity/framework-t:__subpackages__",
|
|
|
|
|
"//packages/modules/Connectivity/service",
|
|
|
|
|
],
|
|
|
|
|
}
|