blob: bfb65241ec6d1056a3a0aa4b8f4dfc76eb6b9ca1 [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 Hanssonaaeaa192020-03-18 14:15:42 +000019 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +080020 srcs: [
21 "src/**/*.java",
markchien43e97e02019-09-03 15:58:06 +080022 ":framework-tethering-shared-srcs",
markchien12c5bb82020-01-07 14:43:17 +080023 ":tethering-module-utils-srcs",
markchien43e97e02019-09-03 15:58:06 +080024 ":services-tethering-shared-srcs",
markchien932da862019-08-27 10:19:38 +080025 ],
26 static_libs: [
27 "androidx.annotation_annotation",
Luke Huangd2007812020-04-07 15:45:02 +000028 "netd_aidl_interface-V3-java",
Remi NGUYEN VAN88998f42019-08-09 15:52:06 +090029 "netlink-client",
markchienee6ad372019-09-30 14:40:57 +080030 "networkstack-aidl-interfaces-unstable-java",
markchien547e1682020-02-05 12:42:25 +080031 "android.hardware.tetheroffload.config-V1.0-java",
markchien6aa38892019-09-25 14:33:39 +080032 "android.hardware.tetheroffload.control-V1.0-java",
markchien75fc6ab2020-01-14 17:28:47 +080033 "net-utils-framework-common",
markchien932da862019-08-27 10:19:38 +080034 ],
markchien9d353822019-12-16 20:15:20 +080035 libs: [
36 "framework-tethering",
Anton Hanssonaaeaa192020-03-18 14:15:42 +000037 "framework-wifi-stubs-systemapi",
Artur Satayev4784fb02019-12-10 17:47:53 +000038 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080039 ],
markchien84a92822020-01-16 11:21:53 +080040 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080041 manifest: "AndroidManifestBase.xml",
42}
43
44// Build tethering static library, used to compile both variants of the tethering.
45android_library {
46 name: "TetheringApiCurrentLib",
47 defaults: ["TetheringAndroidLibraryDefaults"],
48}
49
markchien810aa682019-10-23 16:27:52 +080050// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
51cc_library {
markchienf87ebdc2019-12-07 22:02:28 +080052 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080053 sdk_version: "current",
markchien6aa38892019-09-25 14:33:39 +080054 srcs: [
markchienf87ebdc2019-12-07 22:02:28 +080055 "jni/android_net_util_TetheringUtils.cpp",
markchien6aa38892019-09-25 14:33:39 +080056 ],
57 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080058 "liblog",
markchien547e1682020-02-05 12:42:25 +080059 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080060 ],
61
markchien547e1682020-02-05 12:42:25 +080062 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
63 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
64 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
65 // build because soong complains of:
66 // module Tethering missing dependencies: libc++_shared
67 //
68 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
69 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
70 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
71 stl: "c++_static",
72
markchien6aa38892019-09-25 14:33:39 +080073 cflags: [
74 "-Wall",
75 "-Werror",
76 "-Wno-unused-parameter",
77 "-Wthread-safety",
78 ],
markchien810aa682019-10-23 16:27:52 +080079
80 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +080081}
82
markchien932da862019-08-27 10:19:38 +080083// Common defaults for compiling the actual APK.
84java_defaults {
85 name: "TetheringAppDefaults",
Anton Hanssonaaeaa192020-03-18 14:15:42 +000086 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +080087 privileged: true,
markchien6aa38892019-09-25 14:33:39 +080088 jni_libs: [
markchienf87ebdc2019-12-07 22:02:28 +080089 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +080090 ],
markchien932da862019-08-27 10:19:38 +080091 resource_dirs: [
92 "res",
93 ],
markchien9d353822019-12-16 20:15:20 +080094 libs: [
95 "framework-tethering",
96 ],
97 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +080098 optimize: {
99 proguard_flags_files: ["proguard.flags"],
100 },
101}
102
103// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800104android_app {
105 name: "InProcessTethering",
106 defaults: ["TetheringAppDefaults"],
107 static_libs: ["TetheringApiCurrentLib"],
108 certificate: "platform",
109 manifest: "AndroidManifest_InProcess.xml",
110 // InProcessTethering is a replacement for Tethering
111 overrides: ["Tethering"],
markchienee6ad372019-09-30 14:40:57 +0800112}
markchien932da862019-08-27 10:19:38 +0800113
114// Updatable tethering packaged as an application
115android_app {
116 name: "Tethering",
117 defaults: ["TetheringAppDefaults"],
118 static_libs: ["TetheringApiCurrentLib"],
119 certificate: "networkstack",
120 manifest: "AndroidManifest.xml",
121 use_embedded_native_libs: true,
122 // The permission configuration *must* be included to ensure security of the device
123 required: ["NetworkPermissionConfig"],
Jiyong Park1eb89332020-01-06 13:30:59 +0900124 apex_available: ["com.android.tethering"],
markchien932da862019-08-27 10:19:38 +0800125}