2019-08-27 10:19:38 +08:00
|
|
|
//
|
|
|
|
|
// Copyright (C) 2019 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 14:45:04 -08:00
|
|
|
package {
|
|
|
|
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-27 10:19:38 +08:00
|
|
|
java_defaults {
|
2021-10-27 13:22:27 +08:00
|
|
|
name: "TetheringApiLevel",
|
2020-03-18 14:15:42 +00:00
|
|
|
sdk_version: "module_current",
|
2022-05-19 01:01:26 +08:00
|
|
|
target_sdk_version: "33",
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
2021-10-27 13:22:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
java_defaults {
|
|
|
|
|
name: "TetheringAndroidLibraryDefaults",
|
2019-08-27 10:19:38 +08:00
|
|
|
srcs: [
|
2020-12-26 17:13:22 +08:00
|
|
|
"apishim/**/*.java",
|
2019-08-27 10:19:38 +08:00
|
|
|
"src/**/*.java",
|
2021-01-22 18:35:00 +08:00
|
|
|
":framework-connectivity-shared-srcs",
|
2020-01-07 14:43:17 +08:00
|
|
|
":tethering-module-utils-srcs",
|
2019-09-03 15:58:06 +08:00
|
|
|
":services-tethering-shared-srcs",
|
2022-03-10 16:19:24 +08:00
|
|
|
":statslog-tethering-java-gen",
|
2019-08-27 10:19:38 +08:00
|
|
|
],
|
|
|
|
|
static_libs: [
|
|
|
|
|
"androidx.annotation_annotation",
|
2020-12-26 17:13:22 +08:00
|
|
|
"modules-utils-build",
|
2021-08-19 12:26:52 +02:00
|
|
|
"modules-utils-statemachine",
|
2021-01-26 22:35:02 +09:00
|
|
|
"networkstack-client",
|
2020-02-05 12:42:25 +08:00
|
|
|
"android.hardware.tetheroffload.config-V1.0-java",
|
2019-09-25 14:33:39 +08:00
|
|
|
"android.hardware.tetheroffload.control-V1.0-java",
|
2021-03-10 15:26:50 +08:00
|
|
|
"android.hardware.tetheroffload.control-V1.1-java",
|
2020-01-14 17:28:47 +08:00
|
|
|
"net-utils-framework-common",
|
2020-06-26 00:19:33 +09:00
|
|
|
"net-utils-device-common",
|
2021-11-10 01:11:33 +08:00
|
|
|
"net-utils-device-common-bpf",
|
2021-07-01 14:00:34 +00:00
|
|
|
"net-utils-device-common-netlink",
|
2020-12-28 16:44:49 +08:00
|
|
|
"netd-client",
|
2022-03-03 10:15:09 +08:00
|
|
|
"tetheringstatsprotos",
|
2019-08-27 10:19:38 +08:00
|
|
|
],
|
2019-12-16 20:15:20 +08:00
|
|
|
libs: [
|
2021-01-15 20:26:28 +09:00
|
|
|
"framework-connectivity",
|
2022-02-08 21:25:28 +08:00
|
|
|
"framework-connectivity-t.stubs.module_lib",
|
2020-06-19 19:48:56 +08:00
|
|
|
"framework-statsd.stubs.module_lib",
|
2020-05-13 12:28:49 +01:00
|
|
|
"framework-tethering.impl",
|
2020-05-31 11:35:50 +01:00
|
|
|
"framework-wifi",
|
2022-01-11 20:39:21 -08:00
|
|
|
"framework-bluetooth",
|
2019-12-10 17:47:53 +00:00
|
|
|
"unsupportedappusage",
|
2019-12-16 20:15:20 +08:00
|
|
|
],
|
2020-01-16 11:21:53 +08:00
|
|
|
plugins: ["java_api_finder"],
|
2019-08-27 10:19:38 +08:00
|
|
|
manifest: "AndroidManifestBase.xml",
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2019-08-27 10:19:38 +08:00
|
|
|
}
|
|
|
|
|
|
2021-10-27 13:22:27 +08:00
|
|
|
// build tethering static library, used to compile both variants of the tethering.
|
2019-08-27 10:19:38 +08:00
|
|
|
android_library {
|
|
|
|
|
name: "TetheringApiCurrentLib",
|
2021-10-27 13:22:27 +08:00
|
|
|
defaults: [
|
2022-01-26 17:43:53 +09:00
|
|
|
"ConnectivityNextEnableDefaults",
|
2021-10-27 13:22:27 +08:00
|
|
|
"TetheringAndroidLibraryDefaults",
|
|
|
|
|
"TetheringApiLevel"
|
|
|
|
|
],
|
|
|
|
|
static_libs: [
|
|
|
|
|
"NetworkStackApiCurrentShims",
|
|
|
|
|
],
|
|
|
|
|
apex_available: ["com.android.tethering"],
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2021-10-27 13:22:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android_library {
|
|
|
|
|
name: "TetheringApiStableLib",
|
|
|
|
|
defaults: [
|
|
|
|
|
"TetheringAndroidLibraryDefaults",
|
|
|
|
|
"TetheringApiLevel"
|
|
|
|
|
],
|
|
|
|
|
static_libs: [
|
|
|
|
|
"NetworkStackApiStableShims",
|
|
|
|
|
],
|
|
|
|
|
apex_available: ["com.android.tethering"],
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2019-08-27 10:19:38 +08:00
|
|
|
}
|
|
|
|
|
|
2019-10-23 16:27:52 +08:00
|
|
|
// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
|
|
|
|
|
cc_library {
|
2021-11-09 16:56:23 +08:00
|
|
|
name: "libcom_android_networkstack_tethering_util_jni",
|
2021-10-27 13:22:27 +08:00
|
|
|
sdk_version: "30",
|
2020-04-29 02:43:30 +09:00
|
|
|
apex_available: [
|
|
|
|
|
"//apex_available:platform", // Used by InProcessTethering
|
|
|
|
|
"com.android.tethering",
|
|
|
|
|
],
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
2021-02-05 23:56:09 +09:00
|
|
|
header_libs: [
|
2021-10-22 00:49:13 +08:00
|
|
|
"bpf_connectivity_headers",
|
2021-02-05 23:56:09 +09:00
|
|
|
],
|
2019-09-25 14:33:39 +08:00
|
|
|
srcs: [
|
2020-11-12 00:17:15 +08:00
|
|
|
"jni/*.cpp",
|
2019-09-25 14:33:39 +08:00
|
|
|
],
|
|
|
|
|
shared_libs: [
|
|
|
|
|
"liblog",
|
2020-02-05 12:42:25 +08:00
|
|
|
"libnativehelper_compat_libc++",
|
2019-09-25 14:33:39 +08:00
|
|
|
],
|
2020-12-08 09:57:42 +00:00
|
|
|
static_libs: [
|
2021-11-10 01:11:33 +08:00
|
|
|
"libnet_utils_device_common_bpfjni",
|
2020-12-08 09:57:42 +00:00
|
|
|
"libnetjniutils",
|
|
|
|
|
],
|
2019-09-25 14:33:39 +08:00
|
|
|
|
2020-02-05 12:42:25 +08:00
|
|
|
// We cannot use plain "libc++" here to link libc++ dynamically because it results in:
|
|
|
|
|
// java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
|
|
|
|
|
// even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
|
|
|
|
|
// build because soong complains of:
|
|
|
|
|
// module Tethering missing dependencies: libc++_shared
|
|
|
|
|
//
|
|
|
|
|
// So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
|
|
|
|
|
// we depend on do not dynamically link libc++. This is currently the case, because liblog is
|
|
|
|
|
// C-only and libnativehelper_compat_libc also uses stl: "c++_static".
|
|
|
|
|
stl: "c++_static",
|
|
|
|
|
|
2019-09-25 14:33:39 +08:00
|
|
|
cflags: [
|
|
|
|
|
"-Wall",
|
|
|
|
|
"-Werror",
|
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
|
"-Wthread-safety",
|
|
|
|
|
],
|
2019-10-23 16:27:52 +08:00
|
|
|
|
|
|
|
|
ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
|
2019-09-25 14:33:39 +08:00
|
|
|
}
|
|
|
|
|
|
2019-08-27 10:19:38 +08:00
|
|
|
// Common defaults for compiling the actual APK.
|
|
|
|
|
java_defaults {
|
|
|
|
|
name: "TetheringAppDefaults",
|
|
|
|
|
privileged: true,
|
2019-09-25 14:33:39 +08:00
|
|
|
jni_libs: [
|
2021-11-09 16:56:23 +08:00
|
|
|
"libcom_android_networkstack_tethering_util_jni",
|
2019-09-25 14:33:39 +08:00
|
|
|
],
|
2019-08-27 10:19:38 +08:00
|
|
|
resource_dirs: [
|
|
|
|
|
"res",
|
|
|
|
|
],
|
2019-12-16 20:15:20 +08:00
|
|
|
libs: [
|
|
|
|
|
"framework-tethering",
|
2020-10-02 16:38:21 +01:00
|
|
|
"framework-wifi",
|
2019-12-16 20:15:20 +08:00
|
|
|
],
|
|
|
|
|
jarjar_rules: "jarjar-rules.txt",
|
2019-08-27 10:19:38 +08:00
|
|
|
optimize: {
|
|
|
|
|
proguard_flags_files: ["proguard.flags"],
|
|
|
|
|
},
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2019-08-27 10:19:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Non-updatable tethering running in the system server process for devices not using the module
|
2019-09-30 14:40:57 +08:00
|
|
|
android_app {
|
|
|
|
|
name: "InProcessTethering",
|
2022-01-26 17:43:53 +09:00
|
|
|
defaults: ["TetheringAppDefaults", "TetheringApiLevel", "ConnectivityNextEnableDefaults"],
|
2019-09-30 14:40:57 +08:00
|
|
|
static_libs: ["TetheringApiCurrentLib"],
|
|
|
|
|
certificate: "platform",
|
|
|
|
|
manifest: "AndroidManifest_InProcess.xml",
|
|
|
|
|
// InProcessTethering is a replacement for Tethering
|
|
|
|
|
overrides: ["Tethering"],
|
2020-05-05 17:42:44 +08:00
|
|
|
apex_available: ["com.android.tethering"],
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2019-09-30 14:40:57 +08:00
|
|
|
}
|
2019-08-27 10:19:38 +08:00
|
|
|
|
2021-10-27 13:22:27 +08:00
|
|
|
// Updatable tethering packaged for finalized API
|
2019-08-27 10:19:38 +08:00
|
|
|
android_app {
|
|
|
|
|
name: "Tethering",
|
2021-10-27 13:22:27 +08:00
|
|
|
defaults: ["TetheringAppDefaults", "TetheringApiLevel"],
|
|
|
|
|
static_libs: ["TetheringApiStableLib"],
|
|
|
|
|
certificate: "networkstack",
|
|
|
|
|
manifest: "AndroidManifest.xml",
|
|
|
|
|
use_embedded_native_libs: true,
|
2022-04-20 08:30:24 +00:00
|
|
|
// The network stack *must* be included to ensure security of the device
|
2021-10-27 13:22:27 +08:00
|
|
|
required: [
|
2022-04-20 08:30:24 +00:00
|
|
|
"NetworkStack",
|
2021-12-03 15:11:27 +00:00
|
|
|
"privapp_allowlist_com.android.tethering",
|
2021-10-27 13:22:27 +08:00
|
|
|
],
|
|
|
|
|
apex_available: ["com.android.tethering"],
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2021-10-27 13:22:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android_app {
|
|
|
|
|
name: "TetheringNext",
|
2021-11-22 10:36:32 +08:00
|
|
|
defaults: [
|
|
|
|
|
"TetheringAppDefaults",
|
|
|
|
|
"TetheringApiLevel",
|
|
|
|
|
"ConnectivityNextEnableDefaults",
|
|
|
|
|
],
|
2019-08-27 10:19:38 +08:00
|
|
|
static_libs: ["TetheringApiCurrentLib"],
|
|
|
|
|
certificate: "networkstack",
|
|
|
|
|
manifest: "AndroidManifest.xml",
|
|
|
|
|
use_embedded_native_libs: true,
|
2022-04-20 08:30:24 +00:00
|
|
|
// The network stack *must* be included to ensure security of the device
|
2021-04-27 20:24:24 +08:00
|
|
|
required: [
|
2022-04-20 08:30:24 +00:00
|
|
|
"NetworkStackNext",
|
2021-12-03 15:11:27 +00:00
|
|
|
"privapp_allowlist_com.android.tethering",
|
2021-04-27 20:24:24 +08:00
|
|
|
],
|
2020-01-06 13:30:59 +09:00
|
|
|
apex_available: ["com.android.tethering"],
|
2021-11-25 14:17:57 +08:00
|
|
|
lint: { strict_updatability_linting: true },
|
2019-08-27 10:19:38 +08:00
|
|
|
}
|
2021-02-14 06:38:22 +00:00
|
|
|
|
|
|
|
|
sdk {
|
|
|
|
|
name: "tethering-module-sdk",
|
2021-06-07 15:46:33 +01:00
|
|
|
bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"],
|
2021-12-20 16:54:13 +00:00
|
|
|
systemserverclasspath_fragments: ["com.android.tethering-systemserverclasspath-fragment"],
|
2021-02-14 06:38:22 +00:00
|
|
|
}
|
2022-03-03 10:15:09 +08:00
|
|
|
|
|
|
|
|
java_library_static {
|
|
|
|
|
name: "tetheringstatsprotos",
|
|
|
|
|
proto: {type: "lite"},
|
|
|
|
|
srcs: [
|
|
|
|
|
"src/com/android/networkstack/tethering/metrics/stats.proto",
|
|
|
|
|
],
|
|
|
|
|
static_libs: ["tetheringprotos"],
|
|
|
|
|
apex_available: ["com.android.tethering"],
|
|
|
|
|
min_sdk_version: "30",
|
|
|
|
|
}
|
2022-03-10 16:19:24 +08:00
|
|
|
|
|
|
|
|
genrule {
|
|
|
|
|
name: "statslog-tethering-java-gen",
|
|
|
|
|
tools: ["stats-log-api-gen"],
|
|
|
|
|
cmd: "$(location stats-log-api-gen) --java $(out) --module network_tethering" +
|
|
|
|
|
" --javaPackage com.android.networkstack.tethering.metrics --javaClass TetheringStatsLog",
|
|
|
|
|
out: ["com/android/networkstack/tethering/metrics/TetheringStatsLog.java"],
|
|
|
|
|
}
|