blob: 731755802b2b74e335c1c3085dcddb06e2669c0d [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
17java_defaults {
18 name: "TetheringAndroidLibraryDefaults",
Anton Hanssonbbe4af12020-03-18 14:15:42 +000019 sdk_version: "module_current",
Nikita Ioffe583e35a2020-10-31 22:41:41 +000020 min_sdk_version: "30",
markchien932da862019-08-27 10:19:38 +080021 srcs: [
Hungming Chendd55b912020-12-26 17:13:22 +080022 "apishim/**/*.java",
markchien932da862019-08-27 10:19:38 +080023 "src/**/*.java",
markchien43e97e02019-09-03 15:58:06 +080024 ":framework-tethering-shared-srcs",
markchien12c5bb82020-01-07 14:43:17 +080025 ":tethering-module-utils-srcs",
markchien43e97e02019-09-03 15:58:06 +080026 ":services-tethering-shared-srcs",
markchien932da862019-08-27 10:19:38 +080027 ],
28 static_libs: [
29 "androidx.annotation_annotation",
Hungming Chendd55b912020-12-26 17:13:22 +080030 "modules-utils-build",
Remi NGUYEN VAN88998f42019-08-09 15:52:06 +090031 "netlink-client",
Xiao Mae5e07432020-06-19 12:04:13 +090032 // TODO: use networkstack-client instead of just including the AIDL interface
33 "networkstack-aidl-interfaces-unstable-java",
markchien547e1682020-02-05 12:42:25 +080034 "android.hardware.tetheroffload.config-V1.0-java",
markchien6aa38892019-09-25 14:33:39 +080035 "android.hardware.tetheroffload.control-V1.0-java",
markchien75fc6ab2020-01-14 17:28:47 +080036 "net-utils-framework-common",
Chalard Jeanbdcca922020-06-26 00:19:33 +090037 "net-utils-device-common",
lucaslinee661df2020-12-28 16:44:49 +080038 "netd-client",
markchien932da862019-08-27 10:19:38 +080039 ],
markchien9d353822019-12-16 20:15:20 +080040 libs: [
waynemab7048af2020-06-19 19:48:56 +080041 "framework-statsd.stubs.module_lib",
Paul Duffin2dae2722020-05-13 12:28:49 +010042 "framework-tethering.impl",
Paul Duffin6812c1b2020-05-31 11:35:50 +010043 "framework-wifi",
Artur Satayev4784fb02019-12-10 17:47:53 +000044 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080045 ],
markchien84a92822020-01-16 11:21:53 +080046 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080047 manifest: "AndroidManifestBase.xml",
48}
49
50// Build tethering static library, used to compile both variants of the tethering.
51android_library {
52 name: "TetheringApiCurrentLib",
53 defaults: ["TetheringAndroidLibraryDefaults"],
54}
55
markchien810aa682019-10-23 16:27:52 +080056// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
57cc_library {
markchienf87ebdc2019-12-07 22:02:28 +080058 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080059 sdk_version: "current",
Jooyung Han8182d8b2020-04-29 02:43:30 +090060 apex_available: [
61 "//apex_available:platform", // Used by InProcessTethering
62 "com.android.tethering",
63 ],
Nikita Ioffe583e35a2020-10-31 22:41:41 +000064 min_sdk_version: "30",
Lorenzo Colitti734b14e2021-02-05 23:56:09 +090065 header_libs: [
66 "bpf_syscall_wrappers",
67 "bpf_tethering_headers",
68 ],
markchien6aa38892019-09-25 14:33:39 +080069 srcs: [
markchien70526882020-11-12 00:17:15 +080070 "jni/*.cpp",
markchien6aa38892019-09-25 14:33:39 +080071 ],
72 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080073 "liblog",
markchien547e1682020-02-05 12:42:25 +080074 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080075 ],
Orion Hodsone5bd0db2020-12-08 09:57:42 +000076 static_libs: [
77 "libnetjniutils",
78 ],
markchien6aa38892019-09-25 14:33:39 +080079
markchien547e1682020-02-05 12:42:25 +080080 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
81 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
82 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
83 // build because soong complains of:
84 // module Tethering missing dependencies: libc++_shared
85 //
86 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
87 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
88 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
89 stl: "c++_static",
90
markchien6aa38892019-09-25 14:33:39 +080091 cflags: [
92 "-Wall",
93 "-Werror",
94 "-Wno-unused-parameter",
95 "-Wthread-safety",
96 ],
markchien810aa682019-10-23 16:27:52 +080097
98 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +080099}
100
markchien932da862019-08-27 10:19:38 +0800101// Common defaults for compiling the actual APK.
102java_defaults {
103 name: "TetheringAppDefaults",
Anton Hanssonbbe4af12020-03-18 14:15:42 +0000104 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +0800105 privileged: true,
markchien6aa38892019-09-25 14:33:39 +0800106 jni_libs: [
markchienf87ebdc2019-12-07 22:02:28 +0800107 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +0800108 ],
markchien932da862019-08-27 10:19:38 +0800109 resource_dirs: [
110 "res",
111 ],
markchien9d353822019-12-16 20:15:20 +0800112 libs: [
113 "framework-tethering",
Anton Hanssonb8a342e2020-10-02 16:38:21 +0100114 "framework-wifi",
markchien9d353822019-12-16 20:15:20 +0800115 ],
116 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800117 optimize: {
118 proguard_flags_files: ["proguard.flags"],
119 },
120}
121
122// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800123android_app {
124 name: "InProcessTethering",
125 defaults: ["TetheringAppDefaults"],
126 static_libs: ["TetheringApiCurrentLib"],
127 certificate: "platform",
128 manifest: "AndroidManifest_InProcess.xml",
129 // InProcessTethering is a replacement for Tethering
130 overrides: ["Tethering"],
markchiendbaff662020-05-05 17:42:44 +0800131 apex_available: ["com.android.tethering"],
Nikita Ioffe583e35a2020-10-31 22:41:41 +0000132 min_sdk_version: "30",
markchienee6ad372019-09-30 14:40:57 +0800133}
markchien932da862019-08-27 10:19:38 +0800134
135// Updatable tethering packaged as an application
136android_app {
137 name: "Tethering",
138 defaults: ["TetheringAppDefaults"],
139 static_libs: ["TetheringApiCurrentLib"],
140 certificate: "networkstack",
141 manifest: "AndroidManifest.xml",
142 use_embedded_native_libs: true,
143 // The permission configuration *must* be included to ensure security of the device
144 required: ["NetworkPermissionConfig"],
Jiyong Park1eb89332020-01-06 13:30:59 +0900145 apex_available: ["com.android.tethering"],
Nikita Ioffe583e35a2020-10-31 22:41:41 +0000146 min_sdk_version: "30",
markchien932da862019-08-27 10:19:38 +0800147}