blob: 40f394a3f78988083b4453957f0b6eab2749601f [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",
Hungming Chen140042d2020-05-29 19:30:01 +080028 "netd_aidl_interface-unstable-java",
Remi NGUYEN VAN88998f42019-08-09 15:52:06 +090029 "netlink-client",
Remi NGUYEN VAN0d0ea272020-06-15 08:03:02 +000030 // 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",
markchien932da862019-08-27 10:19:38 +080035 ],
markchien9d353822019-12-16 20:15:20 +080036 libs: [
waynemab7048af2020-06-19 19:48:56 +080037 "framework-statsd.stubs.module_lib",
Paul Duffincbac8e02020-05-13 12:28:49 +010038 "framework-tethering.impl",
Paul Duffin6812c1b2020-05-31 11:35:50 +010039 "framework-wifi",
Artur Satayev4784fb02019-12-10 17:47:53 +000040 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080041 ],
markchien84a92822020-01-16 11:21:53 +080042 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080043 manifest: "AndroidManifestBase.xml",
44}
45
46// Build tethering static library, used to compile both variants of the tethering.
47android_library {
48 name: "TetheringApiCurrentLib",
49 defaults: ["TetheringAndroidLibraryDefaults"],
50}
51
markchien810aa682019-10-23 16:27:52 +080052// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
53cc_library {
markchienf87ebdc2019-12-07 22:02:28 +080054 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080055 sdk_version: "current",
Jooyung Han5f9f31c2020-04-29 02:43:30 +090056 apex_available: [
57 "//apex_available:platform", // Used by InProcessTethering
58 "com.android.tethering",
59 ],
60 min_sdk_version: "current",
markchien6aa38892019-09-25 14:33:39 +080061 srcs: [
markchienf87ebdc2019-12-07 22:02:28 +080062 "jni/android_net_util_TetheringUtils.cpp",
markchien6aa38892019-09-25 14:33:39 +080063 ],
64 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080065 "liblog",
markchien547e1682020-02-05 12:42:25 +080066 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080067 ],
68
markchien547e1682020-02-05 12:42:25 +080069 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
70 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
71 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
72 // build because soong complains of:
73 // module Tethering missing dependencies: libc++_shared
74 //
75 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
76 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
77 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
78 stl: "c++_static",
79
markchien6aa38892019-09-25 14:33:39 +080080 cflags: [
81 "-Wall",
82 "-Werror",
83 "-Wno-unused-parameter",
84 "-Wthread-safety",
85 ],
markchien810aa682019-10-23 16:27:52 +080086
87 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +080088}
89
markchien932da862019-08-27 10:19:38 +080090// Common defaults for compiling the actual APK.
91java_defaults {
92 name: "TetheringAppDefaults",
Anton Hanssonaaeaa192020-03-18 14:15:42 +000093 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +080094 privileged: true,
markchien6aa38892019-09-25 14:33:39 +080095 jni_libs: [
markchienf87ebdc2019-12-07 22:02:28 +080096 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +080097 ],
markchien932da862019-08-27 10:19:38 +080098 resource_dirs: [
99 "res",
100 ],
markchien9d353822019-12-16 20:15:20 +0800101 libs: [
102 "framework-tethering",
103 ],
104 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800105 optimize: {
106 proguard_flags_files: ["proguard.flags"],
107 },
108}
109
110// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800111android_app {
112 name: "InProcessTethering",
113 defaults: ["TetheringAppDefaults"],
114 static_libs: ["TetheringApiCurrentLib"],
115 certificate: "platform",
116 manifest: "AndroidManifest_InProcess.xml",
117 // InProcessTethering is a replacement for Tethering
118 overrides: ["Tethering"],
markchien9548c852020-05-05 17:42:44 +0800119 apex_available: ["com.android.tethering"],
Jooyung Han595adc02020-05-11 13:18:29 +0900120 min_sdk_version: "current",
markchienee6ad372019-09-30 14:40:57 +0800121}
markchien932da862019-08-27 10:19:38 +0800122
123// Updatable tethering packaged as an application
124android_app {
125 name: "Tethering",
126 defaults: ["TetheringAppDefaults"],
127 static_libs: ["TetheringApiCurrentLib"],
128 certificate: "networkstack",
129 manifest: "AndroidManifest.xml",
130 use_embedded_native_libs: true,
131 // The permission configuration *must* be included to ensure security of the device
132 required: ["NetworkPermissionConfig"],
Jiyong Park1eb89332020-01-06 13:30:59 +0900133 apex_available: ["com.android.tethering"],
Jooyung Han5f9f31c2020-04-29 02:43:30 +0900134 min_sdk_version: "current",
markchien932da862019-08-27 10:19:38 +0800135}