2019-08-27 02:19:38 +00: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 22:45:04 +00:00
|
|
|
package {
|
|
|
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
|
|
|
}
|
|
|
|
|
2019-08-27 02:19:38 +00: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 02:19:38 +00:00
|
|
|
srcs: [
|
2020-12-26 09:13:22 +00:00
|
|
|
"apishim/**/*.java",
|
2019-08-27 02:19:38 +00:00
|
|
|
"src/**/*.java",
|
2021-01-22 10:35:00 +00:00
|
|
|
":framework-connectivity-shared-srcs",
|
2020-01-07 06:43:17 +00:00
|
|
|
":tethering-module-utils-srcs",
|
2019-09-03 07:58:06 +00:00
|
|
|
":services-tethering-shared-srcs",
|
2019-08-27 02:19:38 +00:00
|
|
|
],
|
|
|
|
static_libs: [
|
2021-05-06 07:42:17 +00:00
|
|
|
"NetworkStackApiStableShims",
|
2019-08-27 02:19:38 +00:00
|
|
|
"androidx.annotation_annotation",
|
2020-12-26 09:13:22 +00:00
|
|
|
"modules-utils-build",
|
2019-08-09 06:52:06 +00:00
|
|
|
"netlink-client",
|
2021-01-26 13:35:02 +00:00
|
|
|
"networkstack-client",
|
2020-02-05 04:42:25 +00:00
|
|
|
"android.hardware.tetheroffload.config-V1.0-java",
|
2019-09-25 06:33:39 +00:00
|
|
|
"android.hardware.tetheroffload.control-V1.0-java",
|
2021-03-10 07:26:50 +00:00
|
|
|
"android.hardware.tetheroffload.control-V1.1-java",
|
2020-01-14 09:28:47 +00:00
|
|
|
"net-utils-framework-common",
|
2020-06-25 15:19:33 +00:00
|
|
|
"net-utils-device-common",
|
2020-12-28 08:44:49 +00:00
|
|
|
"netd-client",
|
2019-08-27 02:19:38 +00:00
|
|
|
],
|
2019-12-16 12:15:20 +00:00
|
|
|
libs: [
|
2021-01-15 11:26:28 +00:00
|
|
|
"framework-connectivity",
|
2020-06-19 11:48:56 +00:00
|
|
|
"framework-statsd.stubs.module_lib",
|
2020-05-13 11:28:49 +00:00
|
|
|
"framework-tethering.impl",
|
2020-05-31 10:35:50 +00:00
|
|
|
"framework-wifi",
|
2019-12-10 17:47:53 +00:00
|
|
|
"unsupportedappusage",
|
2019-12-16 12:15:20 +00:00
|
|
|
],
|
2020-01-16 03:21:53 +00:00
|
|
|
plugins: ["java_api_finder"],
|
2019-08-27 02:19:38 +00: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 08:27:52 +00: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 14:02:28 +00:00
|
|
|
name: "libtetherutilsjni",
|
2020-02-05 04:42:25 +00:00
|
|
|
sdk_version: "current",
|
2020-04-28 17:43:30 +00: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 14:56:09 +00:00
|
|
|
header_libs: [
|
|
|
|
"bpf_syscall_wrappers",
|
|
|
|
"bpf_tethering_headers",
|
|
|
|
],
|
2019-09-25 06:33:39 +00:00
|
|
|
srcs: [
|
2020-11-11 16:17:15 +00:00
|
|
|
"jni/*.cpp",
|
2019-09-25 06:33:39 +00:00
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"liblog",
|
2020-02-05 04:42:25 +00:00
|
|
|
"libnativehelper_compat_libc++",
|
2019-09-25 06:33:39 +00:00
|
|
|
],
|
2020-12-08 09:57:42 +00:00
|
|
|
static_libs: [
|
|
|
|
"libnetjniutils",
|
|
|
|
],
|
2019-09-25 06:33:39 +00:00
|
|
|
|
2020-02-05 04:42:25 +00: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 06:33:39 +00:00
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Wthread-safety",
|
|
|
|
],
|
2019-10-23 08:27:52 +00:00
|
|
|
|
|
|
|
ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
|
2019-09-25 06:33:39 +00:00
|
|
|
}
|
|
|
|
|
2019-08-27 02:19:38 +00: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 02:19:38 +00:00
|
|
|
privileged: true,
|
2019-09-25 06:33:39 +00:00
|
|
|
jni_libs: [
|
2019-12-07 14:02:28 +00:00
|
|
|
"libtetherutilsjni",
|
2019-09-25 06:33:39 +00:00
|
|
|
],
|
2019-08-27 02:19:38 +00:00
|
|
|
resource_dirs: [
|
|
|
|
"res",
|
|
|
|
],
|
2019-12-16 12:15:20 +00:00
|
|
|
libs: [
|
|
|
|
"framework-tethering",
|
2020-10-02 15:38:21 +00:00
|
|
|
"framework-wifi",
|
2019-12-16 12:15:20 +00:00
|
|
|
],
|
|
|
|
jarjar_rules: "jarjar-rules.txt",
|
2019-08-27 02:19:38 +00: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 06:40:57 +00: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 09:42:44 +00:00
|
|
|
apex_available: ["com.android.tethering"],
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
2019-09-30 06:40:57 +00:00
|
|
|
}
|
2019-08-27 02:19:38 +00: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
|
2021-04-27 12:24:24 +00:00
|
|
|
required: [
|
|
|
|
"NetworkPermissionConfig",
|
|
|
|
"privapp_whitelist_com.android.networkstack.tethering",
|
|
|
|
],
|
2020-01-06 04:30:59 +00:00
|
|
|
apex_available: ["com.android.tethering"],
|
2020-10-31 22:41:41 +00:00
|
|
|
min_sdk_version: "30",
|
2019-08-27 02:19:38 +00:00
|
|
|
}
|
2021-02-14 06:38:22 +00:00
|
|
|
|
|
|
|
sdk {
|
|
|
|
name: "tethering-module-sdk",
|
2021-06-07 14:46:33 +00:00
|
|
|
bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"],
|
2021-02-14 06:38:22 +00:00
|
|
|
}
|