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 {
|
|
|
|
|
name: "TetheringAndroidLibraryDefaults",
|
2020-03-18 14:15:42 +00:00
|
|
|
sdk_version: "module_current",
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
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",
|
2019-09-03 15:58:06 +08:00
|
|
|
":framework-tethering-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",
|
2019-08-27 10:19:38 +08:00
|
|
|
],
|
|
|
|
|
static_libs: [
|
|
|
|
|
"androidx.annotation_annotation",
|
2020-12-26 17:13:22 +08:00
|
|
|
"modules-utils-build",
|
2019-08-09 15:52:06 +09:00
|
|
|
"netlink-client",
|
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",
|
2020-01-14 17:28:47 +08:00
|
|
|
"net-utils-framework-common",
|
2020-06-26 00:19:33 +09:00
|
|
|
"net-utils-device-common",
|
2020-12-28 16:44:49 +08:00
|
|
|
"netd-client",
|
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",
|
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",
|
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",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Build tethering static library, used to compile both variants of the tethering.
|
|
|
|
|
android_library {
|
|
|
|
|
name: "TetheringApiCurrentLib",
|
|
|
|
|
defaults: ["TetheringAndroidLibraryDefaults"],
|
|
|
|
|
}
|
|
|
|
|
|
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 {
|
2019-12-07 22:02:28 +08:00
|
|
|
name: "libtetherutilsjni",
|
2020-02-05 12:42:25 +08:00
|
|
|
sdk_version: "current",
|
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: [
|
|
|
|
|
"bpf_syscall_wrappers",
|
|
|
|
|
"bpf_tethering_headers",
|
|
|
|
|
],
|
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: [
|
|
|
|
|
"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",
|
2020-03-18 14:15:42 +00:00
|
|
|
sdk_version: "module_current",
|
2019-08-27 10:19:38 +08:00
|
|
|
privileged: true,
|
2019-09-25 14:33:39 +08:00
|
|
|
jni_libs: [
|
2019-12-07 22:02:28 +08:00
|
|
|
"libtetherutilsjni",
|
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"],
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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",
|
|
|
|
|
defaults: ["TetheringAppDefaults"],
|
|
|
|
|
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"],
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
2019-09-30 14:40:57 +08:00
|
|
|
}
|
2019-08-27 10:19:38 +08:00
|
|
|
|
|
|
|
|
// Updatable tethering packaged as an application
|
|
|
|
|
android_app {
|
|
|
|
|
name: "Tethering",
|
|
|
|
|
defaults: ["TetheringAppDefaults"],
|
|
|
|
|
static_libs: ["TetheringApiCurrentLib"],
|
|
|
|
|
certificate: "networkstack",
|
|
|
|
|
manifest: "AndroidManifest.xml",
|
|
|
|
|
use_embedded_native_libs: true,
|
|
|
|
|
// The permission configuration *must* be included to ensure security of the device
|
|
|
|
|
required: ["NetworkPermissionConfig"],
|
2020-01-06 13:30:59 +09:00
|
|
|
apex_available: ["com.android.tethering"],
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
2019-08-27 10:19:38 +08:00
|
|
|
}
|
2021-02-14 06:38:22 +00:00
|
|
|
|
|
|
|
|
sdk {
|
|
|
|
|
name: "tethering-module-sdk",
|
|
|
|
|
java_sdk_libs: [
|
|
|
|
|
"framework-tethering",
|
|
|
|
|
],
|
|
|
|
|
}
|