blob: 3c49383e806bdc4d4f8f4d1ab27d6194071db227 [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 {
markchien5a8c8062021-10-27 13:22:27 +080022 name: "TetheringApiLevel",
Anton Hanssonbbe4af12020-03-18 14:15:42 +000023 sdk_version: "module_current",
Nikita Ioffe583e35a2020-10-31 22:41:41 +000024 min_sdk_version: "30",
markchien5a8c8062021-10-27 13:22:27 +080025}
26
27java_defaults {
28 name: "TetheringAndroidLibraryDefaults",
markchien932da862019-08-27 10:19:38 +080029 srcs: [
Hungming Chendd55b912020-12-26 17:13:22 +080030 "apishim/**/*.java",
markchien932da862019-08-27 10:19:38 +080031 "src/**/*.java",
Aaron Huangb401e582021-01-22 18:35:00 +080032 ":framework-connectivity-shared-srcs",
markchien12c5bb82020-01-07 14:43:17 +080033 ":tethering-module-utils-srcs",
markchien43e97e02019-09-03 15:58:06 +080034 ":services-tethering-shared-srcs",
markchien932da862019-08-27 10:19:38 +080035 ],
36 static_libs: [
37 "androidx.annotation_annotation",
Hungming Chendd55b912020-12-26 17:13:22 +080038 "modules-utils-build",
William Escandeea9e22e2021-08-19 12:26:52 +020039 "modules-utils-statemachine",
Jeongik Chad05f9902021-01-26 22:35:02 +090040 "networkstack-client",
markchien547e1682020-02-05 12:42:25 +080041 "android.hardware.tetheroffload.config-V1.0-java",
markchien6aa38892019-09-25 14:33:39 +080042 "android.hardware.tetheroffload.control-V1.0-java",
junyulai177dc862021-03-10 15:26:50 +080043 "android.hardware.tetheroffload.control-V1.1-java",
markchien75fc6ab2020-01-14 17:28:47 +080044 "net-utils-framework-common",
Chalard Jeanbdcca922020-06-26 00:19:33 +090045 "net-utils-device-common",
markchien782a5682021-11-10 01:11:33 +080046 "net-utils-device-common-bpf",
Xiao Ma09c07272021-07-01 14:00:34 +000047 "net-utils-device-common-netlink",
lucaslinee661df2020-12-28 16:44:49 +080048 "netd-client",
markchien932da862019-08-27 10:19:38 +080049 ],
markchien9d353822019-12-16 20:15:20 +080050 libs: [
Remi NGUYEN VAN74b27442021-01-15 20:26:28 +090051 "framework-connectivity",
waynemab7048af2020-06-19 19:48:56 +080052 "framework-statsd.stubs.module_lib",
Paul Duffin2dae2722020-05-13 12:28:49 +010053 "framework-tethering.impl",
Paul Duffin6812c1b2020-05-31 11:35:50 +010054 "framework-wifi",
Artur Satayev4784fb02019-12-10 17:47:53 +000055 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080056 ],
markchien84a92822020-01-16 11:21:53 +080057 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080058 manifest: "AndroidManifestBase.xml",
59}
60
markchien5a8c8062021-10-27 13:22:27 +080061// build tethering static library, used to compile both variants of the tethering.
markchien932da862019-08-27 10:19:38 +080062android_library {
63 name: "TetheringApiCurrentLib",
markchien5a8c8062021-10-27 13:22:27 +080064 defaults: [
65 "TetheringAndroidLibraryDefaults",
66 "TetheringApiLevel"
67 ],
68 static_libs: [
69 "NetworkStackApiCurrentShims",
70 ],
71 apex_available: ["com.android.tethering"],
72}
73
74android_library {
75 name: "TetheringApiStableLib",
76 defaults: [
77 "TetheringAndroidLibraryDefaults",
78 "TetheringApiLevel"
79 ],
80 static_libs: [
81 "NetworkStackApiStableShims",
82 ],
83 apex_available: ["com.android.tethering"],
markchien932da862019-08-27 10:19:38 +080084}
85
markchien810aa682019-10-23 16:27:52 +080086// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
87cc_library {
markchienf967b112021-11-09 16:56:23 +080088 name: "libcom_android_networkstack_tethering_util_jni",
markchien5a8c8062021-10-27 13:22:27 +080089 sdk_version: "30",
Jooyung Han8182d8b2020-04-29 02:43:30 +090090 apex_available: [
91 "//apex_available:platform", // Used by InProcessTethering
92 "com.android.tethering",
93 ],
Nikita Ioffe583e35a2020-10-31 22:41:41 +000094 min_sdk_version: "30",
Lorenzo Colitti734b14e2021-02-05 23:56:09 +090095 header_libs: [
96 "bpf_syscall_wrappers",
97 "bpf_tethering_headers",
98 ],
markchien6aa38892019-09-25 14:33:39 +080099 srcs: [
markchien70526882020-11-12 00:17:15 +0800100 "jni/*.cpp",
markchien6aa38892019-09-25 14:33:39 +0800101 ],
102 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +0800103 "liblog",
markchien547e1682020-02-05 12:42:25 +0800104 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +0800105 ],
Orion Hodsone5bd0db2020-12-08 09:57:42 +0000106 static_libs: [
markchien782a5682021-11-10 01:11:33 +0800107 "libnet_utils_device_common_bpfjni",
Orion Hodsone5bd0db2020-12-08 09:57:42 +0000108 "libnetjniutils",
109 ],
markchien6aa38892019-09-25 14:33:39 +0800110
markchien547e1682020-02-05 12:42:25 +0800111 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
112 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
113 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
114 // build because soong complains of:
115 // module Tethering missing dependencies: libc++_shared
116 //
117 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
118 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
119 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
120 stl: "c++_static",
121
markchien6aa38892019-09-25 14:33:39 +0800122 cflags: [
123 "-Wall",
124 "-Werror",
125 "-Wno-unused-parameter",
126 "-Wthread-safety",
127 ],
markchien810aa682019-10-23 16:27:52 +0800128
129 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +0800130}
131
markchien932da862019-08-27 10:19:38 +0800132// Common defaults for compiling the actual APK.
133java_defaults {
134 name: "TetheringAppDefaults",
markchien932da862019-08-27 10:19:38 +0800135 privileged: true,
markchien6aa38892019-09-25 14:33:39 +0800136 jni_libs: [
markchienf967b112021-11-09 16:56:23 +0800137 "libcom_android_networkstack_tethering_util_jni",
markchien6aa38892019-09-25 14:33:39 +0800138 ],
markchien932da862019-08-27 10:19:38 +0800139 resource_dirs: [
140 "res",
141 ],
markchien9d353822019-12-16 20:15:20 +0800142 libs: [
143 "framework-tethering",
Anton Hanssonb8a342e2020-10-02 16:38:21 +0100144 "framework-wifi",
markchien9d353822019-12-16 20:15:20 +0800145 ],
146 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800147 optimize: {
148 proguard_flags_files: ["proguard.flags"],
149 },
150}
151
152// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800153android_app {
154 name: "InProcessTethering",
markchien5a8c8062021-10-27 13:22:27 +0800155 defaults: ["TetheringAppDefaults", "TetheringApiLevel"],
markchienee6ad372019-09-30 14:40:57 +0800156 static_libs: ["TetheringApiCurrentLib"],
157 certificate: "platform",
158 manifest: "AndroidManifest_InProcess.xml",
159 // InProcessTethering is a replacement for Tethering
160 overrides: ["Tethering"],
markchiendbaff662020-05-05 17:42:44 +0800161 apex_available: ["com.android.tethering"],
markchienee6ad372019-09-30 14:40:57 +0800162}
markchien932da862019-08-27 10:19:38 +0800163
markchien5a8c8062021-10-27 13:22:27 +0800164// Updatable tethering packaged for finalized API
markchien932da862019-08-27 10:19:38 +0800165android_app {
166 name: "Tethering",
markchien5a8c8062021-10-27 13:22:27 +0800167 defaults: ["TetheringAppDefaults", "TetheringApiLevel"],
168 static_libs: ["TetheringApiStableLib"],
169 certificate: "networkstack",
170 manifest: "AndroidManifest.xml",
171 use_embedded_native_libs: true,
172 // The permission configuration *must* be included to ensure security of the device
173 required: [
174 "NetworkPermissionConfig",
175 "privapp_whitelist_com.android.networkstack.tethering",
176 ],
177 apex_available: ["com.android.tethering"],
178}
179
180android_app {
181 name: "TetheringNext",
182 defaults: ["TetheringAppDefaults", "TetheringApiLevel"],
markchien932da862019-08-27 10:19:38 +0800183 static_libs: ["TetheringApiCurrentLib"],
184 certificate: "networkstack",
185 manifest: "AndroidManifest.xml",
186 use_embedded_native_libs: true,
187 // The permission configuration *must* be included to ensure security of the device
Aaron Huang3f69f1c2021-04-27 20:24:24 +0800188 required: [
189 "NetworkPermissionConfig",
190 "privapp_whitelist_com.android.networkstack.tethering",
191 ],
Jiyong Park1eb89332020-01-06 13:30:59 +0900192 apex_available: ["com.android.tethering"],
markchien932da862019-08-27 10:19:38 +0800193}
Hai Zhang6d71f102021-02-14 06:38:22 +0000194
195sdk {
196 name: "tethering-module-sdk",
Anton Hanssona12ffac2021-06-07 15:46:33 +0100197 bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"],
Hai Zhang6d71f102021-02-14 06:38:22 +0000198}