blob: 3111ab7011916a40bb4d01c125031ab2bf9452dd [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",
Remi NGUYEN VAN63dc2792020-01-31 15:05:22 +090019 // TODO (b/146757305): change to module API once available
Remi NGUYEN VANc8871c12020-02-13 09:16:19 +090020 // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready.
Remi NGUYEN VAN63dc2792020-01-31 15:05:22 +090021 sdk_version: "core_platform",
markchien932da862019-08-27 10:19:38 +080022 srcs: [
23 "src/**/*.java",
markchien43e97e02019-09-03 15:58:06 +080024 ":framework-tethering-shared-srcs",
markchien12c5bb82020-01-07 14:43:17 +080025 ":tethering-module-utils-srcs",
markchien43e97e02019-09-03 15:58:06 +080026 ":services-tethering-shared-srcs",
markchien932da862019-08-27 10:19:38 +080027 ],
28 static_libs: [
29 "androidx.annotation_annotation",
markchienee6ad372019-09-30 14:40:57 +080030 "netd_aidl_interface-unstable-java",
Remi NGUYEN VAN88998f42019-08-09 15:52:06 +090031 "netlink-client",
markchienee6ad372019-09-30 14:40:57 +080032 "networkstack-aidl-interfaces-unstable-java",
markchien547e1682020-02-05 12:42:25 +080033 "android.hardware.tetheroffload.config-V1.0-java",
markchien6aa38892019-09-25 14:33:39 +080034 "android.hardware.tetheroffload.control-V1.0-java",
markchien75fc6ab2020-01-14 17:28:47 +080035 "net-utils-framework-common",
markchien932da862019-08-27 10:19:38 +080036 ],
markchien9d353822019-12-16 20:15:20 +080037 libs: [
Remi NGUYEN VANc8871c12020-02-13 09:16:19 +090038 // Order matters: framework-tethering needs to be before the system stubs, otherwise
39 // hidden fields in the framework-tethering classes (which are also used to generate stubs)
40 // will not be found.
markchien9d353822019-12-16 20:15:20 +080041 "framework-tethering",
Remi NGUYEN VANc8871c12020-02-13 09:16:19 +090042 "android_system_stubs_current",
43 "framework-res",
Artur Satayev4784fb02019-12-10 17:47:53 +000044 "unsupportedappusage",
Remi NGUYEN VAN63dc2792020-01-31 15:05:22 +090045 "android_system_stubs_current",
46 "framework-res",
markchien9d353822019-12-16 20:15:20 +080047 ],
markchien84a92822020-01-16 11:21:53 +080048 plugins: ["java_api_finder"],
markchien932da862019-08-27 10:19:38 +080049 manifest: "AndroidManifestBase.xml",
50}
51
52// Build tethering static library, used to compile both variants of the tethering.
53android_library {
54 name: "TetheringApiCurrentLib",
55 defaults: ["TetheringAndroidLibraryDefaults"],
56}
57
markchien810aa682019-10-23 16:27:52 +080058// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
59cc_library {
markchienf87ebdc2019-12-07 22:02:28 +080060 name: "libtetherutilsjni",
markchien547e1682020-02-05 12:42:25 +080061 sdk_version: "current",
markchien6aa38892019-09-25 14:33:39 +080062 srcs: [
markchienf87ebdc2019-12-07 22:02:28 +080063 "jni/android_net_util_TetheringUtils.cpp",
markchien6aa38892019-09-25 14:33:39 +080064 ],
65 shared_libs: [
markchien6aa38892019-09-25 14:33:39 +080066 "liblog",
markchien547e1682020-02-05 12:42:25 +080067 "libnativehelper_compat_libc++",
markchien6aa38892019-09-25 14:33:39 +080068 ],
69
markchien547e1682020-02-05 12:42:25 +080070 // We cannot use plain "libc++" here to link libc++ dynamically because it results in:
71 // java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
72 // even if "libc++" is added into jni_libs below. Adding "libc++_shared" into jni_libs doesn't
73 // build because soong complains of:
74 // module Tethering missing dependencies: libc++_shared
75 //
76 // So, link libc++ statically. This means that we also need to ensure that all the C++ libraries
77 // we depend on do not dynamically link libc++. This is currently the case, because liblog is
78 // C-only and libnativehelper_compat_libc also uses stl: "c++_static".
79 stl: "c++_static",
80
markchien6aa38892019-09-25 14:33:39 +080081 cflags: [
82 "-Wall",
83 "-Werror",
84 "-Wno-unused-parameter",
85 "-Wthread-safety",
86 ],
markchien810aa682019-10-23 16:27:52 +080087
88 ldflags: ["-Wl,--exclude-libs=ALL,-error-limit=0"],
markchien6aa38892019-09-25 14:33:39 +080089}
90
markchien932da862019-08-27 10:19:38 +080091// Common defaults for compiling the actual APK.
92java_defaults {
93 name: "TetheringAppDefaults",
Remi NGUYEN VAN63dc2792020-01-31 15:05:22 +090094 // TODO (b/146757305): change to module API once available
Remi NGUYEN VANc8871c12020-02-13 09:16:19 +090095 // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready.
Remi NGUYEN VAN63dc2792020-01-31 15:05:22 +090096 sdk_version: "core_platform",
markchien932da862019-08-27 10:19:38 +080097 privileged: true,
markchien810aa682019-10-23 16:27:52 +080098 // Build system doesn't track transitive dependeicies for jni_libs, list all the dependencies
99 // explicitly.
markchien6aa38892019-09-25 14:33:39 +0800100 jni_libs: [
markchien547e1682020-02-05 12:42:25 +0800101 "liblog",
markchien810aa682019-10-23 16:27:52 +0800102 "libnativehelper_compat_libc++",
markchienf87ebdc2019-12-07 22:02:28 +0800103 "libtetherutilsjni",
markchien6aa38892019-09-25 14:33:39 +0800104 ],
markchien932da862019-08-27 10:19:38 +0800105 resource_dirs: [
106 "res",
107 ],
markchien9d353822019-12-16 20:15:20 +0800108 libs: [
Remi NGUYEN VANc8871c12020-02-13 09:16:19 +0900109 // Order matters: framework-tethering needs to be before the system stubs, otherwise
110 // hidden fields in the framework-tethering classes (which are also used to generate stubs)
111 // will not be found.
markchien9d353822019-12-16 20:15:20 +0800112 "framework-tethering",
Remi NGUYEN VAN63dc2792020-01-31 15:05:22 +0900113 "android_system_stubs_current",
114 "framework-res",
markchien9d353822019-12-16 20:15:20 +0800115 ],
116 jarjar_rules: "jarjar-rules.txt",
markchien932da862019-08-27 10:19:38 +0800117 optimize: {
118 proguard_flags_files: ["proguard.flags"],
119 },
120}
121
122// Non-updatable tethering running in the system server process for devices not using the module
markchienee6ad372019-09-30 14:40:57 +0800123android_app {
124 name: "InProcessTethering",
125 defaults: ["TetheringAppDefaults"],
126 static_libs: ["TetheringApiCurrentLib"],
127 certificate: "platform",
128 manifest: "AndroidManifest_InProcess.xml",
129 // InProcessTethering is a replacement for Tethering
130 overrides: ["Tethering"],
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"],
markchien932da862019-08-27 10:19:38 +0800144}