blob: 4116afca9816bad909ef02e8733b5539362a0121 [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",
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",
Jeongik Cha0630f382020-05-04 16:19:40 +090030 "networkstack-aidl-interfaces-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: [
Paul Duffin2dae2722020-05-13 12:28:49 +010036 "framework-tethering.impl",
Artur Satayev4784fb02019-12-10 17:47:53 +000037 "unsupportedappusage",
markchien9d353822019-12-16 20:15:20 +080038 ],
markchien84a92822020-01-16 11:21:53 +080039 plugins: ["java_api_finder"],
markchien932da862019-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
markchien810aa682019-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 {
markchienf87ebdc2019-12-07 22:02:28 +080051 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080052 sdk_version: "current",
Jooyung Han8182d8b2020-04-29 02:43:30 +090053 apex_available: [
54 "//apex_available:platform", // Used by InProcessTethering
55 "com.android.tethering",
56 ],
57 min_sdk_version: "current",
markchien6aa38892019-09-25 14:33:39 +080058 srcs: [
markchienf87ebdc2019-12-07 22:02:28 +080059 "jni/android_net_util_TetheringUtils.cpp",
markchien6aa38892019-09-25 14:33:39 +080060 ],
61 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080062 "liblog",
markchien547e1682020-02-05 12:42:25 +080063 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080064 ],
65
markchien547e1682020-02-05 12:42:25 +080066 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
67 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
68 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
69 // build because soong complains of:
70 // module Tethering missing dependencies: libc++_shared
71 //
72 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
73 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
74 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
75 stl: "c++_static",
76
markchien6aa38892019-09-25 14:33:39 +080077 cflags: [
78 "-Wall",
79 "-Werror",
80 "-Wno-unused-parameter",
81 "-Wthread-safety",
82 ],
markchien810aa682019-10-23 16:27:52 +080083
84 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +080085}
86
markchien932da862019-08-27 10:19:38 +080087// Common defaults for compiling the actual APK.
88java_defaults {
89 name: "TetheringAppDefaults",
Anton Hanssonbbe4af12020-03-18 14:15:42 +000090 sdk_version: "module_current",
markchien932da862019-08-27 10:19:38 +080091 privileged: true,
markchien6aa38892019-09-25 14:33:39 +080092 jni_libs: [
markchienf87ebdc2019-12-07 22:02:28 +080093 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +080094 ],
markchien932da862019-08-27 10:19:38 +080095 resource_dirs: [
96 "res",
97 ],
markchien9d353822019-12-16 20:15:20 +080098 libs: [
Paul Duffin2dae2722020-05-13 12:28:49 +010099 "framework-tethering.impl",
markchien9d353822019-12-16 20:15:20 +0800100 ],
101 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800102 optimize: {
103 proguard_flags_files: ["proguard.flags"],
104 },
105}
106
107// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800108android_app {
109 name: "InProcessTethering",
110 defaults: ["TetheringAppDefaults"],
111 static_libs: ["TetheringApiCurrentLib"],
112 certificate: "platform",
113 manifest: "AndroidManifest_InProcess.xml",
114 // InProcessTethering is a replacement for Tethering
115 overrides: ["Tethering"],
markchiendbaff662020-05-05 17:42:44 +0800116 apex_available: ["com.android.tethering"],
Jooyung Han482af2e2020-05-11 13:18:29 +0900117 min_sdk_version: "current",
markchienee6ad372019-09-30 14:40:57 +0800118}
markchien932da862019-08-27 10:19:38 +0800119
120// Updatable tethering packaged as an application
121android_app {
122 name: "Tethering",
123 defaults: ["TetheringAppDefaults"],
124 static_libs: ["TetheringApiCurrentLib"],
125 certificate: "networkstack",
126 manifest: "AndroidManifest.xml",
127 use_embedded_native_libs: true,
128 // The permission configuration *must* be included to ensure security of the device
129 required: ["NetworkPermissionConfig"],
Jiyong Park1eb89332020-01-06 13:30:59 +0900130 apex_available: ["com.android.tethering"],
Jooyung Han8182d8b2020-04-29 02:43:30 +0900131 min_sdk_version: "current",
markchien932da862019-08-27 10:19:38 +0800132}