blob: 5edcfe38bdd645e40d17e5b063b80fec17b476ab [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: [
22 "src/**/*.java",
markchien43e97e02019-09-03 15:58:06 +080023 ":framework-tethering-shared-srcs",
markchien12c5bb82020-01-07 14:43:17 +080024 ":tethering-module-utils-srcs",
markchien43e97e02019-09-03 15:58:06 +080025 ":services-tethering-shared-srcs",
markchien932da862019-08-27 10:19:38 +080026 ],
27 static_libs: [
28 "androidx.annotation_annotation",
Remi NGUYEN VAN88998f42019-08-09 15:52:06 +090029 "netlink-client",
Xiao Mae5e07432020-06-19 12:04:13 +090030 // TODO: use networkstack-client instead of just including the AIDL interface
31 "networkstack-aidl-interfaces-unstable-java",
markchien547e1682020-02-05 12:42:25 +080032 "android.hardware.tetheroffload.config-V1.0-java",
markchien6aa38892019-09-25 14:33:39 +080033 "android.hardware.tetheroffload.control-V1.0-java",
markchien75fc6ab2020-01-14 17:28:47 +080034 "net-utils-framework-common",
Chalard Jeanbdcca922020-06-26 00:19:33 +090035 "net-utils-device-common",
lucaslinee661df2020-12-28 16:44:49 +080036 "netd-client",
markchien932da862019-08-27 10:19:38 +080037 ],
markchien9d353822019-12-16 20:15:20 +080038 libs: [
waynemab7048af2020-06-19 19:48:56 +080039 "framework-statsd.stubs.module_lib",
Paul Duffin2dae2722020-05-13 12:28:49 +010040 "framework-tethering.impl",
Paul Duffin6812c1b2020-05-31 11:35:50 +010041 "framework-wifi",
Artur Satayev4784fb02019-12-10 17:47:53 +000042 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080043 ],
markchien84a92822020-01-16 11:21:53 +080044 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080045 manifest: "AndroidManifestBase.xml",
46}
47
48// Build tethering static library, used to compile both variants of the tethering.
49android_library {
50 name: "TetheringApiCurrentLib",
51 defaults: ["TetheringAndroidLibraryDefaults"],
52}
53
markchien810aa682019-10-23 16:27:52 +080054// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
55cc_library {
markchienf87ebdc2019-12-07 22:02:28 +080056 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080057 sdk_version: "current",
Jooyung Han8182d8b2020-04-29 02:43:30 +090058 apex_available: [
59 "//apex_available:platform", // Used by InProcessTethering
60 "com.android.tethering",
61 ],
Nikita Ioffe583e35a2020-10-31 22:41:41 +000062 min_sdk_version: "30",
markchien70526882020-11-12 00:17:15 +080063 include_dirs: [
64 // TODO: use the libbpf_android_headers instead of just including the header files.
65 "system/bpf/libbpf_android/include/",
66 ],
markchien6aa38892019-09-25 14:33:39 +080067 srcs: [
markchien70526882020-11-12 00:17:15 +080068 "jni/*.cpp",
markchien6aa38892019-09-25 14:33:39 +080069 ],
70 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080071 "liblog",
markchien547e1682020-02-05 12:42:25 +080072 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080073 ],
Orion Hodsone5bd0db2020-12-08 09:57:42 +000074 static_libs: [
75 "libnetjniutils",
76 ],
markchien6aa38892019-09-25 14:33:39 +080077
markchien547e1682020-02-05 12:42:25 +080078 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
79 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
80 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
81 // build because soong complains of:
82 // module Tethering missing dependencies: libc++_shared
83 //
84 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
85 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
86 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
87 stl: "c++_static",
88
markchien6aa38892019-09-25 14:33:39 +080089 cflags: [
90 "-Wall",
91 "-Werror",
92 "-Wno-unused-parameter",
93 "-Wthread-safety",
94 ],
markchien810aa682019-10-23 16:27:52 +080095
96 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +080097}
98
markchien932da862019-08-27 10:19:38 +080099// Common defaults for compiling the actual APK.
100java_defaults {
101 name: "TetheringAppDefaults",
Anton Hanssonbbe4af12020-03-18 14:15:42 +0000102 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +0800103 privileged: true,
markchien6aa38892019-09-25 14:33:39 +0800104 jni_libs: [
markchienf87ebdc2019-12-07 22:02:28 +0800105 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +0800106 ],
markchien932da862019-08-27 10:19:38 +0800107 resource_dirs: [
108 "res",
109 ],
markchien9d353822019-12-16 20:15:20 +0800110 libs: [
111 "framework-tethering",
Anton Hanssonb8a342e2020-10-02 16:38:21 +0100112 "framework-wifi",
markchien9d353822019-12-16 20:15:20 +0800113 ],
114 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800115 optimize: {
116 proguard_flags_files: ["proguard.flags"],
117 },
118}
119
120// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800121android_app {
122 name: "InProcessTethering",
123 defaults: ["TetheringAppDefaults"],
124 static_libs: ["TetheringApiCurrentLib"],
125 certificate: "platform",
126 manifest: "AndroidManifest_InProcess.xml",
127 // InProcessTethering is a replacement for Tethering
128 overrides: ["Tethering"],
markchiendbaff662020-05-05 17:42:44 +0800129 apex_available: ["com.android.tethering"],
Nikita Ioffe583e35a2020-10-31 22:41:41 +0000130 min_sdk_version: "30",
markchienee6ad372019-09-30 14:40:57 +0800131}
markchien932da862019-08-27 10:19:38 +0800132
133// Updatable tethering packaged as an application
134android_app {
135 name: "Tethering",
136 defaults: ["TetheringAppDefaults"],
137 static_libs: ["TetheringApiCurrentLib"],
138 certificate: "networkstack",
139 manifest: "AndroidManifest.xml",
140 use_embedded_native_libs: true,
141 // The permission configuration *must* be included to ensure security of the device
142 required: ["NetworkPermissionConfig"],
Jiyong Park1eb89332020-01-06 13:30:59 +0900143 apex_available: ["com.android.tethering"],
Nikita Ioffe583e35a2020-10-31 22:41:41 +0000144 min_sdk_version: "30",
markchien932da862019-08-27 10:19:38 +0800145}