blob: 4efe93439b429fb09a0ff63f7ddf542461b08b44 [file] [log] [blame]
markchien017fef22019-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",
markchien2ee36f72020-01-15 17:54:52 +080019 sdk_version: "system_current",
markchien017fef22019-08-27 10:19:38 +080020 srcs: [
21 "src/**/*.java",
markchiena6ba54d2019-09-03 15:58:06 +080022 ":framework-tethering-shared-srcs",
markchien92b8e7f2020-01-07 14:43:17 +080023 ":tethering-module-utils-srcs",
markchiena6ba54d2019-09-03 15:58:06 +080024 ":services-tethering-shared-srcs",
markchien017fef22019-08-27 10:19:38 +080025 ],
26 static_libs: [
27 "androidx.annotation_annotation",
markchien0df2ebc42019-09-30 14:40:57 +080028 "netd_aidl_interface-unstable-java",
Remi NGUYEN VAN882d8b32019-08-09 15:52:06 +090029 "netlink-client",
markchien0df2ebc42019-09-30 14:40:57 +080030 "networkstack-aidl-interfaces-unstable-java",
markchien0d5a36b2020-02-05 12:42:25 +080031 "android.hardware.tetheroffload.config-V1.0-java",
markchien77c17be62019-09-25 14:33:39 +080032 "android.hardware.tetheroffload.control-V1.0-java",
markchien21372af2020-01-14 17:28:47 +080033 "net-utils-framework-common",
markchien017fef22019-08-27 10:19:38 +080034 ],
markchien6d06f6d2019-12-16 20:15:20 +080035 libs: [
36 "framework-tethering",
Artur Satayev2d330f62019-12-10 17:47:53 +000037 "unsupportedappusage",
markchien6d06f6d2019-12-16 20:15:20 +080038 ],
markchien8fad2082020-01-16 11:21:53 +080039 plugins: ["java_api_finder"],
markchien017fef22019-08-27 10:19:38 +080040 manifest: "AndroidManifestBase.xml",
41}
42
43// Build tethering static library, used to compile both variants of the tethering.
44android_library {
45 name: "TetheringApiCurrentLib",
46 defaults: ["TetheringAndroidLibraryDefaults"],
47}
48
markchiend8676d92019-10-23 16:27:52 +080049// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
50cc_library {
markchien771c3e92019-12-07 22:02:28 +080051 name: "libtetherutilsjni",
markchien0d5a36b2020-02-05 12:42:25 +080052 sdk_version: "current",
markchien77c17be62019-09-25 14:33:39 +080053 srcs: [
markchien771c3e92019-12-07 22:02:28 +080054 "jni/android_net_util_TetheringUtils.cpp",
markchien77c17be62019-09-25 14:33:39 +080055 ],
56 shared_libs: [
markchien77c17be62019-09-25 14:33:39 +080057 "liblog",
markchien0d5a36b2020-02-05 12:42:25 +080058 "libnativehelper_compat_libc++",
markchien77c17be62019-09-25 14:33:39 +080059 ],
60
markchien0d5a36b2020-02-05 12:42:25 +080061 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
62 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
63 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
64 // build because soong complains of:
65 // module Tethering missing dependencies: libc++_shared
66 //
67 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
68 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
69 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
70 stl: "c++_static",
71
markchien77c17be62019-09-25 14:33:39 +080072 cflags: [
73 "-Wall",
74 "-Werror",
75 "-Wno-unused-parameter",
76 "-Wthread-safety",
77 ],
markchiend8676d92019-10-23 16:27:52 +080078
79 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien77c17be62019-09-25 14:33:39 +080080}
81
markchien017fef22019-08-27 10:19:38 +080082// Common defaults for compiling the actual APK.
83java_defaults {
84 name: "TetheringAppDefaults",
markchien2ee36f72020-01-15 17:54:52 +080085 sdk_version: "system_current",
markchien017fef22019-08-27 10:19:38 +080086 privileged: true,
markchiend8676d92019-10-23 16:27:52 +080087 // Build system doesn't track transitive dependeicies for jni_libs, list all the dependencies
88 // explicitly.
markchien77c17be62019-09-25 14:33:39 +080089 jni_libs: [
markchien0d5a36b2020-02-05 12:42:25 +080090 "liblog",
markchiend8676d92019-10-23 16:27:52 +080091 "libnativehelper_compat_libc++",
markchien771c3e92019-12-07 22:02:28 +080092 "libtetherutilsjni",
markchien77c17be62019-09-25 14:33:39 +080093 ],
markchien017fef22019-08-27 10:19:38 +080094 resource_dirs: [
95 "res",
96 ],
markchien6d06f6d2019-12-16 20:15:20 +080097 libs: [
98 "framework-tethering",
99 ],
100 jarjar_rules: "jarjar-rules.txt",
markchien017fef22019-08-27 10:19:38 +0800101 optimize: {
102 proguard_flags_files: ["proguard.flags"],
103 },
104}
105
106// Non-updatable tethering running in the system server process for devices not using the module
markchien0df2ebc42019-09-30 14:40:57 +0800107android_app {
108 name: "InProcessTethering",
109 defaults: ["TetheringAppDefaults"],
110 static_libs: ["TetheringApiCurrentLib"],
111 certificate: "platform",
112 manifest: "AndroidManifest_InProcess.xml",
113 // InProcessTethering is a replacement for Tethering
114 overrides: ["Tethering"],
markchien0df2ebc42019-09-30 14:40:57 +0800115}
markchien017fef22019-08-27 10:19:38 +0800116
117// Updatable tethering packaged as an application
118android_app {
119 name: "Tethering",
120 defaults: ["TetheringAppDefaults"],
121 static_libs: ["TetheringApiCurrentLib"],
122 certificate: "networkstack",
123 manifest: "AndroidManifest.xml",
124 use_embedded_native_libs: true,
125 // The permission configuration *must* be included to ensure security of the device
126 required: ["NetworkPermissionConfig"],
Jiyong Park90247c82020-01-06 13:30:59 +0900127 apex_available: ["com.android.tethering"],
markchien017fef22019-08-27 10:19:38 +0800128}