blob: a7ae21acbddf3baed1f68365573a8acb5723f9d0 [file] [log] [blame]
markchien932da862019-08-27 10:19:38 +08001//
2// Copyright (C) 2019 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Bob Badour97e6be22021-02-12 14:45:04 -080017package {
18 default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
markchien932da862019-08-27 10:19:38 +080021java_defaults {
22 name: "TetheringAndroidLibraryDefaults",
Anton Hanssonbbe4af12020-03-18 14:15:42 +000023 sdk_version: "module_current",
Nikita Ioffe583e35a2020-10-31 22:41:41 +000024 min_sdk_version: "30",
markchien932da862019-08-27 10:19:38 +080025 srcs: [
Hungming Chendd55b912020-12-26 17:13:22 +080026 "apishim/**/*.java",
markchien932da862019-08-27 10:19:38 +080027 "src/**/*.java",
Aaron Huangb401e582021-01-22 18:35:00 +080028 ":framework-connectivity-shared-srcs",
markchien12c5bb82020-01-07 14:43:17 +080029 ":tethering-module-utils-srcs",
markchien43e97e02019-09-03 15:58:06 +080030 ":services-tethering-shared-srcs",
markchien932da862019-08-27 10:19:38 +080031 ],
32 static_libs: [
junyulaib95083e2021-05-06 15:42:17 +080033 "NetworkStackApiStableShims",
markchien932da862019-08-27 10:19:38 +080034 "androidx.annotation_annotation",
Hungming Chendd55b912020-12-26 17:13:22 +080035 "modules-utils-build",
William Escandeea9e22e2021-08-19 12:26:52 +020036 "modules-utils-statemachine",
Jeongik Chad05f9902021-01-26 22:35:02 +090037 "networkstack-client",
markchien547e1682020-02-05 12:42:25 +080038 "android.hardware.tetheroffload.config-V1.0-java",
markchien6aa38892019-09-25 14:33:39 +080039 "android.hardware.tetheroffload.control-V1.0-java",
junyulai177dc862021-03-10 15:26:50 +080040 "android.hardware.tetheroffload.control-V1.1-java",
markchien75fc6ab2020-01-14 17:28:47 +080041 "net-utils-framework-common",
Chalard Jeanbdcca922020-06-26 00:19:33 +090042 "net-utils-device-common",
Xiao Ma09c07272021-07-01 14:00:34 +000043 "net-utils-device-common-netlink",
lucaslinee661df2020-12-28 16:44:49 +080044 "netd-client",
markchien932da862019-08-27 10:19:38 +080045 ],
markchien9d353822019-12-16 20:15:20 +080046 libs: [
Remi NGUYEN VAN74b27442021-01-15 20:26:28 +090047 "framework-connectivity",
waynemab7048af2020-06-19 19:48:56 +080048 "framework-statsd.stubs.module_lib",
Paul Duffin2dae2722020-05-13 12:28:49 +010049 "framework-tethering.impl",
Paul Duffin6812c1b2020-05-31 11:35:50 +010050 "framework-wifi",
Artur Satayev4784fb02019-12-10 17:47:53 +000051 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080052 ],
markchien84a92822020-01-16 11:21:53 +080053 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080054 manifest: "AndroidManifestBase.xml",
55}
56
57// Build tethering static library, used to compile both variants of the tethering.
58android_library {
59 name: "TetheringApiCurrentLib",
60 defaults: ["TetheringAndroidLibraryDefaults"],
61}
62
markchien810aa682019-10-23 16:27:52 +080063// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
64cc_library {
markchienf87ebdc2019-12-07 22:02:28 +080065 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080066 sdk_version: "current",
Jooyung Han8182d8b2020-04-29 02:43:30 +090067 apex_available: [
68 "//apex_available:platform", // Used by InProcessTethering
69 "com.android.tethering",
70 ],
Nikita Ioffe583e35a2020-10-31 22:41:41 +000071 min_sdk_version: "30",
Lorenzo Colitti734b14e2021-02-05 23:56:09 +090072 header_libs: [
73 "bpf_syscall_wrappers",
74 "bpf_tethering_headers",
75 ],
markchien6aa38892019-09-25 14:33:39 +080076 srcs: [
markchien70526882020-11-12 00:17:15 +080077 "jni/*.cpp",
markchien6aa38892019-09-25 14:33:39 +080078 ],
79 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080080 "liblog",
markchien547e1682020-02-05 12:42:25 +080081 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080082 ],
Orion Hodsone5bd0db2020-12-08 09:57:42 +000083 static_libs: [
Tyler Weare8043ca72021-10-19 10:59:01 -070084 "libbpfmapjni",
Orion Hodsone5bd0db2020-12-08 09:57:42 +000085 "libnetjniutils",
86 ],
markchien6aa38892019-09-25 14:33:39 +080087
markchien547e1682020-02-05 12:42:25 +080088 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
89 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
90 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
91 // build because soong complains of:
92 // module Tethering missing dependencies: libc++_shared
93 //
94 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
95 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
96 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
97 stl: "c++_static",
98
markchien6aa38892019-09-25 14:33:39 +080099 cflags: [
100 "-Wall",
101 "-Werror",
102 "-Wno-unused-parameter",
103 "-Wthread-safety",
104 ],
markchien810aa682019-10-23 16:27:52 +0800105
106 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +0800107}
108
markchien932da862019-08-27 10:19:38 +0800109// Common defaults for compiling the actual APK.
110java_defaults {
111 name: "TetheringAppDefaults",
Anton Hanssonbbe4af12020-03-18 14:15:42 +0000112 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +0800113 privileged: true,
markchien6aa38892019-09-25 14:33:39 +0800114 jni_libs: [
markchienf87ebdc2019-12-07 22:02:28 +0800115 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +0800116 ],
markchien932da862019-08-27 10:19:38 +0800117 resource_dirs: [
118 "res",
119 ],
markchien9d353822019-12-16 20:15:20 +0800120 libs: [
121 "framework-tethering",
Anton Hanssonb8a342e2020-10-02 16:38:21 +0100122 "framework-wifi",
markchien9d353822019-12-16 20:15:20 +0800123 ],
124 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800125 optimize: {
126 proguard_flags_files: ["proguard.flags"],
127 },
128}
129
130// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800131android_app {
132 name: "InProcessTethering",
133 defaults: ["TetheringAppDefaults"],
134 static_libs: ["TetheringApiCurrentLib"],
135 certificate: "platform",
136 manifest: "AndroidManifest_InProcess.xml",
137 // InProcessTethering is a replacement for Tethering
138 overrides: ["Tethering"],
markchiendbaff662020-05-05 17:42:44 +0800139 apex_available: ["com.android.tethering"],
Nikita Ioffe583e35a2020-10-31 22:41:41 +0000140 min_sdk_version: "30",
markchienee6ad372019-09-30 14:40:57 +0800141}
markchien932da862019-08-27 10:19:38 +0800142
143// Updatable tethering packaged as an application
144android_app {
145 name: "Tethering",
146 defaults: ["TetheringAppDefaults"],
147 static_libs: ["TetheringApiCurrentLib"],
148 certificate: "networkstack",
149 manifest: "AndroidManifest.xml",
150 use_embedded_native_libs: true,
151 // The permission configuration *must* be included to ensure security of the device
Aaron Huang3f69f1c2021-04-27 20:24:24 +0800152 required: [
153 "NetworkPermissionConfig",
154 "privapp_whitelist_com.android.networkstack.tethering",
155 ],
Jiyong Park1eb89332020-01-06 13:30:59 +0900156 apex_available: ["com.android.tethering"],
Nikita Ioffe583e35a2020-10-31 22:41:41 +0000157 min_sdk_version: "30",
markchien932da862019-08-27 10:19:38 +0800158}
Hai Zhang6d71f102021-02-14 06:38:22 +0000159
160sdk {
161 name: "tethering-module-sdk",
Anton Hanssona12ffac2021-06-07 15:46:33 +0100162 bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"],
Hai Zhang6d71f102021-02-14 06:38:22 +0000163}